From a74eefe1b21e3a20bd15ccb7663dcb63ac475b39 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 6 Mar 2007 13:35:15 +0000 Subject: [PATCH] Pressing Menu in the Rockbox Menu puts you back in the previous screen. Hopefully simplify the code a bit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12643 a1c6a512-1295-4272-9138-f99709370657 --- apps/menu.c | 2 ++ apps/root_menu.c | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/apps/menu.c b/apps/menu.c index 03fb1ac54c..c074ec379d 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -675,6 +675,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected) { if (menu != &root_menu_) ret = GO_TO_ROOT; + else + ret = GO_TO_PREVIOUS; } else if (action == ACTION_STD_CANCEL) { diff --git a/apps/root_menu.c b/apps/root_menu.c index f30e10c249..b797d473a5 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -342,40 +342,39 @@ void root_menu(void) check_boot(); continue; } - - if (ret_val == GO_TO_PREVIOUS_MUSIC) - ret_val = previous_music; + else if (ret_val <= GO_TO_ROOT) + continue; last_screen = GO_TO_ROOT; break; + case GO_TO_PREVIOUS: ret_val = last_screen; - if (last_screen == GO_TO_ROOT) - continue; + continue; break; + case GO_TO_PREVIOUS_BROWSER: if ((previous_browser == GO_TO_DBBROWSER) && !tagcache_is_usable()) ret_val = GO_TO_FILEBROWSER; else ret_val = previous_browser; + /* fall through */ + case GO_TO_FILEBROWSER: + case GO_TO_DBBROWSER: + previous_browser = ret_val; break; + case GO_TO_PREVIOUS_MUSIC: ret_val = previous_music; + /* fall through */ + case GO_TO_WPS: +#if CONFIG_TUNER + case GO_TO_FM: +#endif + previous_music = ret_val; break; } this_screen = ret_val; - - if (this_screen == GO_TO_FILEBROWSER) - previous_browser = GO_TO_FILEBROWSER; - else if (this_screen == GO_TO_DBBROWSER) - previous_browser = GO_TO_DBBROWSER; - else if (this_screen == GO_TO_WPS) - previous_music = GO_TO_WPS; -#if CONFIG_TUNER - else if (this_screen == GO_TO_FM) - previous_music = GO_TO_FM; -#endif - /* set the global_status.last_screen before entering, if we dont we will always return to the wrong screen on boot */ global_status.last_screen = (char)this_screen;