summaryrefslogtreecommitdiffstats
path: root/apps/root_menu.c
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-12-14 13:37:58 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-12-14 13:37:58 +0000
commit08af5d84044a7f18a619e1cb38cd183819be41b9 (patch)
treee441cf84b0268e5b008d044902641f063f218152 /apps/root_menu.c
parentfbd75fcc86304ccf44ad8174c91684b687a877ec (diff)
downloadrockbox-08af5d84044a7f18a619e1cb38cd183819be41b9.tar.gz
rockbox-08af5d84044a7f18a619e1cb38cd183819be41b9.tar.bz2
rockbox-08af5d84044a7f18a619e1cb38cd183819be41b9.zip
FS#11777: enhancement for rockbox_browse()
* Add struct browse_context to be passed to rockbox_browse. * Show proper title when selecting e.g. .wps file or .sbs file from the settings menu. * Add select only mode to rockbox_browse(). when a file is selected, it's path is stored to buffer and the browser exits without 'playing' the file. this will allow to use the browser in more places to select file including plugins. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28831 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r--apps/root_menu.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c
index a65ceb51b9..27242c9797 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -96,6 +96,7 @@ static int browser(void* param)
#ifdef HAVE_TAGCACHE
struct tree_context* tc = tree_get_context();
#endif
+ struct browse_context browse;
int filter = SHOW_SUPPORTED;
char folder[MAX_PATH] = "/";
/* stuff needed to remember position in file browser */
@@ -104,7 +105,7 @@ static int browser(void* param)
#ifdef HAVE_TAGCACHE
static int last_db_dirlevel = 0, last_db_selection = 0;
#endif
-
+
switch ((intptr_t)param)
{
case GO_TO_FILEBROWSER:
@@ -247,12 +248,10 @@ static int browser(void* param)
tc->selected_item = last_db_selection;
break;
#endif
- case GO_TO_BROWSEPLUGINS:
- filter = SHOW_PLUGINS;
- strlcpy(folder, PLUGIN_DIR, MAX_PATH);
- break;
}
- ret_val = rockbox_browse(folder, filter);
+
+ browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL);
+ ret_val = rockbox_browse(&browse);
switch ((intptr_t)param)
{
case GO_TO_FILEBROWSER:
@@ -352,8 +351,11 @@ static int plugins_menu(void* param)
ID2P(LANG_PLUGIN_GAMES),
ID2P(LANG_PLUGIN_APPS), ID2P(LANG_PLUGIN_DEMOS));
const char *folder;
+ struct browse_context browse;
+ char *title;
int retval = GO_TO_PREVIOUS;
int selection = 0, current = 0;
+
while (retval == GO_TO_PREVIOUS)
{
selection = do_menu(&plugins_menu_items, &current, NULL, false);
@@ -361,17 +363,22 @@ static int plugins_menu(void* param)
{
case 0:
folder = PLUGIN_GAMES_DIR;
+ title = str(LANG_PLUGIN_GAMES);
break;
case 1:
folder = PLUGIN_APPS_DIR;
+ title = str(LANG_PLUGIN_APPS);
break;
case 2:
folder = PLUGIN_DEMOS_DIR;
+ title = str(LANG_PLUGIN_DEMOS);
break;
default:
return selection;
}
- retval = rockbox_browse(folder, SHOW_PLUGINS);
+ browse_context_init(&browse, SHOW_PLUGINS, 0,
+ title, Icon_Plugin, folder, NULL);
+ retval = rockbox_browse(&browse);
}
return retval;
}