diff options
-rw-r--r-- | apps/playlist.c | 1 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 24 |
2 files changed, 12 insertions, 13 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 4440c77dbf..652f805aea 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -3780,6 +3780,7 @@ int playlist_set_current(struct playlist_info* playlist) | |||
3780 | current_playlist.amount = playlist->amount; | 3780 | current_playlist.amount = playlist->amount; |
3781 | current_playlist.last_insert_pos = playlist->last_insert_pos; | 3781 | current_playlist.last_insert_pos = playlist->last_insert_pos; |
3782 | current_playlist.seed = playlist->seed; | 3782 | current_playlist.seed = playlist->seed; |
3783 | current_playlist.flags = playlist->flags; | ||
3783 | 3784 | ||
3784 | result = 0; | 3785 | result = 0; |
3785 | 3786 | ||
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index d12aa26de4..d780bfb7e9 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -121,8 +121,6 @@ static struct playlist_viewer viewer; | |||
121 | static struct playlist_info temp_playlist; | 121 | static struct playlist_info temp_playlist; |
122 | static bool temp_playlist_init = false; | 122 | static bool temp_playlist_init = false; |
123 | 123 | ||
124 | static bool dirty = false; | ||
125 | |||
126 | static void playlist_buffer_init(struct playlist_buffer *pb, char *names_buffer, | 124 | static void playlist_buffer_init(struct playlist_buffer *pb, char *names_buffer, |
127 | int names_buffer_size); | 125 | int names_buffer_size); |
128 | static void playlist_buffer_load_entries(struct playlist_buffer * pb, int index, | 126 | static void playlist_buffer_load_entries(struct playlist_buffer * pb, int index, |
@@ -661,8 +659,14 @@ static enum pv_onplay_result onplay_menu(int index) | |||
661 | break; | 659 | break; |
662 | case 6: | 660 | case 6: |
663 | /* save playlist */ | 661 | /* save playlist */ |
664 | if (!save_playlist_screen(viewer.playlist)) | 662 | if (!save_playlist_screen(viewer.playlist) && viewer.playlist) |
665 | dirty = false; | 663 | /* |
664 | * Set unmodified unless it's the current playlist, which may | ||
665 | * contain queued songs that aren't saved to the playlist file | ||
666 | * TODO: This can be removed once g5192 is merged, | ||
667 | * "playlist: Rewrite playlist_save(), optimization & fixes" | ||
668 | */ | ||
669 | playlist_set_modified(viewer.playlist, false); | ||
666 | ret = PV_ONPLAY_UNCHANGED; | 670 | ret = PV_ONPLAY_UNCHANGED; |
667 | break; | 671 | break; |
668 | case 7: | 672 | case 7: |
@@ -802,8 +806,7 @@ static bool update_viewer_with_changes(struct gui_synclist *playlist_lists, enum | |||
802 | if (res == PV_ONPLAY_CHANGED || | 806 | if (res == PV_ONPLAY_CHANGED || |
803 | res == PV_ONPLAY_ITEM_REMOVED) | 807 | res == PV_ONPLAY_ITEM_REMOVED) |
804 | { | 808 | { |
805 | if (!viewer.playlist) | 809 | playlist_set_modified(viewer.playlist, true); |
806 | playlist_set_modified(NULL, true); | ||
807 | 810 | ||
808 | if (res == PV_ONPLAY_ITEM_REMOVED) | 811 | if (res == PV_ONPLAY_ITEM_REMOVED) |
809 | gui_synclist_del_item(playlist_lists); | 812 | gui_synclist_del_item(playlist_lists); |
@@ -815,8 +818,6 @@ static bool update_viewer_with_changes(struct gui_synclist *playlist_lists, enum | |||
815 | 818 | ||
816 | if (viewer.selected_track >= viewer.num_tracks) | 819 | if (viewer.selected_track >= viewer.num_tracks) |
817 | viewer.selected_track = viewer.num_tracks-1; | 820 | viewer.selected_track = viewer.num_tracks-1; |
818 | |||
819 | dirty = true; | ||
820 | } | 821 | } |
821 | 822 | ||
822 | /* the show_icons option in the playlist viewer settings | 823 | /* the show_icons option in the playlist viewer settings |
@@ -956,13 +957,11 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename, | |||
956 | str(LANG_FAILED)); | 957 | str(LANG_FAILED)); |
957 | } | 958 | } |
958 | 959 | ||
959 | if (!viewer.playlist) | 960 | playlist_set_modified(viewer.playlist, true); |
960 | playlist_set_modified(NULL, true); | ||
961 | 961 | ||
962 | update_playlist(true); | 962 | update_playlist(true); |
963 | viewer.moving_track = -1; | 963 | viewer.moving_track = -1; |
964 | viewer.moving_playlist_index = -1; | 964 | viewer.moving_playlist_index = -1; |
965 | dirty = true; | ||
966 | } | 965 | } |
967 | else if (!viewer.playlist) | 966 | else if (!viewer.playlist) |
968 | { | 967 | { |
@@ -1128,11 +1127,10 @@ static void close_playlist_viewer(void) | |||
1128 | if (viewer.initial_selection) | 1127 | if (viewer.initial_selection) |
1129 | *(viewer.initial_selection) = viewer.selected_track; | 1128 | *(viewer.initial_selection) = viewer.selected_track; |
1130 | 1129 | ||
1131 | if(dirty && yesno_pop(ID2P(LANG_SAVE_CHANGES))) | 1130 | if(playlist_modified(viewer.playlist) && yesno_pop(ID2P(LANG_SAVE_CHANGES))) |
1132 | save_playlist_screen(viewer.playlist); | 1131 | save_playlist_screen(viewer.playlist); |
1133 | playlist_close(viewer.playlist); | 1132 | playlist_close(viewer.playlist); |
1134 | } | 1133 | } |
1135 | dirty = false; | ||
1136 | } | 1134 | } |
1137 | 1135 | ||
1138 | static const char* playlist_search_callback_name(int selected_item, void * data, | 1136 | static const char* playlist_search_callback_name(int selected_item, void * data, |