summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/filetree.c13
-rw-r--r--apps/root_menu.c57
2 files changed, 38 insertions, 32 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index efe5e80a0f..75a32a9e42 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -435,7 +435,7 @@ static void ft_load_font(char *file)
435int ft_enter(struct tree_context* c) 435int ft_enter(struct tree_context* c)
436{ 436{
437 int rc = GO_TO_PREVIOUS; 437 int rc = GO_TO_PREVIOUS;
438 static char buf[MAX_PATH]; 438 char buf[MAX_PATH];
439 439
440 struct entry* file = tree_get_entry_at(c, c->selected_item); 440 struct entry* file = tree_get_entry_at(c, c->selected_item);
441 if (!file) 441 if (!file)
@@ -641,6 +641,8 @@ int ft_enter(struct tree_context* c)
641 splash(HZ, ID2P(LANG_PARTY_MODE)); 641 splash(HZ, ID2P(LANG_PARTY_MODE));
642 break; 642 break;
643 } 643 }
644
645#ifdef PLUGINS_RUN_IN_BROWSER /* Stay in the filetree to run a plugin */
644 switch (plugin_load(plugin, argument)) 646 switch (plugin_load(plugin, argument))
645 { 647 {
646 case PLUGIN_GOTO_WPS: 648 case PLUGIN_GOTO_WPS:
@@ -664,6 +666,10 @@ int ft_enter(struct tree_context* c)
664 default: 666 default:
665 break; 667 break;
666 } 668 }
669#else /* Exit the filetree to run a plugin */
670 plugin_open(plugin, argument);
671 rc = GO_TO_PLUGIN;
672#endif
667 break; 673 break;
668 } 674 }
669 675
@@ -687,6 +693,7 @@ int ft_enter(struct tree_context* c)
687 plugin = filetype_get_plugin(file, plugin_path, sizeof(plugin_path)); 693 plugin = filetype_get_plugin(file, plugin_path, sizeof(plugin_path));
688 if (plugin) 694 if (plugin)
689 { 695 {
696#ifdef PLUGINS_RUN_IN_BROWSER /* Stay in the filetree to run a plugin */
690 switch (plugin_load(plugin, argument)) 697 switch (plugin_load(plugin, argument))
691 { 698 {
692 case PLUGIN_USB_CONNECTED: 699 case PLUGIN_USB_CONNECTED:
@@ -705,6 +712,10 @@ int ft_enter(struct tree_context* c)
705 default: 712 default:
706 break; 713 break;
707 } 714 }
715#else /* Exit the filetree to run a plugin */
716 plugin_open(plugin, argument);
717 rc = GO_TO_PLUGIN;
718#endif
708 } 719 }
709 break; 720 break;
710 } 721 }
diff --git a/apps/root_menu.c b/apps/root_menu.c
index ed6bdfdcca..f731531e16 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -709,47 +709,41 @@ static int load_context_screen(int selection)
709 709
710static int load_plugin_screen(char *key) 710static int load_plugin_screen(char *key)
711{ 711{
712 int ret_val; 712 int ret_val = PLUGIN_ERROR;
713 int loops = 100;
713 int old_previous = last_screen; 714 int old_previous = last_screen;
714 int old_global = global_status.last_screen; 715 int old_global = global_status.last_screen;
715 last_screen = next_screen; 716 last_screen = next_screen;
716 global_status.last_screen = (char)next_screen; 717 global_status.last_screen = (char)next_screen;
717 status_save(); 718 status_save();
718 719
719 int opret = open_plugin_get_entry(key, &open_plugin_entry); 720 while(loops-- > 0) /* just to keep things from getting out of hand */
720 char *path = open_plugin_entry.path;
721 char *param = open_plugin_entry.param;
722 if (param[0] == '\0')
723 param = NULL;
724
725 switch (plugin_load(path, param))
726 { 721 {
727 case PLUGIN_USB_CONNECTED: 722 int opret = open_plugin_get_entry(key, &open_plugin_entry);
728 ret_val = GO_TO_ROOT; 723 char *path = open_plugin_entry.path;
729 break; 724 char *param = open_plugin_entry.param;
730 case PLUGIN_GOTO_WPS: 725 if (param[0] == '\0')
731 ret_val = GO_TO_WPS; 726 param = NULL;
732 break; 727
733 case PLUGIN_GOTO_PLUGIN: 728 int ret = plugin_load(path, param);
734 ret_val = GO_TO_PLUGIN; 729
735 break; 730 if (ret == PLUGIN_USB_CONNECTED)
736 case PLUGIN_OK:
737 /* Prevents infinite loop with WPS & Plugins*/
738 if (old_global == GO_TO_WPS && !audio_status())
739 {
740 ret_val = GO_TO_ROOT; 731 ret_val = GO_TO_ROOT;
741 break; 732 else if (ret == PLUGIN_GOTO_WPS)
733 ret_val = GO_TO_WPS;
734 else if (ret == PLUGIN_GOTO_PLUGIN)
735 continue;
736 else
737 {
738 /* Prevents infinite loop with WPS & Plugins*/
739 if (ret == PLUGIN_OK && old_global == GO_TO_WPS && !audio_status())
740 ret_val = GO_TO_ROOT;
741 ret_val = GO_TO_PREVIOUS;
742 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
742 } 743 }
743 /*fallthrough*/
744 default:
745 ret_val = GO_TO_PREVIOUS;
746 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
747 break;
748 744
749 } 745 /* ret_val != GO_TO_PLUGIN */
750 746
751 if (ret_val != GO_TO_PLUGIN)
752 {
753 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS) 747 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS)
754 { 748 {
755 /* Keep the entry in case of GO_TO_PREVIOUS */ 749 /* Keep the entry in case of GO_TO_PREVIOUS */
@@ -757,7 +751,8 @@ static int load_plugin_screen(char *key)
757 open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN; 751 open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN;
758 /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */ 752 /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */
759 } 753 }
760 } 754 break;
755 } /*while */
761 return ret_val; 756 return ret_val;
762} 757}
763 758