diff options
-rw-r--r-- | apps/menu.c | 6 | ||||
-rw-r--r-- | apps/root_menu.c | 51 | ||||
-rw-r--r-- | apps/root_menu.h | 1 |
3 files changed, 47 insertions, 11 deletions
diff --git a/apps/menu.c b/apps/menu.c index 6340185e07..ecbf3ddb4c 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -477,6 +477,12 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected) | |||
477 | { | 477 | { |
478 | list_stop_handler(); | 478 | list_stop_handler(); |
479 | } | 479 | } |
480 | else if (action == ACTION_STD_CONTEXT && | ||
481 | menu == &root_menu_) | ||
482 | { | ||
483 | ret = GO_TO_ROOTITEM_CONTEXT; | ||
484 | done = true; | ||
485 | } | ||
480 | else if (action == ACTION_STD_MENU) | 486 | else if (action == ACTION_STD_MENU) |
481 | { | 487 | { |
482 | if ((menu->flags&MENU_TYPE_MASK) == MT_OLD_MENU) | 488 | if ((menu->flags&MENU_TYPE_MASK) == MT_OLD_MENU) |
diff --git a/apps/root_menu.c b/apps/root_menu.c index 606735f67c..d11714bd99 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -70,6 +70,7 @@ | |||
70 | struct root_items { | 70 | struct root_items { |
71 | int (*function)(void* param); | 71 | int (*function)(void* param); |
72 | void* param; | 72 | void* param; |
73 | const struct menu_item_ex *context_menu; | ||
73 | }; | 74 | }; |
74 | static int last_screen = GO_TO_ROOT; /* unfortunatly needed so we can resume | 75 | static int last_screen = GO_TO_ROOT; /* unfortunatly needed so we can resume |
75 | or goto current track based on previous | 76 | or goto current track based on previous |
@@ -250,23 +251,31 @@ static int load_bmarks(void* param) | |||
250 | bookmark_mrb_load(); | 251 | bookmark_mrb_load(); |
251 | return GO_TO_PREVIOUS; | 252 | return GO_TO_PREVIOUS; |
252 | } | 253 | } |
253 | 254 | /* These are all static const'd from apps/menus/ *.c | |
255 | so little hack so we can use them */ | ||
256 | extern struct menu_item_ex | ||
257 | file_menu, | ||
258 | tagcache_menu, | ||
259 | manage_settings, | ||
260 | recording_setting_menu, | ||
261 | bookmark_settings_menu, | ||
262 | system_menu; | ||
254 | static const struct root_items items[] = { | 263 | static const struct root_items items[] = { |
255 | [GO_TO_FILEBROWSER] = { browser, (void*)GO_TO_FILEBROWSER }, | 264 | [GO_TO_FILEBROWSER] = { browser, (void*)GO_TO_FILEBROWSER, &file_menu}, |
256 | [GO_TO_DBBROWSER] = { browser, (void*)GO_TO_DBBROWSER }, | 265 | [GO_TO_DBBROWSER] = { browser, (void*)GO_TO_DBBROWSER, &tagcache_menu }, |
257 | [GO_TO_WPS] = { wpsscrn, NULL }, | 266 | [GO_TO_WPS] = { wpsscrn, NULL, &playback_menu_item }, |
258 | [GO_TO_MAINMENU] = { menu, NULL }, | 267 | [GO_TO_MAINMENU] = { menu, NULL, &manage_settings }, |
259 | 268 | ||
260 | #ifdef HAVE_RECORDING | 269 | #ifdef HAVE_RECORDING |
261 | [GO_TO_RECSCREEN] = { recscrn, NULL }, | 270 | [GO_TO_RECSCREEN] = { recscrn, NULL, &recording_setting_menu }, |
262 | #endif | 271 | #endif |
263 | 272 | ||
264 | #if CONFIG_TUNER | 273 | #if CONFIG_TUNER |
265 | [GO_TO_FM] = { radio, NULL }, | 274 | [GO_TO_FM] = { radio, NULL, NULL }, |
266 | #endif | 275 | #endif |
267 | 276 | ||
268 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL }, | 277 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, |
269 | [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS }, | 278 | [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS, NULL }, |
270 | 279 | ||
271 | }; | 280 | }; |
272 | static const int nb_items = sizeof(items)/sizeof(*items); | 281 | static const int nb_items = sizeof(items)/sizeof(*items); |
@@ -392,7 +401,25 @@ static inline int load_screen(int screen) | |||
392 | last_screen = old_previous; | 401 | last_screen = old_previous; |
393 | return ret_val; | 402 | return ret_val; |
394 | } | 403 | } |
395 | 404 | static int load_context_screen(int selection) | |
405 | { | ||
406 | const struct menu_item_ex *context_menu = NULL; | ||
407 | if (root_menu__[selection]->flags&MT_RETURN_VALUE) | ||
408 | { | ||
409 | int item = root_menu__[selection]->value; | ||
410 | context_menu = items[item].context_menu; | ||
411 | } | ||
412 | /* special cases */ | ||
413 | else if (root_menu__[selection] == &info_menu) | ||
414 | { | ||
415 | context_menu = &system_menu; | ||
416 | } | ||
417 | |||
418 | if (context_menu) | ||
419 | return do_menu(context_menu, NULL); | ||
420 | else | ||
421 | return GO_TO_PREVIOUS; | ||
422 | } | ||
396 | void root_menu(void) | 423 | void root_menu(void) |
397 | { | 424 | { |
398 | int previous_browser = GO_TO_FILEBROWSER; | 425 | int previous_browser = GO_TO_FILEBROWSER; |
@@ -455,7 +482,9 @@ void root_menu(void) | |||
455 | case GO_TO_PREVIOUS_MUSIC: | 482 | case GO_TO_PREVIOUS_MUSIC: |
456 | next_screen = previous_music; | 483 | next_screen = previous_music; |
457 | break; | 484 | break; |
458 | 485 | case GO_TO_ROOTITEM_CONTEXT: | |
486 | next_screen = load_context_screen(selected); | ||
487 | break; | ||
459 | default: | 488 | default: |
460 | if (next_screen == GO_TO_FILEBROWSER | 489 | if (next_screen == GO_TO_FILEBROWSER |
461 | #ifdef HAVE_TAGCACHE | 490 | #ifdef HAVE_TAGCACHE |
diff --git a/apps/root_menu.h b/apps/root_menu.h index ee82357103..0e189f84fc 100644 --- a/apps/root_menu.h +++ b/apps/root_menu.h | |||
@@ -27,6 +27,7 @@ enum { | |||
27 | MENU_ATTACHED_USB = -10, | 27 | MENU_ATTACHED_USB = -10, |
28 | MENU_SELECTED_EXIT = -9, | 28 | MENU_SELECTED_EXIT = -9, |
29 | 29 | ||
30 | GO_TO_ROOTITEM_CONTEXT = -5, | ||
30 | GO_TO_PREVIOUS_MUSIC = -4, | 31 | GO_TO_PREVIOUS_MUSIC = -4, |
31 | GO_TO_PREVIOUS_BROWSER = -3, | 32 | GO_TO_PREVIOUS_BROWSER = -3, |
32 | GO_TO_PREVIOUS = -2, | 33 | GO_TO_PREVIOUS = -2, |