diff options
Diffstat (limited to 'apps/playlist_viewer.c')
-rw-r--r-- | apps/playlist_viewer.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index d9f5d1c203..d0fc9a8370 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -654,7 +654,9 @@ static enum pv_onplay_result onplay_menu(int index) | |||
654 | break; | 654 | break; |
655 | case 5: | 655 | case 5: |
656 | /* shuffle */ | 656 | /* shuffle */ |
657 | playlist_randomise(viewer.playlist, current_tick, false); | 657 | playlist_sort(viewer.playlist, !viewer.playlist); |
658 | playlist_randomise(viewer.playlist, current_tick, !viewer.playlist); | ||
659 | viewer.selected_track = 0; | ||
658 | ret = PV_ONPLAY_CHANGED; | 660 | ret = PV_ONPLAY_CHANGED; |
659 | break; | 661 | break; |
660 | case 6: | 662 | case 6: |
@@ -779,8 +781,14 @@ static int playlist_callback_voice(int selected_item, void *data) | |||
779 | return 0; | 781 | return 0; |
780 | } | 782 | } |
781 | 783 | ||
782 | static void update_lists(struct gui_synclist * playlist_lists) | 784 | static void update_lists(struct gui_synclist * playlist_lists, bool init) |
783 | { | 785 | { |
786 | if (init) | ||
787 | { | ||
788 | gui_synclist_init(playlist_lists, playlist_callback_name, | ||
789 | &viewer, false, 1, NULL); | ||
790 | gui_synclist_set_nb_items(playlist_lists, viewer.num_tracks); | ||
791 | } | ||
784 | gui_synclist_set_voice_callback(playlist_lists, | 792 | gui_synclist_set_voice_callback(playlist_lists, |
785 | global_settings.talk_file? | 793 | global_settings.talk_file? |
786 | &playlist_callback_voice:NULL); | 794 | &playlist_callback_voice:NULL); |
@@ -788,6 +796,7 @@ static void update_lists(struct gui_synclist * playlist_lists) | |||
788 | global_settings.playlist_viewer_icons? | 796 | global_settings.playlist_viewer_icons? |
789 | &playlist_callback_icons:NULL); | 797 | &playlist_callback_icons:NULL); |
790 | gui_synclist_set_title(playlist_lists, viewer.title, Icon_Playlist); | 798 | gui_synclist_set_title(playlist_lists, viewer.title, Icon_Playlist); |
799 | gui_synclist_select_item(playlist_lists, viewer.selected_track); | ||
791 | gui_synclist_draw(playlist_lists); | 800 | gui_synclist_draw(playlist_lists); |
792 | gui_synclist_speak_item(playlist_lists); | 801 | gui_synclist_speak_item(playlist_lists); |
793 | } | 802 | } |
@@ -814,27 +823,10 @@ static bool update_viewer_with_changes(struct gui_synclist *playlist_lists, enum | |||
814 | 823 | ||
815 | /* the show_icons option in the playlist viewer settings | 824 | /* the show_icons option in the playlist viewer settings |
816 | * menu might have changed */ | 825 | * menu might have changed */ |
817 | update_lists(playlist_lists); | 826 | update_lists(playlist_lists, false); |
818 | return exit; | 827 | return exit; |
819 | } | 828 | } |
820 | 829 | ||
821 | static void prepare_lists(struct gui_synclist * playlist_lists) | ||
822 | { | ||
823 | gui_synclist_init(playlist_lists, playlist_callback_name, | ||
824 | &viewer, false, 1, NULL); | ||
825 | gui_synclist_set_voice_callback(playlist_lists, | ||
826 | global_settings.talk_file ? | ||
827 | &playlist_callback_voice : NULL); | ||
828 | gui_synclist_set_icon_callback(playlist_lists, | ||
829 | global_settings.playlist_viewer_icons ? | ||
830 | &playlist_callback_icons : NULL); | ||
831 | gui_synclist_set_nb_items(playlist_lists, viewer.num_tracks); | ||
832 | gui_synclist_set_title(playlist_lists, viewer.title, Icon_Playlist); | ||
833 | gui_synclist_select_item(playlist_lists, viewer.selected_track); | ||
834 | gui_synclist_draw(playlist_lists); | ||
835 | gui_synclist_speak_item(playlist_lists); | ||
836 | } | ||
837 | |||
838 | static bool open_playlist_viewer(const char* filename, | 830 | static bool open_playlist_viewer(const char* filename, |
839 | struct gui_synclist *playlist_lists, | 831 | struct gui_synclist *playlist_lists, |
840 | bool reload, int *most_recent_selection) | 832 | bool reload, int *most_recent_selection) |
@@ -844,7 +836,7 @@ static bool open_playlist_viewer(const char* filename, | |||
844 | if (!playlist_viewer_init(&viewer, filename, reload, most_recent_selection)) | 836 | if (!playlist_viewer_init(&viewer, filename, reload, most_recent_selection)) |
845 | return false; | 837 | return false; |
846 | 838 | ||
847 | prepare_lists(playlist_lists); | 839 | update_lists(playlist_lists, true); |
848 | 840 | ||
849 | return true; | 841 | return true; |
850 | } | 842 | } |
@@ -1038,7 +1030,7 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename, | |||
1038 | skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); | 1030 | skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL); |
1039 | } | 1031 | } |
1040 | update_playlist(true); | 1032 | update_playlist(true); |
1041 | prepare_lists(&playlist_lists); | 1033 | update_lists(&playlist_lists, true); |
1042 | } | 1034 | } |
1043 | break; | 1035 | break; |
1044 | #endif | 1036 | #endif |
@@ -1077,7 +1069,7 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename, | |||
1077 | ret = PLAYLIST_VIEWER_USB; | 1069 | ret = PLAYLIST_VIEWER_USB; |
1078 | goto exit; | 1070 | goto exit; |
1079 | } | 1071 | } |
1080 | update_lists(&playlist_lists); | 1072 | update_lists(&playlist_lists, false); |
1081 | } | 1073 | } |
1082 | else if (global_settings.hotkey_tree == HOTKEY_DELETE) | 1074 | else if (global_settings.hotkey_tree == HOTKEY_DELETE) |
1083 | { | 1075 | { |