PictureFlow: Make Shuffle options available

The "Playing Next..." menu couldn't display any
options for shuffling tracks of an album before

Change-Id: I54f4497394fb29877bf8bce0ef95a27c82eb2279
This commit is contained in:
Christian Soffke 2023-05-26 03:24:45 +02:00
parent 028eafaeef
commit 3ef49d9c5e
6 changed files with 18 additions and 16 deletions

View file

@ -828,15 +828,12 @@ static int treeplaylist_callback(int action,
return action;
}
void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb))
void onplay_show_playlist_menu(const char* path, int attr, void (*playlist_insert_cb))
{
context = CONTEXT_STD;
ctx_current_playlist_insert = playlist_insert_cb;
selected_file = path;
if (dir_exists(path))
selected_file_attr = ATTR_DIRECTORY;
else
selected_file_attr = filetype_get_attr(path);
selected_file_attr = attr;
in_queue_submenu = false;
do_menu(&tree_playlist_menu, NULL, NULL, false);
}

View file

@ -78,6 +78,6 @@ const struct hotkey_assignment *get_hotkey(int action);
/* needed for the playlist viewer.. eventually clean this up */
void onplay_show_playlist_cat_menu(const char* track_name, int attr,
void (*add_to_pl_cb));
void onplay_show_playlist_menu(const char* path, void (*playlist_insert_cb));
void onplay_show_playlist_menu(const char* path, int attr, void (*playlist_insert_cb));
#endif

View file

@ -634,7 +634,7 @@ static enum pv_onplay_result onplay_menu(int index)
{
case 0:
/* playlist */
onplay_show_playlist_menu(current_track->name, NULL);
onplay_show_playlist_menu(current_track->name, FILE_ATTR_AUDIO, NULL);
ret = PV_ONPLAY_UNCHANGED;
break;
case 1:

View file

@ -162,7 +162,7 @@ int plugin_open(const char *plugin, const char *parameter);
* when this happens please take the opportunity to sort in
* any new functions "waiting" at the end of the list.
*/
#define PLUGIN_API_VERSION 268
#define PLUGIN_API_VERSION 269
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@ -495,7 +495,7 @@ struct plugin_api {
void (*set_current_file)(const char* path);
void (*set_dirfilter)(int l_dirfilter);
void (*onplay_show_playlist_menu)(const char* path, void (*playlist_insert_cb));
void (*onplay_show_playlist_menu)(const char* path, int attr, void (*playlist_insert_cb));
void (*onplay_show_playlist_cat_menu)(const char* track_name, int attr,
void (*add_to_pl_cb));
bool (*browse_id3)(struct mp3entry *id3,

View file

@ -4188,7 +4188,7 @@ static int context_menu(void)
{
char album_name[MAX_PATH];
char *file_name = get_track_filename(show_tracks_while_browsing ? 0 : pf_tracks.sel);
int attr;
int attr = FILE_ATTR_AUDIO;
enum {
PF_CURRENT_PLAYLIST = 0,
@ -4205,13 +4205,15 @@ static int context_menu(void)
NULL, NULL, false)) {
case PF_CURRENT_PLAYLIST:
rb->onplay_show_playlist_menu(file_name,
&pf_current_playlist_insert);
if (insert_whole_album && pf_tracks.count > 1)
{
attr = ATTR_DIRECTORY;
file_name = NULL;
}
rb->onplay_show_playlist_menu(file_name, attr, &pf_current_playlist_insert);
return 0;
case PF_CATALOG:
if (!insert_whole_album)
attr = FILE_ATTR_AUDIO;
else
if (insert_whole_album)
{
/* add a leading slash so that catalog_add_to_a_playlist
later prefills the name when creating a new playlist */

View file

@ -640,7 +640,10 @@ int do_shortcut_menu(void *ignored)
}
else
{
onplay_show_playlist_menu(sc->u.path, NULL);
onplay_show_playlist_menu(sc->u.path,
dir_exists(sc->u.path) ? ATTR_DIRECTORY :
filetype_get_attr(sc->u.path),
NULL);
}
break;
case SHORTCUT_FILE: