summaryrefslogtreecommitdiff
path: root/apps/filetypes.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:58:16 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:58:16 +0000
commit7fe32b9a27e128e7a674ca24db90cf74d3fa6a54 (patch)
tree7042d88e723d460df3eb2fb60419aa66f490c0fb /apps/filetypes.c
parentfda7d720c05b4a756f045e0c0f4afe9630edb5c5 (diff)
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
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r--apps/filetypes.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 973f60e6e5..77d73df5cc 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -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