summaryrefslogtreecommitdiff
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
parentfda7d720c05b4a756f045e0c0f4afe9630edb5c5 (diff)
downloadrockbox-7fe32b9a27e128e7a674ca24db90cf74d3fa6a54.zip
rockbox-7fe32b9a27e128e7a674ca24db90cf74d3fa6a54.tar.gz
rockbox-7fe32b9a27e128e7a674ca24db90cf74d3fa6a54.tar.bz2
rockbox-7fe32b9a27e128e7a674ca24db90cf74d3fa6a54.tar.xz
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
-rw-r--r--apps/filetypes.c15
-rw-r--r--apps/plugins/viewers.config2
2 files changed, 14 insertions, 3 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 973f60e..77d73df 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
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config
index 57bb5b4..938a47a 100644
--- a/apps/plugins/viewers.config
+++ b/apps/plugins/viewers.config
@@ -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,-