summaryrefslogtreecommitdiff
path: root/apps/playlist_viewer.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2023-03-29 10:58:30 +0100
committerAidan MacDonald <amachronic@protonmail.com>2023-10-01 11:05:29 -0400
commit7ccbd705f43553ff358d6713c8d6ac7cc9e3c343 (patch)
treecbd8b34688194715632f03e9248bb3a2e8a3dda7 /apps/playlist_viewer.c
parent781f955aa2fb813dd87986cbcc22c1676a2dd9a9 (diff)
downloadrockbox-7ccbd705f43553ff358d6713c8d6ac7cc9e3c343.tar.gz
rockbox-7ccbd705f43553ff358d6713c8d6ac7cc9e3c343.zip
playlist: Rework playlist modified detection and dirplay
The modified state is now an explicit flag that has to be set whenever a user-triggered modification occurs. This is recorded in the control file to ensure it doesn't get lost after resume. There may be some places I missed where the modified flag should be set/cleared, but it seems to work well enough right now. Change-Id: I3bdba358fc495b4ca84e389ac6e7bcbef820c219
Diffstat (limited to 'apps/playlist_viewer.c')
-rw-r--r--apps/playlist_viewer.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 3d530e791a..d12aa26de4 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -802,15 +802,23 @@ static bool update_viewer_with_changes(struct gui_synclist *playlist_lists, enum
802 if (res == PV_ONPLAY_CHANGED || 802 if (res == PV_ONPLAY_CHANGED ||
803 res == PV_ONPLAY_ITEM_REMOVED) 803 res == PV_ONPLAY_ITEM_REMOVED)
804 { 804 {
805 if (!viewer.playlist)
806 playlist_set_modified(NULL, true);
807
805 if (res == PV_ONPLAY_ITEM_REMOVED) 808 if (res == PV_ONPLAY_ITEM_REMOVED)
806 gui_synclist_del_item(playlist_lists); 809 gui_synclist_del_item(playlist_lists);
810
807 update_playlist(true); 811 update_playlist(true);
812
808 if (viewer.num_tracks <= 0) 813 if (viewer.num_tracks <= 0)
809 exit = true; 814 exit = true;
815
810 if (viewer.selected_track >= viewer.num_tracks) 816 if (viewer.selected_track >= viewer.num_tracks)
811 viewer.selected_track = viewer.num_tracks-1; 817 viewer.selected_track = viewer.num_tracks-1;
818
812 dirty = true; 819 dirty = true;
813 } 820 }
821
814 /* the show_icons option in the playlist viewer settings 822 /* the show_icons option in the playlist viewer settings
815 * menu might have changed */ 823 * menu might have changed */
816 update_lists(playlist_lists); 824 update_lists(playlist_lists);
@@ -947,6 +955,10 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename,
947 splashf(HZ, (unsigned char *)"%s %s", str(LANG_MOVE), 955 splashf(HZ, (unsigned char *)"%s %s", str(LANG_MOVE),
948 str(LANG_FAILED)); 956 str(LANG_FAILED));
949 } 957 }
958
959 if (!viewer.playlist)
960 playlist_set_modified(NULL, true);
961
950 update_playlist(true); 962 update_playlist(true);
951 viewer.moving_track = -1; 963 viewer.moving_track = -1;
952 viewer.moving_playlist_index = -1; 964 viewer.moving_playlist_index = -1;
@@ -976,7 +988,6 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename,
976 if (global_settings.playlist_shuffle) 988 if (global_settings.playlist_shuffle)
977 start_index = playlist_shuffle(current_tick, start_index); 989 start_index = playlist_shuffle(current_tick, start_index);
978 playlist_start(start_index, 0, 0); 990 playlist_start(start_index, 0, 0);
979 playlist_set_modified(NULL, false);
980 991
981 if (viewer.initial_selection) 992 if (viewer.initial_selection)
982 *(viewer.initial_selection) = viewer.selected_track; 993 *(viewer.initial_selection) = viewer.selected_track;