summaryrefslogtreecommitdiff
path: root/apps/menus
diff options
context:
space:
mode:
Diffstat (limited to 'apps/menus')
-rw-r--r--apps/menus/plugin_menu.c74
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
33enum {
34 APPS,
35 GAMES,
36 DEMOS,
37};
38
39static 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
48static 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
65MENUITEM_FUNCTION(games_item, ITEM_FLAG, ID2P(LANG_PLUGIN_GAMES),
66 plugins_menu, (void*)GAMES, NULL, Icon_Folder);
67MENUITEM_FUNCTION(apps_item, ITEM_FLAG, ID2P(LANG_PLUGIN_APPS),
68 plugins_menu, (void*)APPS, NULL, Icon_Folder);
69MENUITEM_FUNCTION(demos_item, ITEM_FLAG, ID2P(LANG_PLUGIN_DEMOS),
70 plugins_menu, (void*)DEMOS, NULL, Icon_Folder);
71
72MAKE_MENU(plugin_menu, ID2P(LANG_PLUGINS), NULL,
73 Icon_Plugin,
74 &games_item, &apps_item, &demos_item);