forked from len0rd/rockbox
Patch #4791 by Jonathan Gordon - Remove duplicates from the Open-with menu, and allow regular rocks to be loaded as viewers. Also allow all file types in the Open-with menu, not only the registered ones.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9025 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e8a0506583
commit
25efd331e8
2 changed files with 25 additions and 2 deletions
|
@ -246,6 +246,13 @@ int filetype_load_menu(struct menu_item* menu,int max_items)
|
||||||
{
|
{
|
||||||
if (filetypes[i].plugin)
|
if (filetypes[i].plugin)
|
||||||
{
|
{
|
||||||
|
int j;
|
||||||
|
for (j=0;j<cnt;j++) /* check if the plugin is in the list yet */
|
||||||
|
{
|
||||||
|
if (!strcmp(menu[j].desc,filetypes[i].plugin))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (j<cnt) continue; /* it is so grab the next plugin */
|
||||||
cp=strrchr(filetypes[i].plugin,'/');
|
cp=strrchr(filetypes[i].plugin,'/');
|
||||||
if (cp) cp++;
|
if (cp) cp++;
|
||||||
else cp=filetypes[i].plugin;
|
else cp=filetypes[i].plugin;
|
||||||
|
@ -261,9 +268,25 @@ 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) */
|
||||||
int filetype_load_plugin(const char* plugin, char* file)
|
int filetype_load_plugin(const char* plugin, char* file)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
snprintf(plugin_name,sizeof(plugin_name),"%s/%s.rock",
|
snprintf(plugin_name,sizeof(plugin_name),"%s/%s.rock",
|
||||||
VIEWERS_DIR,plugin);
|
VIEWERS_DIR,plugin);
|
||||||
return plugin_load(plugin_name,file);
|
if ((fd = open(plugin_name,O_RDONLY))>=0)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return plugin_load(plugin_name,file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(plugin_name,sizeof(plugin_name),"%s/%s.rock",
|
||||||
|
PLUGIN_DIR,plugin);
|
||||||
|
if ((fd = open(plugin_name,O_RDONLY))>=0)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return plugin_load(plugin_name,file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get index to filetypes[] from the file attribute */
|
/* get index to filetypes[] from the file attribute */
|
||||||
|
|
|
@ -628,7 +628,7 @@ int onplay(char* file, int attr, int from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(attr & ATTR_DIRECTORY) && attr)
|
if (!(attr & ATTR_DIRECTORY))
|
||||||
{
|
{
|
||||||
items[i].desc = ID2P(LANG_ONPLAY_OPEN_WITH);
|
items[i].desc = ID2P(LANG_ONPLAY_OPEN_WITH);
|
||||||
items[i].function = list_viewers;
|
items[i].function = list_viewers;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue