mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 12:41:00 +00:00
Start breaking up menu_displaylist_push_internal into separate
functions
This commit is contained in:
parent
c65fc21bac
commit
244b147b0c
@ -37,6 +37,20 @@ int action_refresh_default(file_list_t *list, file_list_t *menu_list)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int action_refresh_playlist(file_list_t *list, file_list_t *menu_list)
|
||||
{
|
||||
menu_displaylist_ctx_entry_t entry;
|
||||
if (!menu_list)
|
||||
return -1;
|
||||
|
||||
entry.list = list;
|
||||
entry.stack = menu_list;
|
||||
|
||||
if (!menu_displaylist_ctl(DISPLAYLIST_PUSH_PLAYLIST_ONTO_STACK, &entry))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int menu_cbs_init_bind_refresh(menu_file_list_cbs_t *cbs,
|
||||
const char *path, const char *label, unsigned type, size_t idx,
|
||||
const char *elem0, const char *elem1,
|
||||
|
@ -3195,37 +3195,6 @@ static bool menu_displaylist_push_internal(
|
||||
if (!menu_displaylist_ctl(DISPLAYLIST_SCAN_DIRECTORY_LIST, info))
|
||||
break;
|
||||
return true;
|
||||
case MENU_VALUE_PLAYLISTS_TAB:
|
||||
info->type = 42;
|
||||
strlcpy(info->exts, "lpl", sizeof(info->exts));
|
||||
strlcpy(info->label,
|
||||
menu_hash_to_str(MENU_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info->label));
|
||||
|
||||
if (string_is_empty(settings->directory.playlist))
|
||||
{
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
menu_entries_add(info->list,
|
||||
menu_hash_to_str(
|
||||
MENU_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE),
|
||||
menu_hash_to_str(
|
||||
MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE),
|
||||
MENU_INFO_MESSAGE, 0, 0);
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(
|
||||
info->path,
|
||||
settings->directory.playlist,
|
||||
sizeof(info->path));
|
||||
|
||||
if (!menu_displaylist_ctl(
|
||||
DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL, info))
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case MENU_VALUE_HORIZONTAL_MENU:
|
||||
if (!menu_displaylist_ctl(DISPLAYLIST_HORIZONTAL, info))
|
||||
break;
|
||||
@ -3235,6 +3204,82 @@ static bool menu_displaylist_push_internal(
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool menu_displaylist_push_internal_playlist(
|
||||
const char *label,
|
||||
menu_displaylist_ctx_entry_t *entry,
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
info->type = 42;
|
||||
strlcpy(info->exts, "lpl", sizeof(info->exts));
|
||||
strlcpy(info->label,
|
||||
menu_hash_to_str(MENU_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info->label));
|
||||
|
||||
if (string_is_empty(settings->directory.playlist))
|
||||
{
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
menu_entries_add(info->list,
|
||||
menu_hash_to_str(
|
||||
MENU_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE),
|
||||
menu_hash_to_str(
|
||||
MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE),
|
||||
MENU_INFO_MESSAGE, 0, 0);
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(
|
||||
info->path,
|
||||
settings->directory.playlist,
|
||||
sizeof(info->path));
|
||||
|
||||
if (!menu_displaylist_ctl(
|
||||
DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL, info))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool menu_displaylist_push_playlist(menu_displaylist_ctx_entry_t *entry)
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned type = 0;
|
||||
menu_displaylist_info_t info = {0};
|
||||
|
||||
if (!entry)
|
||||
return false;
|
||||
|
||||
menu_entries_get_last_stack(&path, &label, &type, NULL);
|
||||
|
||||
info.list = entry->list;
|
||||
info.menu_list = entry->stack;
|
||||
info.type = type;
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label, label, sizeof(info.label));
|
||||
|
||||
if (!info.list)
|
||||
return false;
|
||||
|
||||
if (menu_displaylist_push_internal_playlist(label, entry, &info))
|
||||
return menu_displaylist_push_list_process(&info);
|
||||
|
||||
cbs = menu_entries_get_last_stack_actiondata();
|
||||
|
||||
if (cbs && cbs->action_deferred_push)
|
||||
{
|
||||
if (cbs->action_deferred_push(&info) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry)
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
@ -3288,6 +3333,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
{
|
||||
case DISPLAYLIST_PROCESS:
|
||||
return menu_displaylist_push_list_process(info);
|
||||
case DISPLAYLIST_PUSH_PLAYLIST_ONTO_STACK:
|
||||
return menu_displaylist_push_playlist((menu_displaylist_ctx_entry_t*)data);
|
||||
case DISPLAYLIST_PUSH_ONTO_STACK:
|
||||
return menu_displaylist_push((menu_displaylist_ctx_entry_t*)data);
|
||||
default:
|
||||
|
@ -115,6 +115,7 @@ enum menu_displaylist_ctl_state
|
||||
DISPLAYLIST_CORE_CONTENT,
|
||||
DISPLAYLIST_PROCESS,
|
||||
DISPLAYLIST_PUSH_ONTO_STACK,
|
||||
DISPLAYLIST_PUSH_PLAYLIST_ONTO_STACK,
|
||||
DISPLAYLIST_PENDING_CLEAR
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user