diff --git a/apps/filetypes.c b/apps/filetypes.c index 68540802b0..8c19cdd32c 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -220,21 +220,28 @@ int filetype_get_attr(const char* name) } /* fill a menu list with viewers (used in onplay.c) */ -int filetype_load_menu(struct menu_item* menu,int max_items) +int filetype_load_menu(struct menu_item* menu, int max_items, + char *filename) { int i; int cnt=0; - for (i=0; i < cnt_filetypes; i++) + for (i=0; i < cnt_exttypes; i++) { - if (filetypes[i].plugin) + if(exttypes[i].type->plugin) { - menu[cnt].desc = filetypes[i].plugin; - cnt++; - if (cnt == max_items) - break; + if (strcasecmp(&filename[strlen(filename)- + strlen(exttypes[i].extension)], + exttypes[i].extension) == 0) + { + menu[cnt].desc = exttypes[i].type->plugin; + cnt++; + if (cnt == max_items) + break; + } } } + return cnt; } diff --git a/apps/filetypes.h b/apps/filetypes.h index e72dd6ffd3..fd1e07721e 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h @@ -32,7 +32,7 @@ int filetype_get_icon(int); char* filetype_get_plugin(const struct entry*); void filetype_init(void); bool filetype_supported(int); -int filetype_load_menu(struct menu_item*, int); +int filetype_load_menu(struct menu_item*, int, char*); int filetype_load_plugin(const char*, char*); struct file_type { diff --git a/apps/onplay.c b/apps/onplay.c index 7ebe4e1f45..9267c2341b 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -56,7 +56,7 @@ static bool list_viewers(void) int m, i, result; int ret = 0; - i=filetype_load_menu(menu,sizeof(menu)/sizeof(*menu)); + i=filetype_load_menu(menu,sizeof(menu)/sizeof(*menu),selected_file); if (i) { m = menu_init( menu, i, NULL, NULL, NULL, NULL );