Only show plugins which are actually associated with the file from the "open with" menu. (plugins registered with * in the viewers.config are always shown)

Shows everything if the file doesnt have a extension.
Also fix the plugin name showing the whole path instead of just the name.

Previous commit should have said "Delete your current /.rockbox/rocks folder because the plugins' config/extra files have moved and to save you hassles"


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14215 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-08-06 13:58:16 +00:00
parent fda7d720c0
commit 7fe32b9a27
2 changed files with 14 additions and 3 deletions

View file

@ -424,10 +424,14 @@ int filetype_list_viewers(const char* current_file)
{
int i, count = 0;
char *strings[MAX_FILETYPES/2];
char *ext;
struct menu_callback_with_desc cb_and_desc =
{ NULL, ID2P(LANG_ONPLAY_OPEN_WITH), Icon_Plugin };
struct menu_item_ex menu;
ext = strrchr(current_file, '.');
if (ext)
ext++;
for (i=0; i<filetype_count && count < (MAX_FILETYPES/2); i++)
{
if (filetypes[i].plugin)
@ -440,8 +444,15 @@ int filetype_list_viewers(const char* current_file)
}
if (j<count)
continue; /* it is so grab the next plugin */
strings[count] = filetypes[i].plugin;
count++;
if (ext && filetypes[i].extension &&
(filetypes[i].extension[0] != '*'))
{
if (strcasecmp(filetypes[i].extension, ext))
continue; /* skip this one */
}
strings[count] = strrchr(filetypes[i].plugin,'/');
if (strings[count])
strings[count++]++;
}
}
#ifndef HAVE_LCD_BITMAP

View file

@ -33,7 +33,7 @@ tap,viewers/zxbox,12
sna,viewers/zxbox,12
tzx,viewers/zxbox,12
z80,viewers/zxbox,12
zzz,viewers/properties,-
*,viewers/properties,-
colours,apps/text_editor,11
ssg,games/superdom,-
link,viewers/shortcuts,-