diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-01-29 11:50:38 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-01-29 11:50:38 +0000 |
commit | f7da333d12687913fd5fe753fb70bc3f23236fe0 (patch) | |
tree | d1cc2cca722e1dce3a90397d64dc065ba9fb8536 /apps/menus | |
parent | 4aec8ef059872e15a9ec6830398ab91d49126175 (diff) | |
download | rockbox-f7da333d12687913fd5fe753fb70bc3f23236fe0.tar.gz rockbox-f7da333d12687913fd5fe753fb70bc3f23236fe0.zip |
Re-factor code for the plugins main menu item, enabling better icons in that menu.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29160 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menus')
-rw-r--r-- | apps/menus/plugin_menu.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/apps/menus/plugin_menu.c b/apps/menus/plugin_menu.c new file mode 100644 index 0000000000..b554487dc3 --- /dev/null +++ b/apps/menus/plugin_menu.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include <stdbool.h> | ||
23 | #include <string.h> | ||
24 | #include "config.h" | ||
25 | #include "lang.h" | ||
26 | #include "menu.h" | ||
27 | #include "settings.h" | ||
28 | #include "rbpaths.h" | ||
29 | #include "root_menu.h" | ||
30 | #include "tree.h" | ||
31 | |||
32 | |||
33 | enum { | ||
34 | APPS, | ||
35 | GAMES, | ||
36 | DEMOS, | ||
37 | }; | ||
38 | |||
39 | static const struct { | ||
40 | const char *path; | ||
41 | int id; | ||
42 | } items[] = { | ||
43 | { PLUGIN_GAMES_DIR, LANG_PLUGIN_GAMES }, | ||
44 | { PLUGIN_APPS_DIR, LANG_PLUGIN_APPS }, | ||
45 | { PLUGIN_DEMOS_DIR, LANG_PLUGIN_DEMOS }, | ||
46 | }; | ||
47 | |||
48 | static int plugins_menu(void* param) | ||
49 | { | ||
50 | intptr_t item = (intptr_t)param; | ||
51 | struct browse_context browse; | ||
52 | int ret; | ||
53 | |||
54 | browse_context_init(&browse, SHOW_PLUGINS, 0, str(items[item].id), | ||
55 | Icon_Plugin, items[item].path, NULL); | ||
56 | |||
57 | ret = rockbox_browse(&browse); | ||
58 | if (ret == GO_TO_PREVIOUS) | ||
59 | return 0; | ||
60 | return ret; | ||
61 | } | ||
62 | |||
63 | #define ITEM_FLAG (MENU_FUNC_USEPARAM|MENU_FUNC_CHECK_RETVAL) | ||
64 | |||
65 | MENUITEM_FUNCTION(games_item, ITEM_FLAG, ID2P(LANG_PLUGIN_GAMES), | ||
66 | plugins_menu, (void*)GAMES, NULL, Icon_Folder); | ||
67 | MENUITEM_FUNCTION(apps_item, ITEM_FLAG, ID2P(LANG_PLUGIN_APPS), | ||
68 | plugins_menu, (void*)APPS, NULL, Icon_Folder); | ||
69 | MENUITEM_FUNCTION(demos_item, ITEM_FLAG, ID2P(LANG_PLUGIN_DEMOS), | ||
70 | plugins_menu, (void*)DEMOS, NULL, Icon_Folder); | ||
71 | |||
72 | MAKE_MENU(plugin_menu, ID2P(LANG_PLUGINS), NULL, | ||
73 | Icon_Plugin, | ||
74 | &games_item, &apps_item, &demos_item); | ||