diff options
author | William Wilgus <wilgus.william@gmail.com> | 2023-08-27 10:54:44 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2023-08-29 01:29:38 -0400 |
commit | 1c80f5358110edd5777aeed15080249050ec2378 (patch) | |
tree | d5cd4dd9cddf488b3388472a3eb3d3f1c7eb72f9 /apps/menus | |
parent | 3883c978abdcb443ac6ca2b4a57d941c418e8b74 (diff) | |
download | rockbox-1c80f5358110edd5777aeed15080249050ec2378.tar.gz rockbox-1c80f5358110edd5777aeed15080249050ec2378.zip |
[Bugfix] shuffle shenanigans from g5288 Fix #13369 shuffle & repeat callbacks
shuffle and sort were called on startup before playlist_init
and also on setting switch even without select
repeat is also now handled in settings_list as well
after moving the callbacks to settings_list.c
there was then a problem of unintended callbacks on exit of the menus
fixed that with F_CB_ON_SELECT_ONLY
since the callback was called regardless of the setting being changed
on F_CB_ON_SELECT_ONLY which is preferable in some circumstances
I co-opted F_TEMPVAR to allow the callback only when the setting was changed
with the flag F_CB_ON_SELECT_ONLY_IF_CHANGED
Change-Id: I5265233bbb556dc06c45273e742be5d78510a806
Diffstat (limited to 'apps/menus')
-rw-r--r-- | apps/menus/playback_menu.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index e4945be0b5..a0732d3feb 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c | |||
@@ -244,19 +244,9 @@ static int playback_callback(int action, | |||
244 | struct gui_synclist *this_list) | 244 | struct gui_synclist *this_list) |
245 | { | 245 | { |
246 | (void)this_list; | 246 | (void)this_list; |
247 | static bool old_shuffle = false; | ||
248 | static int old_repeat = 0; | ||
249 | switch (action) | 247 | switch (action) |
250 | { | 248 | { |
251 | case ACTION_ENTER_MENUITEM: | 249 | case ACTION_ENTER_MENUITEM: |
252 | if (this_item == &shuffle_item) | ||
253 | { | ||
254 | old_shuffle = global_settings.playlist_shuffle; | ||
255 | } | ||
256 | else if (this_item == &repeat_mode) | ||
257 | { | ||
258 | old_repeat = global_settings.repeat_mode; | ||
259 | } | ||
260 | break; | 250 | break; |
261 | 251 | ||
262 | case ACTION_EXIT_MENUITEM: /* on exit */ | 252 | case ACTION_EXIT_MENUITEM: /* on exit */ |
@@ -268,35 +258,6 @@ static int playback_callback(int action, | |||
268 | break; | 258 | break; |
269 | } | 259 | } |
270 | #endif /* HAVE_PLAY_FREQ */ | 260 | #endif /* HAVE_PLAY_FREQ */ |
271 | |||
272 | if (!(audio_status() & AUDIO_STATUS_PLAY)) | ||
273 | break; | ||
274 | |||
275 | /* Playing only */ | ||
276 | if (this_item == &shuffle_item) | ||
277 | { | ||
278 | if (old_shuffle == global_settings.playlist_shuffle) | ||
279 | break; | ||
280 | |||
281 | replaygain_update(); | ||
282 | |||
283 | if (global_settings.playlist_shuffle) | ||
284 | { | ||
285 | playlist_randomise(NULL, current_tick, true); | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | playlist_sort(NULL, true); | ||
290 | } | ||
291 | } | ||
292 | else if (this_item == &repeat_mode) | ||
293 | { | ||
294 | if (old_repeat == global_settings.repeat_mode) | ||
295 | break; | ||
296 | |||
297 | audio_flush_and_reload_tracks(); | ||
298 | } | ||
299 | |||
300 | break; | 261 | break; |
301 | } | 262 | } |
302 | return action; | 263 | return action; |