Database & Playlist Viewer: Fix return to WPS from plugin

After calling up PictureFlow from the database or from the
Playlist Viewer, you would not be returned to the WPS as
would be expected when picking a new song, selecting
"Go to WPS" or pressing the WPS action button.

Change-Id: I902ac9185ebe092d0c4c08804db0a813a32cc39c
This commit is contained in:
Christian Soffke 2022-11-19 16:15:22 +01:00
parent b3a464c9d1
commit dcde5aa89d
3 changed files with 44 additions and 10 deletions

View file

@ -618,7 +618,7 @@ int filetype_list_viewers(const char* current_file)
int i = viewers[info.selection];
snprintf(plugin, MAX_PATH, "%s/%s." ROCK_EXTENSION,
PLUGIN_DIR, filetypes[i].plugin);
plugin_load(plugin, current_file);
ret = plugin_load(plugin, current_file);
}
return ret;
}

View file

@ -1558,6 +1558,8 @@ static bool onplay_load_plugin(void *param)
onplay_result = ONPLAY_RELOAD_DIR;
else if (ret == PLUGIN_GOTO_PLUGIN)
onplay_result = ONPLAY_PLUGIN;
else if (ret == PLUGIN_GOTO_WPS)
onplay_result = ONPLAY_START_PLAY;
return false;
}
@ -1818,6 +1820,14 @@ static int playlist_insert_shuffled(void)
return ONPLAY_RELOAD_DIR;
}
static int tree_hotkey_run_plugin(void *param)
{
if (filetype_load_plugin((const char*)param, selected_file) == PLUGIN_GOTO_WPS)
return ONPLAY_START_PLAY;
return ONPLAY_RELOAD_DIR;
}
static void hotkey_run_plugin(void)
{
open_plugin_run(ID2P(LANG_HOTKEY_WPS));
@ -1866,12 +1876,12 @@ static struct hotkey_assignment hotkey_items[] = {
HOTKEY_FUNC(bookmark_create_menu, NULL),
ONPLAY_OK },
{ HOTKEY_PROPERTIES, LANG_PROPERTIES,
HOTKEY_FUNC(onplay_load_plugin, (void *)"properties"),
ONPLAY_RELOAD_DIR },
HOTKEY_FUNC(tree_hotkey_run_plugin, (void *)"properties"),
ONPLAY_OK },
#ifdef HAVE_TAGCACHE
{ HOTKEY_PICTUREFLOW, LANG_ONPLAY_PICTUREFLOW,
HOTKEY_FUNC(onplay_load_plugin, (void *)"pictureflow"),
ONPLAY_RELOAD_DIR },
HOTKEY_FUNC(tree_hotkey_run_plugin, (void *)"pictureflow"),
ONPLAY_OK },
#endif
};

View file

@ -76,6 +76,7 @@ enum direction
enum pv_onplay_result {
PV_ONPLAY_USB,
PV_ONPLAY_USB_CLOSED,
PV_ONPLAY_WPS_CLOSED,
PV_ONPLAY_CLOSED,
PV_ONPLAY_ITEM_REMOVED,
PV_ONPLAY_CHANGED,
@ -519,9 +520,17 @@ static enum pv_onplay_result open_with(const struct playlist_entry *current_trac
strmemccpy(selected_track, current_track->name, sizeof(selected_track));
int plugin_return = filetype_list_viewers(selected_track);
return (filetype_list_viewers(selected_track) ==
PLUGIN_USB_CONNECTED ? PV_ONPLAY_USB_CLOSED : PV_ONPLAY_CLOSED);
switch (plugin_return)
{
case PLUGIN_USB_CONNECTED:
return PV_ONPLAY_USB_CLOSED;
case PLUGIN_GOTO_WPS:
return PV_ONPLAY_WPS_CLOSED;
default:
return PV_ONPLAY_CLOSED;
}
}
#endif /* HAVE_HOTKEY */
@ -533,8 +542,17 @@ static enum pv_onplay_result open_pictureflow(const struct playlist_entry *curre
strmemccpy(selected_track, current_track->name, sizeof(selected_track));
return (filetype_load_plugin((void *)"pictureflow", selected_track) ==
PLUGIN_USB_CONNECTED ? PV_ONPLAY_USB_CLOSED : PV_ONPLAY_CLOSED);
int plugin_return = filetype_load_plugin((void *)"pictureflow", selected_track);
switch (plugin_return)
{
case PLUGIN_USB_CONNECTED:
return PV_ONPLAY_USB_CLOSED;
case PLUGIN_GOTO_WPS:
return PV_ONPLAY_WPS_CLOSED;
default:
return PV_ONPLAY_CLOSED;
}
}
#endif
@ -959,6 +977,8 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename)
}
else if (pv_onplay_result == PV_ONPLAY_USB_CLOSED)
return PLAYLIST_VIEWER_USB;
else if (pv_onplay_result == PV_ONPLAY_WPS_CLOSED)
return PLAYLIST_VIEWER_OK;
else if (pv_onplay_result == PV_ONPLAY_CLOSED)
{
if (!open_playlist_viewer(filename, &playlist_lists, true))
@ -1004,8 +1024,12 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename)
if (do_plugin != NULL)
{
if (do_plugin(current_track) == PV_ONPLAY_USB_CLOSED)
int plugin_result = do_plugin(current_track);
if (plugin_result == PV_ONPLAY_USB_CLOSED)
return PLAYLIST_VIEWER_USB;
else if (plugin_result == PV_ONPLAY_WPS_CLOSED)
return PLAYLIST_VIEWER_OK;
else if (!open_playlist_viewer(filename, &playlist_lists, true))
{
ret = PLAYLIST_VIEWER_CANCEL;