diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-08-06 13:58:16 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-08-06 13:58:16 +0000 |
commit | 7fe32b9a27e128e7a674ca24db90cf74d3fa6a54 (patch) | |
tree | 7042d88e723d460df3eb2fb60419aa66f490c0fb /apps | |
parent | fda7d720c05b4a756f045e0c0f4afe9630edb5c5 (diff) | |
download | rockbox-7fe32b9a27e128e7a674ca24db90cf74d3fa6a54.tar.gz rockbox-7fe32b9a27e128e7a674ca24db90cf74d3fa6a54.zip |
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')
-rw-r--r-- | apps/filetypes.c | 15 | ||||
-rw-r--r-- | apps/plugins/viewers.config | 2 |
2 files changed, 14 insertions, 3 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) | |||
424 | { | 424 | { |
425 | int i, count = 0; | 425 | int i, count = 0; |
426 | char *strings[MAX_FILETYPES/2]; | 426 | char *strings[MAX_FILETYPES/2]; |
427 | char *ext; | ||
427 | struct menu_callback_with_desc cb_and_desc = | 428 | struct menu_callback_with_desc cb_and_desc = |
428 | { NULL, ID2P(LANG_ONPLAY_OPEN_WITH), Icon_Plugin }; | 429 | { NULL, ID2P(LANG_ONPLAY_OPEN_WITH), Icon_Plugin }; |
429 | struct menu_item_ex menu; | 430 | struct menu_item_ex menu; |
430 | 431 | ||
432 | ext = strrchr(current_file, '.'); | ||
433 | if (ext) | ||
434 | ext++; | ||
431 | for (i=0; i<filetype_count && count < (MAX_FILETYPES/2); i++) | 435 | for (i=0; i<filetype_count && count < (MAX_FILETYPES/2); i++) |
432 | { | 436 | { |
433 | if (filetypes[i].plugin) | 437 | if (filetypes[i].plugin) |
@@ -440,8 +444,15 @@ int filetype_list_viewers(const char* current_file) | |||
440 | } | 444 | } |
441 | if (j<count) | 445 | if (j<count) |
442 | continue; /* it is so grab the next plugin */ | 446 | continue; /* it is so grab the next plugin */ |
443 | strings[count] = filetypes[i].plugin; | 447 | if (ext && filetypes[i].extension && |
444 | count++; | 448 | (filetypes[i].extension[0] != '*')) |
449 | { | ||
450 | if (strcasecmp(filetypes[i].extension, ext)) | ||
451 | continue; /* skip this one */ | ||
452 | } | ||
453 | strings[count] = strrchr(filetypes[i].plugin,'/'); | ||
454 | if (strings[count]) | ||
455 | strings[count++]++; | ||
445 | } | 456 | } |
446 | } | 457 | } |
447 | #ifndef HAVE_LCD_BITMAP | 458 | #ifndef HAVE_LCD_BITMAP |
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config index 57bb5b4961..938a47a7ec 100644 --- a/apps/plugins/viewers.config +++ b/apps/plugins/viewers.config | |||
@@ -33,7 +33,7 @@ tap,viewers/zxbox,12 | |||
33 | sna,viewers/zxbox,12 | 33 | sna,viewers/zxbox,12 |
34 | tzx,viewers/zxbox,12 | 34 | tzx,viewers/zxbox,12 |
35 | z80,viewers/zxbox,12 | 35 | z80,viewers/zxbox,12 |
36 | zzz,viewers/properties,- | 36 | *,viewers/properties,- |
37 | colours,apps/text_editor,11 | 37 | colours,apps/text_editor,11 |
38 | ssg,games/superdom,- | 38 | ssg,games/superdom,- |
39 | link,viewers/shortcuts,- | 39 | link,viewers/shortcuts,- |