Fix flag for the viewport. Text is supposed to be centered.
[maemo-rb.git] / apps / menus / plugin_menu.c
blob055cfce140b6da0eb72d4738925d0a1de6437c1a
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Thomas Martitz
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
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"
33 enum {
34 GAMES,
35 APPS,
36 DEMOS,
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 },
48 static int plugins_menu(void* param)
50 intptr_t item = (intptr_t)param;
51 struct browse_context browse;
52 int ret;
54 browse_context_init(&browse, SHOW_PLUGINS, 0, str(items[item].id),
55 Icon_Plugin, items[item].path, NULL);
57 ret = rockbox_browse(&browse);
58 if (ret == GO_TO_PREVIOUS)
59 return 0;
60 return ret;
63 #define ITEM_FLAG (MENU_FUNC_USEPARAM|MENU_FUNC_CHECK_RETVAL)
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);
72 MAKE_MENU(plugin_menu, ID2P(LANG_PLUGINS), NULL,
73 Icon_Plugin,
74 &games_item, &apps_item, &demos_item);