From 23135e3c92553fb751c57ee3c72f723e9d66e5f7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 12 May 2015 10:45:37 +0200 Subject: [PATCH] Create menu_displaylist_push --- menu/menu_displaylist.c | 48 +++++++++++++++++++++-------------------- menu/menu_displaylist.h | 2 +- menu/menu_entries.c | 11 ++++++++-- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 80450ccd43..ff6f40168d 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -19,6 +19,31 @@ #include "menu_displaylist.h" #include "menu_navigation.h" + +int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) +{ + menu_handle_t *menu = menu_driver_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); + menu_navigation_t *nav = menu_navigation_get_ptr(); + + switch (type) + { + case DISPLAYLIST_NONE: + break; + case DISPLAYLIST_MAIN_MENU: + menu->list_settings = setting_new(SL_FLAG_ALL); + + menu_list_push(menu_list->menu_stack, + info->path, info->label, info->type, info->flags); + menu_navigation_clear(nav, true); + menu_entries_push_list(menu, info->list, + info->path, info->label, info->type, info->flags); + break; + } + + return 0; +} + int menu_displaylist_deferred_push(menu_displaylist_info_t *info) { unsigned type = 0; @@ -47,29 +72,6 @@ int menu_displaylist_deferred_push(menu_displaylist_info_t *info) return cbs->action_deferred_push(info->list, info->menu_list, path, label, type); } -int menu_displaylist_push_list(unsigned type) -{ - menu_handle_t *menu = menu_driver_get_ptr(); - menu_list_t *menu_list = menu_list_get_ptr(); - menu_navigation_t *nav = menu_navigation_get_ptr(); - - switch (type) - { - case DISPLAYLIST_NONE: - break; - case DISPLAYLIST_MAIN_MENU: - menu->list_settings = setting_new(SL_FLAG_ALL); - - menu_list_push(menu_list->menu_stack, "", "Main Menu", MENU_SETTINGS, 0); - menu_navigation_clear(nav, true); - menu_entries_push_list(menu, menu_list->selection_buf, - "", "Main Menu", 0, SL_FLAG_MAIN_MENU); - break; - } - - return 0; -} - int menu_displaylist_push(file_list_t *list, file_list_t *menu_list) { int ret; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index a070b8ab86..b3cc652b0d 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -42,7 +42,7 @@ typedef struct menu_displaylist_info int menu_displaylist_deferred_push(menu_displaylist_info_t *info); -int menu_displaylist_push_list(unsigned type); +int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type); int menu_displaylist_push(file_list_t *list, file_list_t *menu_list); diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 5a6fb36ef3..5f7010796f 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -495,10 +495,17 @@ int menu_entries_parse_list( **/ bool menu_entries_init(menu_handle_t *menu) { - if (!menu) + menu_list_t *menu_list = menu_list_get_ptr(); + menu_displaylist_info_t info = {0}; + if (!menu || !menu_list) return false; - menu_displaylist_push_list(DISPLAYLIST_MAIN_MENU); + info.list = menu_list->selection_buf; + info.type = MENU_SETTINGS; + info.flags = SL_FLAG_MAIN_MENU; + strlcpy(info.label, "Main Menu", sizeof(info.label)); + + menu_displaylist_push_list(&info, DISPLAYLIST_MAIN_MENU); return true; }