mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
file tree filetype_list_viewers exit from list before execution
no need to do a callback just to exit the list right after executing a viewer plugin Change-Id: I4598ab189bd7d1f350156af75480cbe7103e9e4c
This commit is contained in:
parent
af573708ed
commit
cf96a4d386
1 changed files with 13 additions and 20 deletions
|
@ -601,32 +601,25 @@ static int openwith_get_talk(int selected_item, void * data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int openwith_action_callback(int action, struct gui_synclist *lists)
|
|
||||||
{
|
|
||||||
struct cb_data *info = (struct cb_data *)lists->data;
|
|
||||||
int i;
|
|
||||||
if (action == ACTION_STD_OK)
|
|
||||||
{
|
|
||||||
char plugin[MAX_PATH];
|
|
||||||
i = viewers[gui_synclist_get_sel_pos(lists)];
|
|
||||||
snprintf(plugin, MAX_PATH, "%s/%s." ROCK_EXTENSION,
|
|
||||||
PLUGIN_DIR, filetypes[i].plugin);
|
|
||||||
plugin_load(plugin, info->current_file);
|
|
||||||
return ACTION_STD_CANCEL;
|
|
||||||
}
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
int filetype_list_viewers(const char* current_file)
|
int filetype_list_viewers(const char* current_file)
|
||||||
{
|
{
|
||||||
struct simplelist_info info;
|
struct simplelist_info info;
|
||||||
struct cb_data data = { current_file };
|
simplelist_info_init(&info, str(LANG_ONPLAY_OPEN_WITH), viewer_count, NULL);
|
||||||
simplelist_info_init(&info, str(LANG_ONPLAY_OPEN_WITH), viewer_count, &data);
|
|
||||||
info.action_callback = openwith_action_callback;
|
|
||||||
info.get_name = openwith_get_name;
|
info.get_name = openwith_get_name;
|
||||||
info.get_icon = global_settings.show_icons?openwith_get_icon:NULL;
|
info.get_icon = global_settings.show_icons?openwith_get_icon:NULL;
|
||||||
info.get_talk = openwith_get_talk;
|
info.get_talk = openwith_get_talk;
|
||||||
return simplelist_show_list(&info);
|
|
||||||
|
int ret = simplelist_show_list(&info);
|
||||||
|
|
||||||
|
if (info.selection >= 0) /* run user selected viewer */
|
||||||
|
{
|
||||||
|
char plugin[MAX_PATH];
|
||||||
|
int i = viewers[info.selection];
|
||||||
|
snprintf(plugin, MAX_PATH, "%s/%s." ROCK_EXTENSION,
|
||||||
|
PLUGIN_DIR, filetypes[i].plugin);
|
||||||
|
plugin_load(plugin, current_file);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int filetype_load_plugin(const char* plugin, const char* file)
|
int filetype_load_plugin(const char* plugin, const char* file)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue