From 89a4cf26933a1c82e4da8f4a382ed9b80f43956e Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 29 Jan 2011 01:01:12 +0000 Subject: Change the way how playlists and system menu items in the main menu are internally invoked so that the mechanism to pass the back button press to the android system (to let it go to the home screen) works for them. This fixes that the back button goes still to the home screen after entering these items. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29157 a1c6a512-1295-4272-9138-f99709370657 --- apps/root_menu.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'apps/root_menu.c') diff --git a/apps/root_menu.c b/apps/root_menu.c index 27242c9797..4dca1f3541 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -271,14 +271,8 @@ static int browser(void* param) #endif } return ret_val; -} - -static int menu(void* param) -{ - (void)param; - return do_menu(NULL, 0, NULL, false); - } + #ifdef HAVE_RECORDING static int recscrn(void* param) { @@ -323,6 +317,18 @@ static int radio(void* param) } #endif +static int miscscrn(void * param) +{ + const struct menu_item_ex *menu = (const struct menu_item_ex*)param; + switch (do_menu(menu, NULL, NULL, false)) + { + case GO_TO_PLAYLIST_VIEWER: + return GO_TO_PLAYLIST_VIEWER; + default: + return GO_TO_ROOT; + } +} + static int playlist_view(void * param) { (void)param; @@ -391,10 +397,13 @@ extern struct menu_item_ex #ifdef HAVE_TAGCACHE tagcache_menu, #endif + main_menu_, manage_settings, recording_settings_menu, radio_settings_menu, bookmark_settings_menu, + playlist_options, + info_menu, system_menu; static const struct root_items items[] = { [GO_TO_FILEBROWSER] = { browser, (void*)GO_TO_FILEBROWSER, &file_menu}, @@ -402,7 +411,8 @@ static const struct root_items items[] = { [GO_TO_DBBROWSER] = { browser, (void*)GO_TO_DBBROWSER, &tagcache_menu }, #endif [GO_TO_WPS] = { wpsscrn, NULL, &playback_settings }, - [GO_TO_MAINMENU] = { menu, NULL, &manage_settings }, + [GO_TO_MAINMENU] = { miscscrn, (struct menu_item_ex*)&main_menu_, + &manage_settings }, #ifdef HAVE_RECORDING [GO_TO_RECSCREEN] = { recscrn, NULL, &recording_settings_menu }, @@ -414,7 +424,9 @@ static const struct root_items items[] = { [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL }, + [GO_TO_PLAYLISTS_SCREEN] = { miscscrn, &playlist_options, NULL }, [GO_TO_PLAYLIST_VIEWER] = { playlist_view, NULL, NULL }, + [GO_TO_SYSTEM_SCREEN] = { miscscrn, &info_menu, &system_menu }, }; static const int nb_items = sizeof(items)/sizeof(*items); @@ -451,6 +463,11 @@ MENUITEM_RETURNVALUE(menu_, ID2P(LANG_SETTINGS), GO_TO_MAINMENU, MENUITEM_RETURNVALUE(bookmarks, ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), GO_TO_RECENTBMARKS, item_callback, Icon_Bookmark); +MENUITEM_RETURNVALUE(playlists, ID2P(LANG_PLAYLISTS), GO_TO_PLAYLISTS_SCREEN, + NULL, Icon_Playlist); +MENUITEM_RETURNVALUE(system_menu_, ID2P(LANG_SYSTEM), GO_TO_SYSTEM_SCREEN, + NULL, Icon_System_menu); + #ifdef HAVE_LCD_CHARCELLS static int do_shutdown(void) { @@ -478,7 +495,7 @@ MAKE_MENU(root_menu_, ID2P(LANG_ROCKBOX_TITLE), #if CONFIG_TUNER &fm, #endif - &playlist_options, &rocks_browser, &info_menu + &playlists, &rocks_browser, &system_menu_ #ifdef HAVE_LCD_CHARCELLS ,&do_shutdown_item -- cgit v1.2.3