diff options
-rw-r--r-- | apps/SOURCES | 1 | ||||
-rw-r--r-- | apps/menus/plugin_menu.c | 74 | ||||
-rw-r--r-- | apps/root_menu.c | 45 |
3 files changed, 80 insertions, 40 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index 4755ad42c3..364faa3205 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -15,6 +15,7 @@ menu.c | |||
15 | menus/menu_common.c | 15 | menus/menu_common.c |
16 | menus/display_menu.c | 16 | menus/display_menu.c |
17 | menus/theme_menu.c | 17 | menus/theme_menu.c |
18 | menus/plugin_menu.c | ||
18 | #if CONFIG_CODEC == SWCODEC | 19 | #if CONFIG_CODEC == SWCODEC |
19 | #ifdef HAVE_WM8978 | 20 | #ifdef HAVE_WM8978 |
20 | menus/audiohw_eq_menu.c | 21 | menus/audiohw_eq_menu.c |
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); | ||
diff --git a/apps/root_menu.c b/apps/root_menu.c index ed7140fbe4..79b7afffe8 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -320,7 +320,8 @@ static int radio(void* param) | |||
320 | static int miscscrn(void * param) | 320 | static int miscscrn(void * param) |
321 | { | 321 | { |
322 | const struct menu_item_ex *menu = (const struct menu_item_ex*)param; | 322 | const struct menu_item_ex *menu = (const struct menu_item_ex*)param; |
323 | switch (do_menu(menu, NULL, NULL, false)) | 323 | int result = do_menu(menu, NULL, NULL, false); |
324 | switch (result) | ||
324 | { | 325 | { |
325 | case GO_TO_PLAYLIST_VIEWER: | 326 | case GO_TO_PLAYLIST_VIEWER: |
326 | return GO_TO_PLAYLIST_VIEWER; | 327 | return GO_TO_PLAYLIST_VIEWER; |
@@ -350,44 +351,7 @@ static int load_bmarks(void* param) | |||
350 | return GO_TO_WPS; | 351 | return GO_TO_WPS; |
351 | return GO_TO_PREVIOUS; | 352 | return GO_TO_PREVIOUS; |
352 | } | 353 | } |
353 | static int plugins_menu(void* param) | ||
354 | { | ||
355 | (void)param; | ||
356 | MENUITEM_STRINGLIST(plugins_menu_items, ID2P(LANG_PLUGINS), NULL, | ||
357 | ID2P(LANG_PLUGIN_GAMES), | ||
358 | ID2P(LANG_PLUGIN_APPS), ID2P(LANG_PLUGIN_DEMOS)); | ||
359 | const char *folder; | ||
360 | struct browse_context browse; | ||
361 | char *title; | ||
362 | int retval = GO_TO_PREVIOUS; | ||
363 | int selection = 0, current = 0; | ||
364 | 354 | ||
365 | while (retval == GO_TO_PREVIOUS) | ||
366 | { | ||
367 | selection = do_menu(&plugins_menu_items, ¤t, NULL, false); | ||
368 | switch (selection) | ||
369 | { | ||
370 | case 0: | ||
371 | folder = PLUGIN_GAMES_DIR; | ||
372 | title = str(LANG_PLUGIN_GAMES); | ||
373 | break; | ||
374 | case 1: | ||
375 | folder = PLUGIN_APPS_DIR; | ||
376 | title = str(LANG_PLUGIN_APPS); | ||
377 | break; | ||
378 | case 2: | ||
379 | folder = PLUGIN_DEMOS_DIR; | ||
380 | title = str(LANG_PLUGIN_DEMOS); | ||
381 | break; | ||
382 | default: | ||
383 | return selection; | ||
384 | } | ||
385 | browse_context_init(&browse, SHOW_PLUGINS, 0, | ||
386 | title, Icon_Plugin, folder, NULL); | ||
387 | retval = rockbox_browse(&browse); | ||
388 | } | ||
389 | return retval; | ||
390 | } | ||
391 | int time_screen(void* ignored); | 355 | int time_screen(void* ignored); |
392 | 356 | ||
393 | /* These are all static const'd from apps/menus/ *.c | 357 | /* These are all static const'd from apps/menus/ *.c |
@@ -402,6 +366,7 @@ extern struct menu_item_ex | |||
402 | recording_settings_menu, | 366 | recording_settings_menu, |
403 | radio_settings_menu, | 367 | radio_settings_menu, |
404 | bookmark_settings_menu, | 368 | bookmark_settings_menu, |
369 | plugin_menu, | ||
405 | playlist_options, | 370 | playlist_options, |
406 | info_menu, | 371 | info_menu, |
407 | system_menu; | 372 | system_menu; |
@@ -423,8 +388,8 @@ static const struct root_items items[] = { | |||
423 | #endif | 388 | #endif |
424 | 389 | ||
425 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, | 390 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, |
426 | [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL }, | 391 | [GO_TO_BROWSEPLUGINS] = { miscscrn, &plugin_menu, NULL }, |
427 | [GO_TO_PLAYLISTS_SCREEN] = { miscscrn, &playlist_options, | 392 | [GO_TO_PLAYLISTS_SCREEN] = { miscscrn, &playlist_options, |
428 | &playlist_settings }, | 393 | &playlist_settings }, |
429 | [GO_TO_PLAYLIST_VIEWER] = { playlist_view, NULL, NULL }, | 394 | [GO_TO_PLAYLIST_VIEWER] = { playlist_view, NULL, NULL }, |
430 | [GO_TO_SYSTEM_SCREEN] = { miscscrn, &info_menu, &system_menu }, | 395 | [GO_TO_SYSTEM_SCREEN] = { miscscrn, &info_menu, &system_menu }, |