diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetypes.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c index ed90be755f..d68bab3daa 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -601,32 +601,25 @@ static int openwith_get_talk(int selected_item, void * data) | |||
601 | return 0; | 601 | return 0; |
602 | } | 602 | } |
603 | 603 | ||
604 | static int openwith_action_callback(int action, struct gui_synclist *lists) | ||
605 | { | ||
606 | struct cb_data *info = (struct cb_data *)lists->data; | ||
607 | int i; | ||
608 | if (action == ACTION_STD_OK) | ||
609 | { | ||
610 | char plugin[MAX_PATH]; | ||
611 | i = viewers[gui_synclist_get_sel_pos(lists)]; | ||
612 | snprintf(plugin, MAX_PATH, "%s/%s." ROCK_EXTENSION, | ||
613 | PLUGIN_DIR, filetypes[i].plugin); | ||
614 | plugin_load(plugin, info->current_file); | ||
615 | return ACTION_STD_CANCEL; | ||
616 | } | ||
617 | return action; | ||
618 | } | ||
619 | |||
620 | int filetype_list_viewers(const char* current_file) | 604 | int filetype_list_viewers(const char* current_file) |
621 | { | 605 | { |
622 | struct simplelist_info info; | 606 | struct simplelist_info info; |
623 | struct cb_data data = { current_file }; | 607 | simplelist_info_init(&info, str(LANG_ONPLAY_OPEN_WITH), viewer_count, NULL); |
624 | simplelist_info_init(&info, str(LANG_ONPLAY_OPEN_WITH), viewer_count, &data); | ||
625 | info.action_callback = openwith_action_callback; | ||
626 | info.get_name = openwith_get_name; | 608 | info.get_name = openwith_get_name; |
627 | info.get_icon = global_settings.show_icons?openwith_get_icon:NULL; | 609 | info.get_icon = global_settings.show_icons?openwith_get_icon:NULL; |
628 | info.get_talk = openwith_get_talk; | 610 | info.get_talk = openwith_get_talk; |
629 | return simplelist_show_list(&info); | 611 | |
612 | int ret = simplelist_show_list(&info); | ||
613 | |||
614 | if (info.selection >= 0) /* run user selected viewer */ | ||
615 | { | ||
616 | char plugin[MAX_PATH]; | ||
617 | int i = viewers[info.selection]; | ||
618 | snprintf(plugin, MAX_PATH, "%s/%s." ROCK_EXTENSION, | ||
619 | PLUGIN_DIR, filetypes[i].plugin); | ||
620 | plugin_load(plugin, current_file); | ||
621 | } | ||
622 | return ret; | ||
630 | } | 623 | } |
631 | 624 | ||
632 | int filetype_load_plugin(const char* plugin, const char* file) | 625 | int filetype_load_plugin(const char* plugin, const char* file) |