(Menu) Create menu_list_new

This commit is contained in:
twinaphex 2014-10-18 00:11:42 +02:00
parent ed6fc11e95
commit ac61e0de3d
3 changed files with 22 additions and 1 deletions

View File

@ -148,7 +148,7 @@ static void disp_set_label(unsigned *w, unsigned type, unsigned i,
if (type == MENU_FILE_CORE)
{
strlcpy(type_str, "(CORE)", type_str_size);
file_list_get_alt_at_offset(driver.menu->selection_buf, i, &path);
menu_list_get_alt_at_offset(driver.menu->selection_buf, i, &path);
*w = 6;
}
else if (type == MENU_FILE_PLAIN)

View File

@ -48,6 +48,25 @@ void menu_list_free(menu_list_t *menu_list)
menu_list_destroy(menu_list->selection_buf);
}
void *menu_list_new(void)
{
menu_list_t *list = (menu_list_t*)calloc(1, sizeof(*list));
if (!list)
return NULL;
list->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
list->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
if (!list->menu_stack || !list->selection_buf)
{
free(list);
return NULL;
}
return list;
}
size_t menu_list_get_stack_size(void)
{
if (!driver.menu)

View File

@ -31,6 +31,8 @@ typedef struct menu_list
void menu_list_free(menu_list_t *menu_list);
void *menu_list_new(void);
void menu_list_destroy(file_list_t *list);
void menu_list_flush_stack(file_list_t *list,