Simplify menu_list_get_entry

This commit is contained in:
twinaphex 2015-05-07 10:15:33 +02:00
parent 290bff0097
commit fa5ef2e750
7 changed files with 13 additions and 16 deletions

View File

@ -286,7 +286,7 @@ static void glui_render(void)
static void glui_render_menu_list(runloop_t *runloop,
glui_handle_t *glui, menu_handle_t *menu,
const char *label, uint32_t normal_color,
uint32_t normal_color,
uint32_t hover_color)
{
size_t i = 0;
@ -305,7 +305,7 @@ static void glui_render_menu_list(runloop_t *runloop,
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH];
bool selected = false;
menu_list_get_entry(&entry, i, label, NULL);
menu_list_get_entry(&entry, i, NULL);
selected = menu_list_entry_is_currently_selected(&entry);
menu_animation_ticker_line(entry_title_buf, glui->ticker_limit,
@ -381,8 +381,7 @@ static void glui_frame(void)
menu_display_font_bind_block(menu, font_driver, &glui->list_block);
glui_render_menu_list(runloop, glui, menu,
label, normal_color, hover_color);
glui_render_menu_list(runloop, glui, menu, normal_color, hover_color);
menu_display_font_flush_block(menu, font_driver);

View File

@ -493,7 +493,7 @@ static void rgui_render(void)
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH];
bool selected = false;
menu_list_get_entry(&entry, i, label, NULL);
menu_list_get_entry(&entry, i, NULL);
selected = menu_list_entry_is_currently_selected(&entry);
if (i > (menu->navigation.selection_ptr + 100))

View File

@ -234,7 +234,7 @@ static void rmenu_render(void)
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH];
bool selected = false;
menu_list_get_entry(&entry, i, label, NULL);
menu_list_get_entry(&entry, i, NULL);
selected = menu_list_entry_is_currently_selected(&entry);
menu_animation_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (entry.spacing + 1 + 2),

View File

@ -605,7 +605,7 @@ static void rmenu_xui_render(void)
menu_entry_t entry;
wchar_t msg_left[PATH_MAX_LENGTH], msg_right[PATH_MAX_LENGTH];
menu_list_get_entry(&entry, i, label, NULL);
menu_list_get_entry(&entry, i, NULL);
mbstowcs(msg_left, entry.path, sizeof(msg_left) / sizeof(wchar_t));
mbstowcs(msg_right, entry.value, sizeof(msg_right) / sizeof(wchar_t));

View File

@ -1020,7 +1020,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
icon_y > global->video_data.height + xmb->icon.size)
continue;
menu_list_get_entry(&entry, i, label, list);
menu_list_get_entry(&entry, i, list);
if (entry.type == MENU_FILE_CONTENTLIST_ENTRY)
strlcpy(entry.path, path_basename(entry.path), sizeof(entry.path));

View File

@ -447,9 +447,9 @@ 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)
void menu_list_get_entry(menu_entry_t *entry, size_t i, void *userdata)
{
const char *label = NULL;
const char *path = NULL;
const char *entry_label = NULL;
menu_file_list_cbs_t *cbs = NULL;
@ -458,6 +458,8 @@ void menu_list_get_entry(menu_entry_t *entry, size_t i,
if (!menu_list)
return;
menu_list_get_last_stack(menu_list, NULL, &label, NULL);
list = userdata ? (file_list_t*)userdata : menu_list->selection_buf;
@ -496,13 +498,10 @@ int menu_list_get_current_entry_id(void)
menu_list_t *menu_list = menu_list_get_ptr();
size_t end = menu_list_get_size(menu_list);
menu_list_get_last_stack(menu_list,
NULL, &label, NULL);
for (i = 0; i < end; i++)
{
menu_entry_t entry;
menu_list_get_entry(&entry, i, label, NULL);
menu_list_get_entry(&entry, i, NULL);
if (menu_list_entry_is_currently_selected(&entry))
return i;

View File

@ -107,8 +107,7 @@ 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);
void menu_list_get_entry(menu_entry_t *entry, size_t i, void *userdata);
int menu_list_get_current_entry_id(void);