diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-06-01 14:41:49 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-06-01 14:41:49 +0000 |
commit | b58d3656d79e5f9752a22d55c139294412084e4f (patch) | |
tree | bd98c9d2ab0db1e0df432814bb398cdb49739fe1 /apps/root_menu.c | |
parent | c54f4b34400ea96bd3e2d86ba919a0ae509a56a9 (diff) | |
download | rockbox-b58d3656d79e5f9752a22d55c139294412084e4f.tar.gz 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.c | 26 |
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) | |||
151 | #endif | 151 | #endif |
152 | strcpy(folder, last_folder); | 152 | strcpy(folder, last_folder); |
153 | } | 153 | } |
154 | push_current_activity(ACTIVITY_FILEBROWSER); | ||
154 | break; | 155 | break; |
155 | #ifdef HAVE_TAGCACHE | 156 | #ifdef HAVE_TAGCACHE |
156 | case GO_TO_DBBROWSER: | 157 | case GO_TO_DBBROWSER: |
@@ -246,12 +247,14 @@ static int browser(void* param) | |||
246 | filter = SHOW_ID3DB; | 247 | filter = SHOW_ID3DB; |
247 | tc->dirlevel = last_db_dirlevel; | 248 | tc->dirlevel = last_db_dirlevel; |
248 | tc->selected_item = last_db_selection; | 249 | tc->selected_item = last_db_selection; |
250 | push_current_activity(ACTIVITY_DATABASEBROWSER); | ||
249 | break; | 251 | break; |
250 | #endif | 252 | #endif |
251 | } | 253 | } |
252 | 254 | ||
253 | browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL); | 255 | browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL); |
254 | ret_val = rockbox_browse(&browse); | 256 | ret_val = rockbox_browse(&browse); |
257 | pop_current_activity(); | ||
255 | switch ((intptr_t)param) | 258 | switch ((intptr_t)param) |
256 | { | 259 | { |
257 | case GO_TO_FILEBROWSER: | 260 | case GO_TO_FILEBROWSER: |
@@ -285,6 +288,7 @@ static int wpsscrn(void* param) | |||
285 | { | 288 | { |
286 | int ret_val = GO_TO_PREVIOUS; | 289 | int ret_val = GO_TO_PREVIOUS; |
287 | (void)param; | 290 | (void)param; |
291 | push_current_activity(ACTIVITY_WPS); | ||
288 | if (audio_status()) | 292 | if (audio_status()) |
289 | { | 293 | { |
290 | talk_shutup(); | 294 | talk_shutup(); |
@@ -306,6 +310,7 @@ static int wpsscrn(void* param) | |||
306 | { | 310 | { |
307 | splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); | 311 | splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); |
308 | } | 312 | } |
313 | pop_current_activity(); | ||
309 | return ret_val; | 314 | return ret_val; |
310 | } | 315 | } |
311 | #if CONFIG_TUNER | 316 | #if CONFIG_TUNER |
@@ -511,13 +516,27 @@ static inline int load_screen(int screen) | |||
511 | if we dont we will always return to the wrong screen on boot */ | 516 | if we dont we will always return to the wrong screen on boot */ |
512 | int old_previous = last_screen; | 517 | int old_previous = last_screen; |
513 | int ret_val; | 518 | int ret_val; |
519 | enum current_activity activity = ACTIVITY_UNKNOWN; | ||
514 | if (screen <= GO_TO_ROOT) | 520 | if (screen <= GO_TO_ROOT) |
515 | return screen; | 521 | return screen; |
516 | if (screen == old_previous) | 522 | if (screen == old_previous) |
517 | old_previous = GO_TO_ROOT; | 523 | old_previous = GO_TO_ROOT; |
518 | global_status.last_screen = (char)screen; | 524 | global_status.last_screen = (char)screen; |
519 | status_save(); | 525 | status_save(); |
526 | |||
527 | if (screen == GO_TO_BROWSEPLUGINS) | ||
528 | activity = ACTIVITY_PLUGINBROWSER; | ||
529 | else if (screen == GO_TO_MAINMENU) | ||
530 | activity = ACTIVITY_SETTINGS; | ||
531 | |||
532 | if (activity != ACTIVITY_UNKNOWN) | ||
533 | push_current_activity(activity); | ||
534 | |||
520 | ret_val = items[screen].function(items[screen].param); | 535 | ret_val = items[screen].function(items[screen].param); |
536 | |||
537 | if (activity != ACTIVITY_UNKNOWN) | ||
538 | pop_current_activity(); | ||
539 | |||
521 | last_screen = screen; | 540 | last_screen = screen; |
522 | if (ret_val == GO_TO_PREVIOUS) | 541 | if (ret_val == GO_TO_PREVIOUS) |
523 | last_screen = old_previous; | 542 | last_screen = old_previous; |
@@ -578,15 +597,12 @@ void previous_music_is_wps(void) | |||
578 | previous_music = GO_TO_WPS; | 597 | previous_music = GO_TO_WPS; |
579 | } | 598 | } |
580 | 599 | ||
581 | int current_screen(void) | ||
582 | { | ||
583 | return next_screen; | ||
584 | } | ||
585 | |||
586 | void root_menu(void) | 600 | void root_menu(void) |
587 | { | 601 | { |
588 | int previous_browser = GO_TO_FILEBROWSER; | 602 | int previous_browser = GO_TO_FILEBROWSER; |
589 | int selected = 0; | 603 | int selected = 0; |
604 | |||
605 | push_current_activity(ACTIVITY_MAINMENU); | ||
590 | 606 | ||
591 | if (global_settings.start_in_screen == 0) | 607 | if (global_settings.start_in_screen == 0) |
592 | next_screen = (int)global_status.last_screen; | 608 | next_screen = (int)global_status.last_screen; |