diff options
author | JJ Style <style.jj@protonmail.com> | 2023-08-24 23:25:27 +0100 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2023-08-27 00:39:52 -0400 |
commit | 8a22660770d3c0c713247ab8f2b7c08777affd9f (patch) | |
tree | 57cdd32f5ef81e299457c725b2d766f91b53dd8a | |
parent | 03d326fc90afa4fded017776996b84d6a4686162 (diff) | |
download | rockbox-8a22660770.tar.gz rockbox-8a22660770.zip |
Fix #13369: shuffle setting not working from shortcut.
Setting in shortcut was not being handled as it had no callback.
In the settings menu it looks like the event is handled separately.
Added a shuffle callback to the setting so it is called when changed
from the shortcut.
Edit: move callback to within settings_list so playlist interface is
unchanged.
Change-Id: I3691acac1c73a80bf67c0b8b334009ef1655fdb0
-rw-r--r-- | apps/settings_list.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/settings_list.c b/apps/settings_list.c index 96cc933ac3..134b93cf48 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -63,6 +63,7 @@ #include "onplay.h" #include "misc.h" /* current activity */ #endif +#include "playlist.h" #include "voice_thread.h" @@ -618,6 +619,19 @@ static void eq_set_default(void* setting, void* defaultval) memcpy(setting, defaultval, sizeof(struct eq_band_setting)); } +/* perform shuffle/unshuffle of the current playlist based on the boolean provided */ +static void shuffle_playlist_callback(bool shuffle) +{ + if (shuffle) + { + playlist_randomise(NULL, current_tick, true); + } + else + { + playlist_sort(NULL, true); + } +} + #ifdef HAVE_QUICKSCREEN static void qs_load_from_cfg(void *var, char *value) { @@ -898,7 +912,7 @@ const struct settings_list settings[] = { #endif /* playback */ - OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), + OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", shuffle_playlist_callback), SYSTEM_SETTING(NVRAM(4), resume_index, -1), SYSTEM_SETTING(NVRAM(4), resume_crc32, -1), SYSTEM_SETTING(NVRAM(4), resume_elapsed, -1), |