summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-11-19 01:12:36 +0100
committerChristian Soffke <christian.soffke@gmail.com>2023-11-19 01:13:49 +0100
commita7d0ff200066ff4d102ffff9e24d3c2b8ef7fde5 (patch)
treee59eb45e671daa85505e878cfd7b73db86aa9071
parent35f9a5b41501502d6bb21cad64be515a73bc360c (diff)
downloadrockbox-a7d0ff200066ff4d102ffff9e24d3c2b8ef7fde5.tar.gz
rockbox-a7d0ff200066ff4d102ffff9e24d3c2b8ef7fde5.zip
Playlist Viewer: Reload indices after saving currently playing playlist
First index may have changed Change-Id: If6c2fbb42014610aeae48918168c32ca82fb9b5b
-rw-r--r--apps/playlist_viewer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index d0fc9a8370..1d8b1b1b03 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -81,6 +81,7 @@ enum pv_onplay_result {
81 PV_ONPLAY_ITEM_REMOVED, 81 PV_ONPLAY_ITEM_REMOVED,
82 PV_ONPLAY_CHANGED, 82 PV_ONPLAY_CHANGED,
83 PV_ONPLAY_UNCHANGED, 83 PV_ONPLAY_UNCHANGED,
84 PV_ONPLAY_SAVED,
84}; 85};
85 86
86struct playlist_buffer 87struct playlist_buffer
@@ -661,7 +662,8 @@ static enum pv_onplay_result onplay_menu(int index)
661 break; 662 break;
662 case 6: 663 case 6:
663 save_playlist_screen(viewer.playlist); 664 save_playlist_screen(viewer.playlist);
664 ret = PV_ONPLAY_UNCHANGED; 665 /* playlist indices of current playlist may have changed */
666 ret = viewer.playlist ? PV_ONPLAY_UNCHANGED : PV_ONPLAY_SAVED;
665 break; 667 break;
666 case 7: 668 case 7:
667 /* playlist viewer settings */ 669 /* playlist viewer settings */
@@ -784,11 +786,9 @@ static int playlist_callback_voice(int selected_item, void *data)
784static void update_lists(struct gui_synclist * playlist_lists, bool init) 786static void update_lists(struct gui_synclist * playlist_lists, bool init)
785{ 787{
786 if (init) 788 if (init)
787 {
788 gui_synclist_init(playlist_lists, playlist_callback_name, 789 gui_synclist_init(playlist_lists, playlist_callback_name,
789 &viewer, false, 1, NULL); 790 &viewer, false, 1, NULL);
790 gui_synclist_set_nb_items(playlist_lists, viewer.num_tracks); 791 gui_synclist_set_nb_items(playlist_lists, viewer.num_tracks);
791 }
792 gui_synclist_set_voice_callback(playlist_lists, 792 gui_synclist_set_voice_callback(playlist_lists,
793 global_settings.talk_file? 793 global_settings.talk_file?
794 &playlist_callback_voice:NULL); 794 &playlist_callback_voice:NULL);
@@ -805,9 +805,11 @@ static bool update_viewer_with_changes(struct gui_synclist *playlist_lists, enum
805{ 805{
806 bool exit = false; 806 bool exit = false;
807 if (res == PV_ONPLAY_CHANGED || 807 if (res == PV_ONPLAY_CHANGED ||
808 res == PV_ONPLAY_SAVED ||
808 res == PV_ONPLAY_ITEM_REMOVED) 809 res == PV_ONPLAY_ITEM_REMOVED)
809 { 810 {
810 playlist_set_modified(viewer.playlist, true); 811 if (res != PV_ONPLAY_SAVED)
812 playlist_set_modified(viewer.playlist, true);
811 813
812 if (res == PV_ONPLAY_ITEM_REMOVED) 814 if (res == PV_ONPLAY_ITEM_REMOVED)
813 gui_synclist_del_item(playlist_lists); 815 gui_synclist_del_item(playlist_lists);