Create menu_list_get_entry

This commit is contained in:
twinaphex 2015-05-07 04:47:32 +02:00
parent a13442625b
commit 7004451e54
3 changed files with 30 additions and 23 deletions

View File

@ -214,32 +214,10 @@ bool menu_display_setting_label(
const char *label,
void *userdata)
{
menu_file_list_cbs_t *cbs = NULL;
const char *entry_label = NULL;
const char *path = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
file_list_t *list = userdata ? (file_list_t*)userdata
: menu->menu_list->selection_buf;
if (!entry)
return false;
menu_list_get_at_offset(list, i, &path, &entry_label, &entry->type);
cbs = (menu_file_list_cbs_t*)
menu_list_get_actiondata_at_offset(list,
i);
if (cbs && cbs->action_get_representation)
cbs->action_get_representation(list,
&entry->spacing, entry->type, i, label,
entry->value, sizeof(entry->value),
entry_label, path,
entry->path, sizeof(entry->path));
if (entry_label)
strlcpy(entry->label, entry_label, sizeof(entry->label));
menu_list_get_entry(entry, i, label, userdata);
#if 0
RARCH_LOG("Entry label : %s\n", entry->label ? entry->label : "N/A");
RARCH_LOG("Entry path : %s\n", entry->path);

View File

@ -443,3 +443,29 @@ int menu_list_populate_generic(file_list_t *list, const char *path,
return 0;
}
void menu_list_get_entry(menu_entry_t *entry, size_t i,
const char *label, void *userdata)
{
const char *path = NULL;
const char *entry_label = NULL;
menu_file_list_cbs_t *cbs = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
file_list_t *list = userdata ? (file_list_t*)userdata
: menu->menu_list->selection_buf;
menu_list_get_at_offset(list, i, &path, &entry_label, &entry->type);
cbs = (menu_file_list_cbs_t*)
menu_list_get_actiondata_at_offset(list,
i);
if (cbs && cbs->action_get_representation)
cbs->action_get_representation(list,
&entry->spacing, entry->type, i, label,
entry->value, sizeof(entry->value),
entry_label, path,
entry->path, sizeof(entry->path));
if (entry_label)
strlcpy(entry->label, entry_label, sizeof(entry->label));
}

View File

@ -105,6 +105,9 @@ void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,
int menu_list_populate_generic(file_list_t *list,
const char *path, const char *label, unsigned type);
void menu_list_get_entry(menu_entry_t *entry, size_t i, const char *label,
void *userdata);
#ifdef __cplusplus
}
#endif