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; 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; context = CONTEXT_STD;
ctx_current_playlist_insert = playlist_insert_cb; ctx_current_playlist_insert = playlist_insert_cb;
selected_file = path; selected_file = path;
if (dir_exists(path)) selected_file_attr = attr;
selected_file_attr = ATTR_DIRECTORY;
else
selected_file_attr = filetype_get_attr(path);
in_queue_submenu = false; in_queue_submenu = false;
do_menu(&tree_playlist_menu, NULL, NULL, 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 */ /* needed for the playlist viewer.. eventually clean this up */
void onplay_show_playlist_cat_menu(const char* track_name, int attr, void onplay_show_playlist_cat_menu(const char* track_name, int attr,
void (*add_to_pl_cb)); 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 #endif

View file

@ -634,7 +634,7 @@ static enum pv_onplay_result onplay_menu(int index)
{ {
case 0: case 0:
/* playlist */ /* playlist */
onplay_show_playlist_menu(current_track->name, NULL); onplay_show_playlist_menu(current_track->name, FILE_ATTR_AUDIO, NULL);
ret = PV_ONPLAY_UNCHANGED; ret = PV_ONPLAY_UNCHANGED;
break; break;
case 1: 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 * when this happens please take the opportunity to sort in
* any new functions "waiting" at the end of the list. * 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 */ /* 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_current_file)(const char* path);
void (*set_dirfilter)(int l_dirfilter); 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 (*onplay_show_playlist_cat_menu)(const char* track_name, int attr,
void (*add_to_pl_cb)); void (*add_to_pl_cb));
bool (*browse_id3)(struct mp3entry *id3, bool (*browse_id3)(struct mp3entry *id3,

View file

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

View file

@ -640,7 +640,10 @@ int do_shortcut_menu(void *ignored)
} }
else 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; break;
case SHORTCUT_FILE: case SHORTCUT_FILE: