playlist catalog: sort independently from file browser

Allow independent sorting of playlists in the
playlist catalog, using the context menu.

You may want to usually sort playlists by their date
(modified), but sort audio tracks alphabetically.
This is now possible without having to constantly
adjust a setting.

The fact that 'Sort Files' applied to both the file
browser and playlist catalog seems more like a side
effect of the implementation, rather than behavior
that is wanted. Additionally, the 'By Type' sorting
makes no sense when only a single type is displayed.

Since many of the other File View settings don't
apply to the playlist catalog, hide the menu there.

Change-Id: Ic35038015d0860998ae117f472ce23ce3bc80cfa
This commit is contained in:
Christian Soffke 2025-04-18 20:37:51 +02:00 committed by Solomon Peachy
parent 6e06319988
commit 4346a1e8e7
10 changed files with 62 additions and 7 deletions

View file

@ -1132,6 +1132,23 @@ MAKE_ONPLAYMENU( wps_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE),
#endif
);
int sort_playlists_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{
(void) this_list;
(void) this_item;
if (action == ACTION_REQUEST_MENUITEM &&
*tree_get_context()->dirfilter != SHOW_M3U)
{
return ACTION_EXIT_MENUITEM;
}
return action;
}
MENUITEM_SETTING(sort_playlists, &global_settings.sort_playlists, sort_playlists_callback);
MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW),
view_playlist,
onplaymenu_callback, Icon_Playlist);
@ -1149,7 +1166,7 @@ MAKE_ONPLAYMENU( tree_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE),
#if LCD_DEPTH > 1
&set_backdrop_item,
#endif
&add_to_faves_item, &set_as_dir_menu, &file_menu,
&add_to_faves_item, &set_as_dir_menu, &file_menu, &sort_playlists,
);
static int onplaymenu_callback(int action,
const struct menu_item_ex *this_item,