summaryrefslogtreecommitdiff
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.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)
96#ifdef HAVE_TAGCACHE 96#ifdef HAVE_TAGCACHE
97 struct tree_context* tc = tree_get_context(); 97 struct tree_context* tc = tree_get_context();
98#endif 98#endif
99 struct browse_context browse;
99 int filter = SHOW_SUPPORTED; 100 int filter = SHOW_SUPPORTED;
100 char folder[MAX_PATH] = "/"; 101 char folder[MAX_PATH] = "/";
101 /* stuff needed to remember position in file browser */ 102 /* stuff needed to remember position in file browser */
@@ -104,7 +105,7 @@ static int browser(void* param)
104#ifdef HAVE_TAGCACHE 105#ifdef HAVE_TAGCACHE
105 static int last_db_dirlevel = 0, last_db_selection = 0; 106 static int last_db_dirlevel = 0, last_db_selection = 0;
106#endif 107#endif
107 108
108 switch ((intptr_t)param) 109 switch ((intptr_t)param)
109 { 110 {
110 case GO_TO_FILEBROWSER: 111 case GO_TO_FILEBROWSER:
@@ -247,12 +248,10 @@ static int browser(void* param)
247 tc->selected_item = last_db_selection; 248 tc->selected_item = last_db_selection;
248 break; 249 break;
249#endif 250#endif
250 case GO_TO_BROWSEPLUGINS:
251 filter = SHOW_PLUGINS;
252 strlcpy(folder, PLUGIN_DIR, MAX_PATH);
253 break;
254 } 251 }
255 ret_val = rockbox_browse(folder, filter); 252
253 browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL);
254 ret_val = rockbox_browse(&browse);
256 switch ((intptr_t)param) 255 switch ((intptr_t)param)
257 { 256 {
258 case GO_TO_FILEBROWSER: 257 case GO_TO_FILEBROWSER:
@@ -352,8 +351,11 @@ static int plugins_menu(void* param)
352 ID2P(LANG_PLUGIN_GAMES), 351 ID2P(LANG_PLUGIN_GAMES),
353 ID2P(LANG_PLUGIN_APPS), ID2P(LANG_PLUGIN_DEMOS)); 352 ID2P(LANG_PLUGIN_APPS), ID2P(LANG_PLUGIN_DEMOS));
354 const char *folder; 353 const char *folder;
354 struct browse_context browse;
355 char *title;
355 int retval = GO_TO_PREVIOUS; 356 int retval = GO_TO_PREVIOUS;
356 int selection = 0, current = 0; 357 int selection = 0, current = 0;
358
357 while (retval == GO_TO_PREVIOUS) 359 while (retval == GO_TO_PREVIOUS)
358 { 360 {
359 selection = do_menu(&plugins_menu_items, &current, NULL, false); 361 selection = do_menu(&plugins_menu_items, &current, NULL, false);
@@ -361,17 +363,22 @@ static int plugins_menu(void* param)
361 { 363 {
362 case 0: 364 case 0:
363 folder = PLUGIN_GAMES_DIR; 365 folder = PLUGIN_GAMES_DIR;
366 title = str(LANG_PLUGIN_GAMES);
364 break; 367 break;
365 case 1: 368 case 1:
366 folder = PLUGIN_APPS_DIR; 369 folder = PLUGIN_APPS_DIR;
370 title = str(LANG_PLUGIN_APPS);
367 break; 371 break;
368 case 2: 372 case 2:
369 folder = PLUGIN_DEMOS_DIR; 373 folder = PLUGIN_DEMOS_DIR;
374 title = str(LANG_PLUGIN_DEMOS);
370 break; 375 break;
371 default: 376 default:
372 return selection; 377 return selection;
373 } 378 }
374 retval = rockbox_browse(folder, SHOW_PLUGINS); 379 browse_context_init(&browse, SHOW_PLUGINS, 0,
380 title, Icon_Plugin, folder, NULL);
381 retval = rockbox_browse(&browse);
375 } 382 }
376 return retval; 383 return retval;
377} 384}