diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-07-19 13:42:04 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-07-19 22:10:26 +0000 |
commit | c39f95465b9844f70f375f1690e0bf75c7ee7cc1 (patch) | |
tree | 2fda6bd805a74f41dd4303c7699eabb9e1aa4a1c /apps/menus/settings_menu.c | |
parent | 4663d94b4e4edec609b6a24581ee345f2a1bedaa (diff) | |
download | rockbox-c39f95465b9844f70f375f1690e0bf75c7ee7cc1.tar.gz rockbox-c39f95465b9844f70f375f1690e0bf75c7ee7cc1.zip |
do_menu pass internal synclist reference to callback
keep running into the rigid nature of do_menu
it isn't too bad when you don't need voice but once
you do the fun awaits
do_menu likes to talk on menu enter which is in a loop when you use do_menu
I would like to move the processing to the callback
TOO BAD you only get an action and the menu_item_ex struct
you sent it when calling the function
Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a
Diffstat (limited to 'apps/menus/settings_menu.c')
-rw-r--r-- | apps/menus/settings_menu.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 67595498ad..2a08ab0a4e 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -59,9 +59,11 @@ | |||
59 | 59 | ||
60 | #ifndef HAS_BUTTON_HOLD | 60 | #ifndef HAS_BUTTON_HOLD |
61 | static int selectivesoftlock_callback(int action, | 61 | static int selectivesoftlock_callback(int action, |
62 | const struct menu_item_ex *this_item) | 62 | const struct menu_item_ex *this_item, |
63 | struct gui_synclist *this_list) | ||
63 | { | 64 | { |
64 | (void)this_item; | 65 | (void)this_item; |
66 | (void)this_list; | ||
65 | 67 | ||
66 | switch (action) | 68 | switch (action) |
67 | { | 69 | { |
@@ -176,7 +178,10 @@ MAKE_MENU(tagcache_menu, ID2P(LANG_TAGCACHE), 0, Icon_NOICON, | |||
176 | 178 | ||
177 | /***********************************/ | 179 | /***********************************/ |
178 | /* FILE VIEW MENU */ | 180 | /* FILE VIEW MENU */ |
179 | static int fileview_callback(int action,const struct menu_item_ex *this_item); | 181 | static int fileview_callback(int action, |
182 | const struct menu_item_ex *this_item, | ||
183 | struct gui_synclist *this_list); | ||
184 | |||
180 | MENUITEM_SETTING(sort_case, &global_settings.sort_case, NULL); | 185 | MENUITEM_SETTING(sort_case, &global_settings.sort_case, NULL); |
181 | MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback); | 186 | MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback); |
182 | MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback); | 187 | MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback); |
@@ -196,8 +201,11 @@ static int clear_start_directory(void) | |||
196 | } | 201 | } |
197 | MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR), | 202 | MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR), |
198 | clear_start_directory, NULL, NULL, Icon_file_view_menu); | 203 | clear_start_directory, NULL, NULL, Icon_file_view_menu); |
199 | static int fileview_callback(int action,const struct menu_item_ex *this_item) | 204 | static int fileview_callback(int action, |
205 | const struct menu_item_ex *this_item, | ||
206 | struct gui_synclist *this_list) | ||
200 | { | 207 | { |
208 | (void)this_list; | ||
201 | static int oldval; | 209 | static int oldval; |
202 | int *variable = this_item->variable; | 210 | int *variable = this_item->variable; |
203 | switch (action) | 211 | switch (action) |
@@ -236,9 +244,12 @@ MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL); | |||
236 | MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL); | 244 | MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL); |
237 | #endif | 245 | #endif |
238 | #ifdef HAVE_USB_CHARGING_ENABLE | 246 | #ifdef HAVE_USB_CHARGING_ENABLE |
239 | static int usbcharging_callback(int action,const struct menu_item_ex *this_item) | 247 | static int usbcharging_callback(int action, |
248 | const struct menu_item_ex *this_item, | ||
249 | struct gui_synclist *this_list) | ||
240 | { | 250 | { |
241 | (void)this_item; | 251 | (void)this_item; |
252 | (void)this_list; | ||
242 | switch (action) | 253 | switch (action) |
243 | { | 254 | { |
244 | case ACTION_EXIT_MENUITEM: /* on exit */ | 255 | case ACTION_EXIT_MENUITEM: /* on exit */ |
@@ -265,9 +276,12 @@ MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, Icon_NOICON, | |||
265 | MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL); | 276 | MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL); |
266 | #endif | 277 | #endif |
267 | #ifdef HAVE_DIRCACHE | 278 | #ifdef HAVE_DIRCACHE |
268 | static int dircache_callback(int action,const struct menu_item_ex *this_item) | 279 | static int dircache_callback(int action, |
280 | const struct menu_item_ex *this_item, | ||
281 | struct gui_synclist *this_list) | ||
269 | { | 282 | { |
270 | (void)this_item; | 283 | (void)this_item; |
284 | (void)this_list; | ||
271 | switch (action) | 285 | switch (action) |
272 | { | 286 | { |
273 | case ACTION_EXIT_MENUITEM: /* on exit */ | 287 | case ACTION_EXIT_MENUITEM: /* on exit */ |
@@ -328,9 +342,12 @@ MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON, | |||
328 | 342 | ||
329 | #if CONFIG_CODEC == MAS3507D | 343 | #if CONFIG_CODEC == MAS3507D |
330 | void dac_line_in(bool enable); | 344 | void dac_line_in(bool enable); |
331 | static int linein_callback(int action,const struct menu_item_ex *this_item) | 345 | static int linein_callback(int action, |
346 | const struct menu_item_ex *this_item, | ||
347 | struct gui_synclist *this_list) | ||
332 | { | 348 | { |
333 | (void)this_item; | 349 | (void)this_item; |
350 | (void)this_list; | ||
334 | switch (action) | 351 | switch (action) |
335 | { | 352 | { |
336 | case ACTION_EXIT_MENUITEM: /* on exit */ | 353 | case ACTION_EXIT_MENUITEM: /* on exit */ |
@@ -545,9 +562,11 @@ static int toggle_sleeptimer(void) | |||
545 | /* Handle restarting a current sleep timer to the newly set default | 562 | /* Handle restarting a current sleep timer to the newly set default |
546 | duration */ | 563 | duration */ |
547 | static int sleeptimer_duration_cb(int action, | 564 | static int sleeptimer_duration_cb(int action, |
548 | const struct menu_item_ex *this_item) | 565 | const struct menu_item_ex *this_item, |
566 | struct gui_synclist *this_list) | ||
549 | { | 567 | { |
550 | (void)this_item; | 568 | (void)this_item; |
569 | (void)this_list; | ||
551 | static int initial_duration; | 570 | static int initial_duration; |
552 | switch (action) | 571 | switch (action) |
553 | { | 572 | { |
@@ -590,9 +609,12 @@ MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), | |||
590 | 609 | ||
591 | /***********************************/ | 610 | /***********************************/ |
592 | /* BOOKMARK MENU */ | 611 | /* BOOKMARK MENU */ |
593 | static int bmark_callback(int action,const struct menu_item_ex *this_item) | 612 | static int bmark_callback(int action, |
613 | const struct menu_item_ex *this_item, | ||
614 | struct gui_synclist *this_list) | ||
594 | { | 615 | { |
595 | (void)this_item; | 616 | (void)this_item; |
617 | (void)this_list; | ||
596 | switch (action) | 618 | switch (action) |
597 | { | 619 | { |
598 | case ACTION_EXIT_MENUITEM: /* on exit */ | 620 | case ACTION_EXIT_MENUITEM: /* on exit */ |
@@ -623,9 +645,12 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0, | |||
623 | #ifdef HAVE_TAGCACHE | 645 | #ifdef HAVE_TAGCACHE |
624 | #if CONFIG_CODEC == SWCODEC | 646 | #if CONFIG_CODEC == SWCODEC |
625 | 647 | ||
626 | static int autoresume_callback(int action, const struct menu_item_ex *this_item) | 648 | static int autoresume_callback(int action, |
649 | const struct menu_item_ex *this_item, | ||
650 | struct gui_synclist *this_list) | ||
627 | { | 651 | { |
628 | (void)this_item; | 652 | (void)this_item; |
653 | (void)this_list; | ||
629 | 654 | ||
630 | if (action == ACTION_EXIT_MENUITEM /* on exit */ | 655 | if (action == ACTION_EXIT_MENUITEM /* on exit */ |
631 | && global_settings.autoresume_enable | 656 | && global_settings.autoresume_enable |
@@ -642,9 +667,11 @@ static int autoresume_callback(int action, const struct menu_item_ex *this_item) | |||
642 | } | 667 | } |
643 | 668 | ||
644 | static int autoresume_nexttrack_callback(int action, | 669 | static int autoresume_nexttrack_callback(int action, |
645 | const struct menu_item_ex *this_item) | 670 | const struct menu_item_ex *this_item, |
671 | struct gui_synclist *this_list) | ||
646 | { | 672 | { |
647 | (void)this_item; | 673 | (void)this_item; |
674 | (void)this_list; | ||
648 | static int oldval = 0; | 675 | static int oldval = 0; |
649 | switch (action) | 676 | switch (action) |
650 | { | 677 | { |
@@ -678,14 +705,20 @@ MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME), | |||
678 | 705 | ||
679 | /***********************************/ | 706 | /***********************************/ |
680 | /* VOICE MENU */ | 707 | /* VOICE MENU */ |
681 | static int talk_callback(int action,const struct menu_item_ex *this_item); | 708 | static int talk_callback(int action, |
709 | const struct menu_item_ex *this_item, | ||
710 | struct gui_synclist *this_list); | ||
711 | |||
682 | MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); | 712 | MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); |
683 | MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL); | 713 | MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL); |
684 | MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback); | 714 | MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback); |
685 | MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL); | 715 | MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL); |
686 | MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback); | 716 | MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback); |
687 | static int talk_callback(int action,const struct menu_item_ex *this_item) | 717 | static int talk_callback(int action, |
718 | const struct menu_item_ex *this_item, | ||
719 | struct gui_synclist *this_list) | ||
688 | { | 720 | { |
721 | (void)this_list; | ||
689 | static int oldval = 0; | 722 | static int oldval = 0; |
690 | switch (action) | 723 | switch (action) |
691 | { | 724 | { |