Create menu_displaylist_push

This commit is contained in:
twinaphex 2015-05-12 10:45:37 +02:00
parent a35c26b7a5
commit 23135e3c92
3 changed files with 35 additions and 26 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;
}