From 89a4cf26933a1c82e4da8f4a382ed9b80f43956e Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 29 Jan 2011 01:01:12 +0000 Subject: [PATCH] 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/menu.c | 5 +---- apps/menus/exported_menus.h | 3 --- apps/root_menu.c | 35 ++++++++++++++++++++++++++--------- apps/root_menu.h | 2 ++ 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/apps/menu.c b/apps/menu.c index 5839a51c21..8ea2f0883e 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -327,7 +327,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, int selected = start_selected? *start_selected : 0; int action; struct gui_synclist lists; - const struct menu_item_ex *temp, *menu; + const struct menu_item_ex *temp, *menu = start_menu; int ret = 0, i; bool redraw_lists; int old_audio_status = audio_status(); @@ -347,9 +347,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, #endif menu_callback_type menu_callback = NULL; - if (start_menu == NULL) - menu = &main_menu_; - else menu = start_menu; /* if hide_theme is true, assume parent has been fixed before passed into * this function, e.g. with viewport_set_defaults(parent, screen) */ diff --git a/apps/menus/exported_menus.h b/apps/menus/exported_menus.h index 37b5ff31d0..3d253e7dd9 100644 --- a/apps/menus/exported_menus.h +++ b/apps/menus/exported_menus.h @@ -26,7 +26,6 @@ #ifndef PLUGIN extern const struct menu_item_ex - main_menu_, /* main_menu.c */ display_menu, /* display_menu.c */ playback_settings, /* playback_menu.c */ #ifdef HAVE_RECORDING @@ -38,12 +37,10 @@ extern const struct menu_item_ex sound_settings, /* sound_menu.c */ settings_menu_item, /* settings_menu.c */ playlist_settings, /* playlist_menu.c */ - playlist_options, /* playlist_menu.c */ equalizer_menu, /* eq_menu.c */ #ifdef AUDIOHW_HAVE_EQ audiohw_eq_tone_controls, /* audiohw_eq_menu.c */ #endif - info_menu, /* info_menu.c */ theme_menu; /* theme_menu.c */ struct browse_folder_info { 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 diff --git a/apps/root_menu.h b/apps/root_menu.h index 739ec8c4e9..3d18d18604 100644 --- a/apps/root_menu.h +++ b/apps/root_menu.h @@ -55,7 +55,9 @@ enum { will need editing if this is the case. */ GO_TO_BROWSEPLUGINS, GO_TO_TIMESCREEN, + GO_TO_PLAYLISTS_SCREEN, GO_TO_PLAYLIST_VIEWER, + GO_TO_SYSTEM_SCREEN, }; extern const struct menu_item_ex root_menu_;