summaryrefslogtreecommitdiff
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.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 @@
32#include "kernel.h" 32#include "kernel.h"
33#include "debug.h" 33#include "debug.h"
34#include "misc.h" 34#include "misc.h"
35#include "open_plugin.h"
35#include "rolo.h" 36#include "rolo.h"
36#include "powermgmt.h" 37#include "powermgmt.h"
37#include "power.h" 38#include "power.h"
@@ -347,6 +348,7 @@ static int miscscrn(void * param)
347 int result = do_menu(menu, NULL, NULL, false); 348 int result = do_menu(menu, NULL, NULL, false);
348 switch (result) 349 switch (result)
349 { 350 {
351 case GO_TO_PLUGIN:
350 case GO_TO_PLAYLIST_VIEWER: 352 case GO_TO_PLAYLIST_VIEWER:
351 case GO_TO_WPS: 353 case GO_TO_WPS:
352 return result; 354 return result;
@@ -703,7 +705,6 @@ static int load_context_screen(int selection)
703 return retval; 705 return retval;
704} 706}
705 707
706#ifdef HAVE_PICTUREFLOW_INTEGRATION
707static int load_plugin_screen(char *plug_path, void* plug_param) 708static int load_plugin_screen(char *plug_path, void* plug_param)
708{ 709{
709 int ret_val; 710 int ret_val;
@@ -717,6 +718,9 @@ static int load_plugin_screen(char *plug_path, void* plug_param)
717 case PLUGIN_GOTO_WPS: 718 case PLUGIN_GOTO_WPS:
718 ret_val = GO_TO_WPS; 719 ret_val = GO_TO_WPS;
719 break; 720 break;
721 case PLUGIN_GOTO_PLUGIN:
722 ret_val = GO_TO_PLUGIN;
723 break;
720 case PLUGIN_OK: 724 case PLUGIN_OK:
721 ret_val = audio_status() ? GO_TO_PREVIOUS : GO_TO_ROOT; 725 ret_val = audio_status() ? GO_TO_PREVIOUS : GO_TO_ROOT;
722 break; 726 break;
@@ -729,7 +733,6 @@ static int load_plugin_screen(char *plug_path, void* plug_param)
729 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous; 733 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
730 return ret_val; 734 return ret_val;
731} 735}
732#endif
733 736
734void root_menu(void) 737void root_menu(void)
735{ 738{
@@ -807,21 +810,36 @@ void root_menu(void)
807 case GO_TO_ROOTITEM_CONTEXT: 810 case GO_TO_ROOTITEM_CONTEXT:
808 next_screen = load_context_screen(selected); 811 next_screen = load_context_screen(selected);
809 break; 812 break;
810#ifdef HAVE_PICTUREFLOW_INTEGRATION 813 case GO_TO_PLUGIN:
811 case GO_TO_PICTUREFLOW:
812 { 814 {
813 char pf_path[MAX_PATH]; 815 char *key;
814 char activity[6];/* big enough to display int */ 816 switch (last_screen)
815 snprintf(activity, sizeof(activity), "%d", get_current_activity()); 817 {
816 snprintf(pf_path, sizeof(pf_path), 818 case GO_TO_ROOT:
817 "%s/pictureflow.rock", 819 key = ID2P(LANG_START_SCREEN);
818 PLUGIN_DEMOS_DIR); 820 break;
819 821 case GO_TO_WPS:
820 next_screen = load_plugin_screen(pf_path, &activity); 822 key = ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN);
821 previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PICTUREFLOW; 823 break;
824 case GO_TO_SHORTCUTMENU:
825 key = ID2P(LANG_SHORTCUTS);
826 break;
827 default:
828 key = ID2P(LANG_OPEN_PLUGIN);
829 break;
830 }
831
832 open_plugin_get_entry(key, &open_plugin_entry);
833 char *path = open_plugin_entry.path;
834 char *param = open_plugin_entry.param;
835 if (param[0] == '\0')
836 param = NULL;
837
838 next_screen = load_plugin_screen(path, param);
839
840 previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PLUGIN;
822 break; 841 break;
823 } 842 }
824#endif
825 default: 843 default:
826#ifdef HAVE_TAGCACHE 844#ifdef HAVE_TAGCACHE
827/* With !HAVE_TAGCACHE previous_browser is always GO_TO_FILEBROWSER */ 845/* With !HAVE_TAGCACHE previous_browser is always GO_TO_FILEBROWSER */