diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-11-15 13:22:02 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-11-15 13:22:02 +0000 |
| commit | 101693fd3047fb64e766580e80635a424fa25c4d (patch) | |
| tree | 80f5664710a6e84b73f33e22c1b8632c13c5a727 /apps/debug_menu.c | |
| parent | e7e4b131d06f748400b5299d4d1ebfb38f9f08bf (diff) | |
| download | rockbox-101693fd3047fb64e766580e80635a424fa25c4d.zip rockbox-101693fd3047fb64e766580e80635a424fa25c4d.tar.gz rockbox-101693fd3047fb64e766580e80635a424fa25c4d.tar.bz2 rockbox-101693fd3047fb64e766580e80635a424fa25c4d.tar.xz | |
FS#12251 - User shortcuts in the main menu.
Custom shortcuts which give the user fast access to regularly used files/folders/settings/whatever.
Thanks to Alexander Levin for the manual part of the patch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30990 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/debug_menu.c')
| -rw-r--r-- | apps/debug_menu.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 442bc8b..809644b 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -25,6 +25,7 @@ #include <stdbool.h> #include <string.h> #include "lcd.h" +#include "lang.h" #include "menu.h" #include "debug_menu.h" #include "kernel.h" @@ -45,6 +46,7 @@ #include "screens.h" #include "misc.h" #include "splash.h" +#include "shortcuts.h" #include "dircache.h" #include "viewport.h" #ifdef HAVE_TAGCACHE @@ -2120,15 +2122,23 @@ static const struct the_menu_item menuitems[] = { }; static int menu_action_callback(int btn, struct gui_synclist *lists) { + int selection = gui_synclist_get_sel_pos(lists); if (btn == ACTION_STD_OK) { FOR_NB_SCREENS(i) viewportmanager_theme_enable(i, false, NULL); - menuitems[gui_synclist_get_sel_pos(lists)].function(); + menuitems[selection].function(); btn = ACTION_REDRAW; FOR_NB_SCREENS(i) viewportmanager_theme_undo(i, false); } + else if (btn == ACTION_STD_CONTEXT) + { + MENUITEM_STRINGLIST(menu_items, "Debug Menu", NULL, ID2P(LANG_ADD_TO_FAVES)); + if (do_menu(&menu_items, NULL, NULL, false) == 0) + shortcuts_add(SHORTCUT_DEBUGITEM, menuitems[selection].desc); + return ACTION_STD_CANCEL; + } return btn; } @@ -2148,3 +2158,22 @@ bool debug_menu(void) info.get_name = dbg_menu_getname; return simplelist_show_list(&info); } + +bool run_debug_screen(char* screen) +{ + unsigned i; + for (i=0; i<ARRAYLEN(menuitems); i++) + { + if (!strcmp(screen, menuitems[i].desc)) + { + FOR_NB_SCREENS(j) + viewportmanager_theme_enable(j, false, NULL); + menuitems[i].function(); + FOR_NB_SCREENS(j) + viewportmanager_theme_undo(j, false); + return true; + } + } + return false; +} + |