summaryrefslogtreecommitdiffstats
path: root/apps/root_menu.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-06-01 14:41:49 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-06-01 14:41:49 +0000
commitb58d3656d79e5f9752a22d55c139294412084e4f (patch)
treebd98c9d2ab0db1e0df432814bb398cdb49739fe1 /apps/root_menu.c
parentc54f4b34400ea96bd3e2d86ba919a0ae509a56a9 (diff)
downloadrockbox-b58d3656d79e5f9752a22d55c139294412084e4f.tar.gz
rockbox-b58d3656d79e5f9752a22d55c139294412084e4f.tar.bz2
rockbox-b58d3656d79e5f9752a22d55c139294412084e4f.zip
FS#11925 - Add a proper system to keep track of the current screen/activity to make %cs far more useful
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29944 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r--apps/root_menu.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 76c081f775..bee1502781 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -151,6 +151,7 @@ static int browser(void* param)
#endif
strcpy(folder, last_folder);
}
+ push_current_activity(ACTIVITY_FILEBROWSER);
break;
#ifdef HAVE_TAGCACHE
case GO_TO_DBBROWSER:
@@ -246,12 +247,14 @@ static int browser(void* param)
filter = SHOW_ID3DB;
tc->dirlevel = last_db_dirlevel;
tc->selected_item = last_db_selection;
+ push_current_activity(ACTIVITY_DATABASEBROWSER);
break;
#endif
}
browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL);
ret_val = rockbox_browse(&browse);
+ pop_current_activity();
switch ((intptr_t)param)
{
case GO_TO_FILEBROWSER:
@@ -285,6 +288,7 @@ static int wpsscrn(void* param)
{
int ret_val = GO_TO_PREVIOUS;
(void)param;
+ push_current_activity(ACTIVITY_WPS);
if (audio_status())
{
talk_shutup();
@@ -306,6 +310,7 @@ static int wpsscrn(void* param)
{
splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
}
+ pop_current_activity();
return ret_val;
}
#if CONFIG_TUNER
@@ -511,13 +516,27 @@ static inline int load_screen(int screen)
if we dont we will always return to the wrong screen on boot */
int old_previous = last_screen;
int ret_val;
+ enum current_activity activity = ACTIVITY_UNKNOWN;
if (screen <= GO_TO_ROOT)
return screen;
if (screen == old_previous)
old_previous = GO_TO_ROOT;
global_status.last_screen = (char)screen;
status_save();
+
+ if (screen == GO_TO_BROWSEPLUGINS)
+ activity = ACTIVITY_PLUGINBROWSER;
+ else if (screen == GO_TO_MAINMENU)
+ activity = ACTIVITY_SETTINGS;
+
+ if (activity != ACTIVITY_UNKNOWN)
+ push_current_activity(activity);
+
ret_val = items[screen].function(items[screen].param);
+
+ if (activity != ACTIVITY_UNKNOWN)
+ pop_current_activity();
+
last_screen = screen;
if (ret_val == GO_TO_PREVIOUS)
last_screen = old_previous;
@@ -578,15 +597,12 @@ void previous_music_is_wps(void)
previous_music = GO_TO_WPS;
}
-int current_screen(void)
-{
- return next_screen;
-}
-
void root_menu(void)
{
int previous_browser = GO_TO_FILEBROWSER;
int selected = 0;
+
+ push_current_activity(ACTIVITY_MAINMENU);
if (global_settings.start_in_screen == 0)
next_screen = (int)global_status.last_screen;