summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/menu.c17
-rw-r--r--apps/root_menu.c15
2 files changed, 20 insertions, 12 deletions
diff --git a/apps/menu.c b/apps/menu.c
index c074ec379d..62cce5a721 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -607,7 +607,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
607 const struct menu_item_ex *menu_stack[MAX_MENUS]; 607 const struct menu_item_ex *menu_stack[MAX_MENUS];
608 int menu_stack_selected_item[MAX_MENUS]; 608 int menu_stack_selected_item[MAX_MENUS];
609 int stack_top = 0; 609 int stack_top = 0;
610 bool in_stringlist; 610 bool in_stringlist, done = false;
611 menu_callback_type menu_callback = NULL; 611 menu_callback_type menu_callback = NULL;
612 if (start_menu == NULL) 612 if (start_menu == NULL)
613 menu = &main_menu_; 613 menu = &main_menu_;
@@ -630,7 +630,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
630 /* load the callback, and only reload it if menu changes */ 630 /* load the callback, and only reload it if menu changes */
631 get_menu_callback(menu, &menu_callback); 631 get_menu_callback(menu, &menu_callback);
632 632
633 while (ret == 0) 633 while (!done)
634 { 634 {
635 action = get_action(CONTEXT_MAINMENU,HZ); 635 action = get_action(CONTEXT_MAINMENU,HZ);
636 /* HZ so the status bar redraws corectly */ 636 /* HZ so the status bar redraws corectly */
@@ -660,6 +660,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
660 else if (action == ACTION_MENU_WPS) 660 else if (action == ACTION_MENU_WPS)
661 { 661 {
662 ret = GO_TO_PREVIOUS_MUSIC; 662 ret = GO_TO_PREVIOUS_MUSIC;
663 done = true;
663 } 664 }
664 else if (action == ACTION_MENU_STOP) 665 else if (action == ACTION_MENU_STOP)
665 { 666 {
@@ -677,6 +678,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
677 ret = GO_TO_ROOT; 678 ret = GO_TO_ROOT;
678 else 679 else
679 ret = GO_TO_PREVIOUS; 680 ret = GO_TO_PREVIOUS;
681 done = true;
680 } 682 }
681 else if (action == ACTION_STD_CANCEL) 683 else if (action == ACTION_STD_CANCEL)
682 { 684 {
@@ -697,7 +699,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
697 else if (menu != &root_menu_) 699 else if (menu != &root_menu_)
698 { 700 {
699 ret = GO_TO_PREVIOUS; 701 ret = GO_TO_PREVIOUS;
700 break; 702 done = true;
701 } 703 }
702 } 704 }
703 else if (action == ACTION_STD_OK) 705 else if (action == ACTION_STD_OK)
@@ -766,9 +768,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
766 } 768 }
767 break; 769 break;
768 case MT_RETURN_VALUE: 770 case MT_RETURN_VALUE:
769 if (start_selected) 771 ret = temp->value;
770 *start_selected = selected; 772 done = true;
771 return temp->value; 773 break;
772 } 774 }
773 if (type != MT_MENU && menu_callback) 775 if (type != MT_MENU && menu_callback)
774 menu_callback(ACTION_EXIT_MENUITEM,temp); 776 menu_callback(ACTION_EXIT_MENUITEM,temp);
@@ -786,7 +788,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
786 } 788 }
787 action_signalscreenchange(); 789 action_signalscreenchange();
788 if (start_selected) 790 if (start_selected)
789 *start_selected = selected; 791 *start_selected = get_menu_selection(
792 gui_synclist_get_sel_pos(&lists), menu);
790 return ret; 793 return ret;
791} 794}
792 795
diff --git a/apps/root_menu.c b/apps/root_menu.c
index abee02dbf7..c234614bc6 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -359,16 +359,21 @@ void root_menu(void)
359 switch (ret_val) 359 switch (ret_val)
360 { 360 {
361 case GO_TO_ROOT: 361 case GO_TO_ROOT:
362 selected = get_selection(last_screen); 362 if (last_screen != GO_TO_ROOT)
363 selected = get_selection(last_screen);
363 ret_val = do_menu(&root_menu_, &selected); 364 ret_val = do_menu(&root_menu_, &selected);
364 /* As long as MENU_ATTACHED_USB == GO_TO_ROOT this works */ 365 /* As long as MENU_ATTACHED_USB == GO_TO_ROOT this works */
365 if (ret_val == MENU_ATTACHED_USB) 366 if (ret_val <= GO_TO_ROOT)
366 { 367 {
367 check_boot(); 368 if (ret_val == MENU_ATTACHED_USB)
369 check_boot();
370 else if (ret_val == GO_TO_PREVIOUS)
371 {
372 ret_val = last_screen;
373 last_screen = GO_TO_ROOT;
374 }
368 continue; 375 continue;
369 } 376 }
370 else if (ret_val <= GO_TO_ROOT)
371 continue;
372 last_screen = GO_TO_ROOT; 377 last_screen = GO_TO_ROOT;
373 break; 378 break;
374 379