1
0
Fork 0
forked from len0rd/rockbox

Open with... now reloads the dir if the viewer returns PLUGIN_USB_CONNECTED

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4871 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-07-13 13:57:14 +00:00
parent 10fafb3d7c
commit ae9b319ec5
3 changed files with 10 additions and 4 deletions

View file

@ -239,11 +239,11 @@ int filetype_load_menu(struct menu_item* menu,int max_items)
} }
/* start a plugin with an argument (called from onplay.c) */ /* start a plugin with an argument (called from onplay.c) */
void filetype_load_plugin(char* plugin, char* file) int filetype_load_plugin(char* plugin, char* file)
{ {
snprintf(plugin_name,sizeof(plugin_name),"%s/%s.rock", snprintf(plugin_name,sizeof(plugin_name),"%s/%s.rock",
VIEWERS_DIR,plugin); VIEWERS_DIR,plugin);
plugin_load(plugin_name,file); return plugin_load(plugin_name,file);
} }
/* get index to filetypes[] from the file attribute */ /* get index to filetypes[] from the file attribute */

View file

@ -33,7 +33,7 @@ char* filetype_get_plugin(struct entry*);
void filetype_init(void); void filetype_init(void);
bool filetype_supported(int); bool filetype_supported(int);
int filetype_load_menu(struct menu_item*, int); int filetype_load_menu(struct menu_item*, int);
void filetype_load_plugin(char*,char*); int filetype_load_plugin(char*,char*);
struct file_type { struct file_type {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP

View file

@ -44,6 +44,7 @@
#include "talk.h" #include "talk.h"
#include "onplay.h" #include "onplay.h"
#include "filetypes.h" #include "filetypes.h"
#include "plugin.h"
static char* selected_file = NULL; static char* selected_file = NULL;
static int selected_file_attr = 0; static int selected_file_attr = 0;
@ -53,6 +54,7 @@ static bool list_viewers(void)
{ {
struct menu_item menu[8]; struct menu_item menu[8];
int m, i, result; int m, i, result;
int ret = 0;
i=filetype_load_menu(menu,sizeof(menu)/sizeof(*menu)); i=filetype_load_menu(menu,sizeof(menu)/sizeof(*menu));
if (i) if (i)
@ -61,12 +63,16 @@ static bool list_viewers(void)
result = menu_show(m); result = menu_show(m);
menu_exit(m); menu_exit(m);
if (result >= 0) if (result >= 0)
filetype_load_plugin(menu[result].desc,selected_file); ret = filetype_load_plugin(menu[result].desc,selected_file);
} }
else else
{ {
splash(HZ*2, true, "No viewers found"); splash(HZ*2, true, "No viewers found");
} }
if(ret == PLUGIN_USB_CONNECTED)
onplay_result = ONPLAY_RELOAD_DIR;
return false; return false;
} }