summaryrefslogtreecommitdiffstats
path: root/apps/root_menu.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-07-31 22:45:10 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2020-08-17 10:15:14 -0400
commit35502834423049b319fde41ff305b48de67d2d51 (patch)
tree00d638d9348cd38f15cf6d341e700bc36153b3f8 /apps/root_menu.c
parentd553bb1149800daf16dcb92bc0608fe6248e1dab (diff)
downloadrockbox-35502834423049b319fde41ff305b48de67d2d51.tar.gz
rockbox-35502834423049b319fde41ff305b48de67d2d51.tar.bz2
rockbox-35502834423049b319fde41ff305b48de67d2d51.zip
Add open_plugin to core
open_plugin allows arbitrary plugins to be called in hotkey and start screen replaces PictureFlow Integration shortcuts menu plays plugins now too rather than store paths and parameters in the settings that reside in memory instead entries in a file are searched by hash. after all, the plugin has to be loaded from disk anyways ---------------------------------------------------------------------------- shortcut_viewer.rock-- can now call plugins rather than taking you to them in the browser ----------------------------------------------------------------------------- Added a new option to menus: F_CB_ON_SELECT_ONLY instead of option callback every time a item is accessed F_CB_ON_SELECT_ONLY fires callback only when item is selected ----------------------------------------------------------------------------- Added manual entries ----------------------------------------------------------------------------- Change-Id: I078b57b1d2b4dd633c89212c1082fcbc1b516e6a
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r--apps/root_menu.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c
index c59c39fe88..2a8662a170 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -32,6 +32,7 @@
#include "kernel.h"
#include "debug.h"
#include "misc.h"
+#include "open_plugin.h"
#include "rolo.h"
#include "powermgmt.h"
#include "power.h"
@@ -347,6 +348,7 @@ static int miscscrn(void * param)
int result = do_menu(menu, NULL, NULL, false);
switch (result)
{
+ case GO_TO_PLUGIN:
case GO_TO_PLAYLIST_VIEWER:
case GO_TO_WPS:
return result;
@@ -703,7 +705,6 @@ static int load_context_screen(int selection)
return retval;
}
-#ifdef HAVE_PICTUREFLOW_INTEGRATION
static int load_plugin_screen(char *plug_path, void* plug_param)
{
int ret_val;
@@ -717,6 +718,9 @@ static int load_plugin_screen(char *plug_path, void* plug_param)
case PLUGIN_GOTO_WPS:
ret_val = GO_TO_WPS;
break;
+ case PLUGIN_GOTO_PLUGIN:
+ ret_val = GO_TO_PLUGIN;
+ break;
case PLUGIN_OK:
ret_val = audio_status() ? GO_TO_PREVIOUS : GO_TO_ROOT;
break;
@@ -729,7 +733,6 @@ static int load_plugin_screen(char *plug_path, void* plug_param)
last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
return ret_val;
}
-#endif
void root_menu(void)
{
@@ -807,21 +810,36 @@ void root_menu(void)
case GO_TO_ROOTITEM_CONTEXT:
next_screen = load_context_screen(selected);
break;
-#ifdef HAVE_PICTUREFLOW_INTEGRATION
- case GO_TO_PICTUREFLOW:
+ case GO_TO_PLUGIN:
{
- char pf_path[MAX_PATH];
- char activity[6];/* big enough to display int */
- snprintf(activity, sizeof(activity), "%d", get_current_activity());
- snprintf(pf_path, sizeof(pf_path),
- "%s/pictureflow.rock",
- PLUGIN_DEMOS_DIR);
-
- next_screen = load_plugin_screen(pf_path, &activity);
- previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PICTUREFLOW;
+ char *key;
+ switch (last_screen)
+ {
+ case GO_TO_ROOT:
+ key = ID2P(LANG_START_SCREEN);
+ break;
+ case GO_TO_WPS:
+ key = ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN);
+ break;
+ case GO_TO_SHORTCUTMENU:
+ key = ID2P(LANG_SHORTCUTS);
+ break;
+ default:
+ key = ID2P(LANG_OPEN_PLUGIN);
+ break;
+ }
+
+ open_plugin_get_entry(key, &open_plugin_entry);
+ char *path = open_plugin_entry.path;
+ char *param = open_plugin_entry.param;
+ if (param[0] == '\0')
+ param = NULL;
+
+ next_screen = load_plugin_screen(path, param);
+
+ previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PLUGIN;
break;
}
-#endif
default:
#ifdef HAVE_TAGCACHE
/* With !HAVE_TAGCACHE previous_browser is always GO_TO_FILEBROWSER */