Skip to content

Commit

Permalink
Add separate visibility toggle for playlist tabs (#17545)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos authored Feb 9, 2025
1 parent ad72af9 commit 372396d
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 9 deletions.
1 change: 1 addition & 0 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@
#define DEFAULT_MENU_CONTENT_SHOW_ADD_ENTRY MENU_ADD_CONTENT_ENTRY_DISPLAY_MAIN_TAB

#define DEFAULT_CONTENT_SHOW_PLAYLISTS true
#define DEFAULT_CONTENT_SHOW_PLAYLIST_TABS true

#if defined(HAVE_LIBRETRODB)
#define DEFAULT_MENU_CONTENT_SHOW_EXPLORE true
Expand Down
1 change: 1 addition & 0 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,7 @@ static struct config_bool_setting *populate_settings_bool(
#endif
SETTING_BOOL("content_show_history", &settings->bools.menu_content_show_history, true, DEFAULT_CONTENT_SHOW_HISTORY, false);
SETTING_BOOL("content_show_playlists", &settings->bools.menu_content_show_playlists, true, DEFAULT_CONTENT_SHOW_PLAYLISTS, false);
SETTING_BOOL("content_show_playlist_tabs", &settings->bools.menu_content_show_playlist_tabs, true, DEFAULT_CONTENT_SHOW_PLAYLIST_TABS, false);
#if defined(HAVE_LIBRETRODB)
SETTING_BOOL("content_show_explore", &settings->bools.menu_content_show_explore, true, DEFAULT_MENU_CONTENT_SHOW_EXPLORE, false);
#endif
Expand Down
1 change: 1 addition & 0 deletions configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ typedef struct settings
bool menu_content_show_history;
bool menu_content_show_add;
bool menu_content_show_playlists;
bool menu_content_show_playlist_tabs;
bool menu_content_show_explore;
bool menu_use_preferred_system_color_theme;
bool menu_preferred_system_color_theme_set;
Expand Down
10 changes: 9 additions & 1 deletion intl/msg_hash_us.h
Original file line number Diff line number Diff line change
Expand Up @@ -6585,7 +6585,15 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS,
"Show the playlists. (Restart required on Ozone/XMB)"
"Show the playlists in Main Menu. Ignored in GLUI if playlist tabs and navbar are enabled."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLIST_TABS,
"Show Playlist Tabs"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLIST_TABS,
"Show the playlist tabs. Does not affect RGUI. Navbar must be enabled in GLUI. (Restart required on Ozone/XMB)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_EXPLORE,
Expand Down
6 changes: 5 additions & 1 deletion menu/cbs/menu_cbs_sublabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,8 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_settings_tab_enable_password,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_history_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_import_content_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_import_content_entry, MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD_ENTRY)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_playlist_tabs, MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_playlists_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_playlist_tabs, MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLIST_TABS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_explore_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_EXPLORE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_contentless_cores_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_CONTENTLESS_CORES)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_main_menu_enable_settings, MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS)
Expand Down Expand Up @@ -2823,6 +2824,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_import_content_entry);
break;
case MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_playlists_tab);
break;
case MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLIST_TABS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_playlist_tabs);
break;
case MENU_ENUM_LABEL_CONTENT_SHOW_EXPLORE:
Expand Down
2 changes: 1 addition & 1 deletion menu/drivers/materialui.c
Original file line number Diff line number Diff line change
Expand Up @@ -8466,7 +8466,7 @@ static void materialui_populate_nav_bar(materialui_handle_t *mui,
{
size_t menu_tab_index = 0;
bool menu_content_show_playlists =
settings->bools.menu_content_show_playlists;
settings->bools.menu_content_show_playlist_tabs;
/* Cache last active menu tab index */
mui->nav_bar.last_active_menu_tab_index = mui->nav_bar.active_menu_tab_index;

Expand Down
7 changes: 4 additions & 3 deletions menu/drivers/ozone.c
Original file line number Diff line number Diff line change
Expand Up @@ -4864,7 +4864,7 @@ static void ozone_init_horizontal_list(ozone_handle_t *ozone, settings_t *settin
size_t i, list_size;
menu_displaylist_info_t info;
const char *dir_playlist = settings->paths.directory_playlist;
bool menu_content_show_playlists = settings->bools.menu_content_show_playlists;
bool menu_content_show_playlists = settings->bools.menu_content_show_playlist_tabs;
bool ozone_truncate_playlist_name = settings->bools.ozone_truncate_playlist_name;
bool ozone_sort_after_truncate = settings->bools.ozone_sort_after_truncate_playlist_name;

Expand Down Expand Up @@ -5943,8 +5943,9 @@ static void ozone_draw_entries(
else if (ozone->depth == 2 && entry.type == FILE_TYPE_PLAYLIST_COLLECTION)
{
ozone_node_t *sidebar_node = (ozone_node_t*)
file_list_get_userdata_at_offset(&ozone->horizontal_list,
selection_buf->list[i].entry_idx);
(ozone->horizontal_list.size)
? file_list_get_userdata_at_offset(&ozone->horizontal_list, selection_buf->list[i].entry_idx)
: NULL;

if (sidebar_node && sidebar_node->icon)
texture = sidebar_node->icon;
Expand Down
8 changes: 6 additions & 2 deletions menu/drivers/xmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,7 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb)
menu_displaylist_info_t info;
settings_t *settings = config_get_ptr();
const char *dir_playlist = settings->paths.directory_playlist;
bool menu_content_show_playlists = settings->bools.menu_content_show_playlists;
bool menu_content_show_playlists = settings->bools.menu_content_show_playlist_tabs;
bool truncate_playlist_name = settings->bools.ozone_truncate_playlist_name;
bool sort_after_truncate = settings->bools.ozone_sort_after_truncate_playlist_name;

Expand Down Expand Up @@ -5045,7 +5045,11 @@ static int xmb_draw_item(
/* "Main Menu" playlists */
else if (xmb->depth == 2 && entry_type == FILE_TYPE_PLAYLIST_COLLECTION)
{
xmb_node_t *sidebar_node = (xmb_node_t*) file_list_get_userdata_at_offset(&xmb->horizontal_list, list->list[i].entry_idx);
xmb_node_t *sidebar_node = (xmb_node_t*)
(xmb->horizontal_list.size)
? file_list_get_userdata_at_offset(&xmb->horizontal_list, list->list[i].entry_idx)
: NULL;

if (sidebar_node && sidebar_node->icon)
texture = sidebar_node->icon;
}
Expand Down
4 changes: 3 additions & 1 deletion menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -10015,6 +10015,7 @@ unsigned menu_displaylist_build_list(
#endif
{MENU_ENUM_LABEL_CONTENT_SHOW_ADD_ENTRY, PARSE_ONLY_UINT, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLISTS, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLIST_TABS, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_HISTORY, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_CONTENT_SHOW_IMAGES, PARSE_ONLY_BOOL, true },
Expand Down Expand Up @@ -14913,7 +14914,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
&& !settings->bools.menu_materialui_show_nav_bar));

if ( string_is_equal(menu_ident, "glui")
&& settings->bools.menu_materialui_show_nav_bar)
&& settings->bools.menu_materialui_show_nav_bar
&& settings->bools.menu_content_show_playlist_tabs)
show_playlists = false;

if (flags & RUNLOOP_FLAG_CORE_RUNNING)
Expand Down
15 changes: 15 additions & 0 deletions menu/menu_setting.c
Original file line number Diff line number Diff line change
Expand Up @@ -19657,6 +19657,21 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);

CONFIG_BOOL(
list, list_info,
&settings->bools.menu_content_show_playlist_tabs,
MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLIST_TABS,
MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLIST_TABS,
DEFAULT_CONTENT_SHOW_PLAYLIST_TABS,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);

#if defined(HAVE_LIBRETRODB)
CONFIG_BOOL(
list, list_info,
Expand Down
1 change: 1 addition & 0 deletions msg_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,7 @@ enum msg_hash_enums
MENU_LABEL(CONTENT_SHOW_ADD), /* Deprecated */
MENU_LABEL(CONTENT_SHOW_ADD_ENTRY),
MENU_LABEL(CONTENT_SHOW_PLAYLISTS),
MENU_LABEL(CONTENT_SHOW_PLAYLIST_TABS),
MENU_LABEL(CONTENT_SHOW_EXPLORE),
MENU_LABEL(CONTENT_SHOW_CONTENTLESS_CORES),
MENU_ENUM_LABEL_VALUE_SHOW_CONTENTLESS_CORES_ALL,
Expand Down

0 comments on commit 372396d

Please sign in to comment.