More refactoring / getting rid of code duplication
This commit is contained in:
parent
bcca74e266
commit
3ca29e8cea
|
@ -245,12 +245,7 @@ int menu_entries_push_horizontal_menu_list(menu_handle_t *menu,
|
||||||
MENU_FILE_CONTENTLIST_ENTRY,
|
MENU_FILE_CONTENTLIST_ENTRY,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
driver.menu->scroll_indices_size = 0;
|
menu_list_populate_generic(menu, list, path, label, menu_type);
|
||||||
menu_entries_build_scroll_indices(list);
|
|
||||||
menu_entries_refresh(list);
|
|
||||||
|
|
||||||
if (driver.menu_ctx && driver.menu_ctx->populate_entries)
|
|
||||||
driver.menu_ctx->populate_entries(menu, path, label, menu_type);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -499,12 +494,7 @@ int menu_entries_parse_list(
|
||||||
menu_list_sort_on_alt(list);
|
menu_list_sort_on_alt(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.menu->scroll_indices_size = 0;
|
menu_list_populate_generic(driver.menu, list, dir, label, type);
|
||||||
menu_entries_build_scroll_indices(list);
|
|
||||||
menu_entries_refresh(list);
|
|
||||||
|
|
||||||
if (driver.menu_ctx && driver.menu_ctx->populate_entries)
|
|
||||||
driver.menu_ctx->populate_entries(driver.menu, dir, label, type);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1622,7 +1622,7 @@ static int deferred_push_core_list_deferred(void *data, void *userdata,
|
||||||
|
|
||||||
menu_list_sort_on_alt(list);
|
menu_list_sort_on_alt(list);
|
||||||
|
|
||||||
menu_list_populate_generic(list, path, label, type);
|
menu_list_populate_generic(driver.menu, list, path, label, type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1642,7 +1642,7 @@ static int deferred_push_database_manager_list_deferred(void *data, void *userda
|
||||||
|
|
||||||
menu_list_sort_on_alt(list);
|
menu_list_sort_on_alt(list);
|
||||||
|
|
||||||
menu_list_populate_generic(list, path, label, type);
|
menu_list_populate_generic(driver.menu, list, path, label, type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2307,7 +2307,7 @@ static int deferred_push_core_manager_list(void *data, void *userdata,
|
||||||
0, 0);
|
0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
menu_list_populate_generic(list, path, label, type);
|
menu_list_populate_generic(driver.menu, list, path, label, type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2363,7 +2363,7 @@ static int deferred_push_history_list(void *data, void *userdata,
|
||||||
MENU_FILE_PLAYLIST_ENTRY, 0);
|
MENU_FILE_PLAYLIST_ENTRY, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_list_populate_generic(list, path, label, type);
|
menu_list_populate_generic(driver.menu, list, path, label, type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2390,7 +2390,7 @@ static int deferred_push_content_actions(void *data, void *userdata,
|
||||||
menu_list_push(list, "Reset", "restart_content", MENU_SETTING_ACTION_RESET, 0);
|
menu_list_push(list, "Reset", "restart_content", MENU_SETTING_ACTION_RESET, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_list_populate_generic(list, path, label, type);
|
menu_list_populate_generic(driver.menu, list, path, label, type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,15 +306,21 @@ void menu_list_sort_on_alt(file_list_t *list)
|
||||||
file_list_sort_on_alt(list);
|
file_list_sort_on_alt(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
int menu_list_populate_generic(file_list_t *list, const char *path,
|
int menu_list_populate_generic(void *data,
|
||||||
|
file_list_t *list, const char *path,
|
||||||
const char *label, unsigned type)
|
const char *label, unsigned type)
|
||||||
{
|
{
|
||||||
|
menu_handle_t *menu = (menu_handle_t*)data;
|
||||||
|
|
||||||
|
if (!menu)
|
||||||
|
return -1;
|
||||||
|
|
||||||
driver.menu->scroll_indices_size = 0;
|
driver.menu->scroll_indices_size = 0;
|
||||||
menu_entries_build_scroll_indices(list);
|
menu_entries_build_scroll_indices(list);
|
||||||
menu_entries_refresh(list);
|
menu_entries_refresh(list);
|
||||||
|
|
||||||
if (driver.menu_ctx && driver.menu_ctx->populate_entries)
|
if (driver.menu_ctx && driver.menu_ctx->populate_entries)
|
||||||
driver.menu_ctx->populate_entries(driver.menu, path, label, type);
|
driver.menu_ctx->populate_entries(menu, path, label, type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@ void menu_list_get_alt_at_offset(const file_list_t *list, size_t idx,
|
||||||
void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,
|
void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,
|
||||||
const char *alt);
|
const char *alt);
|
||||||
|
|
||||||
int menu_list_populate_generic(file_list_t *list, const char *path,
|
int menu_list_populate_generic(void *data, file_list_t *list,
|
||||||
const char *label, unsigned type);
|
const char *path, const char *label, unsigned type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue