summaryrefslogtreecommitdiff
path: root/apps/gui/option_select.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2023-08-27 10:54:44 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2023-08-29 01:29:38 -0400
commit1c80f5358110edd5777aeed15080249050ec2378 (patch)
treed5cd4dd9cddf488b3388472a3eb3d3f1c7eb72f9 /apps/gui/option_select.c
parent3883c978abdcb443ac6ca2b4a57d941c418e8b74 (diff)
downloadrockbox-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/gui/option_select.c')
-rw-r--r--apps/gui/option_select.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index 8839f42e42..d7f27f64eb 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -470,7 +470,10 @@ bool option_screen(const struct settings_list *setting,
470 int *variable; 470 int *variable;
471 bool allow_wrap = setting->flags & F_NO_WRAP ? false : true; 471 bool allow_wrap = setting->flags & F_NO_WRAP ? false : true;
472 bool cb_on_select_only = 472 bool cb_on_select_only =
473 ((setting->flags & F_CB_ON_SELECT_ONLY) == F_CB_ON_SELECT_ONLY); 473 ((setting->flags & F_CB_ON_SELECT_ONLY) == F_CB_ON_SELECT_ONLY);
474 bool cb_on_changed =
475 ((setting->flags & F_CB_ON_SELECT_ONLY_IF_CHANGED) == F_CB_ON_SELECT_ONLY_IF_CHANGED);
476
474 int var_type = setting->flags&F_T_MASK; 477 int var_type = setting->flags&F_T_MASK;
475 void (*function)(int) = NULL; 478 void (*function)(int) = NULL;
476 char *title; 479 char *title;
@@ -561,8 +564,12 @@ bool option_screen(const struct settings_list *setting,
561 } 564 }
562 settings_save(); 565 settings_save();
563 done = true; 566 done = true;
567
564 if (cb_on_select_only && function) 568 if (cb_on_select_only && function)
565 function(*variable); 569 {
570 if (!cb_on_changed || (*variable != oldvalue))
571 function(*variable);
572 }
566 } 573 }
567 else if(default_event_handler(action) == SYS_USB_CONNECTED) 574 else if(default_event_handler(action) == SYS_USB_CONNECTED)
568 { 575 {