Turn menu_list_pop into static function

This commit is contained in:
twinaphex 2015-09-05 00:50:17 +02:00
parent 94d7d7d1aa
commit 9a95f98283
6 changed files with 28 additions and 26 deletions

View File

@ -460,6 +460,7 @@ static int action_ok_playlist_entry(const char *path,
content_playlist_t *playlist = g_defaults.history;
bool is_history = true;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
uint32_t hash_label = menu_hash_calculate(label);
@ -517,7 +518,7 @@ static int action_ok_playlist_entry(const char *path,
{
case MENU_LABEL_COLLECTION:
case MENU_LABEL_RDB_ENTRY_START_CONTENT:
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
break;
default:
menu_list_flush_stack(menu_list, NULL, MENU_SETTINGS);
@ -869,8 +870,9 @@ static int action_ok_core_deferred_set(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char core_display_name[PATH_MAX_LENGTH];
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu || !menu_list)
return -1;
@ -888,7 +890,7 @@ static int action_ok_core_deferred_set(const char *path,
content_playlist_write_file(menu->playlist);
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
return -1;
}

View File

@ -33,10 +33,11 @@
/* Clicks the back button */
int menu_entry_go_back(void)
{
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu_list)
return -1;
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
return 0;
}

View File

@ -722,7 +722,7 @@ static int menu_input_mouse_frame(
}
if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_R))
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
if (BIT64_GET(input_mouse, MOUSE_ACTION_WHEEL_DOWN))
menu_navigation_increment(nav, 1);
@ -767,7 +767,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse,
if ((unsigned)menu_input->mouse.y < disp->header_height)
{
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
return 0;
}
if (
@ -830,6 +830,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
{
int ret = 0;
menu_display_t *disp = menu_display_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
menu_input_t *menu_input = menu_input_get_ptr();
settings_t *settings = config_get_ptr();
@ -880,7 +881,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
if (!menu_input->pointer.dragging)
{
if ((unsigned)menu_input->pointer.start_y < disp->header_height)
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
else if (menu_input->pointer.ptr <= menu_list_get_size(menu_list)-1)
{
menu_input->pointer.oldpressed[0] = false;
@ -904,7 +905,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
if (!menu_input->pointer.oldback)
{
menu_input->pointer.oldback = true;
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
}
}
menu_input->pointer.oldback = menu_input->pointer.back;

View File

@ -469,7 +469,7 @@ int menu_iterate(bool render_this_frame, unsigned action)
break;
case ITERATE_TYPE_BIND:
if (menu_input_bind_iterate(menu->state.msg, sizeof(menu->state.msg)))
menu_list_pop_stack(menu_list);
menu_list_pop_stack(menu_list, &nav->selection_ptr);
else
menu->state.do_messagebox = true;
if (render_this_frame)
@ -527,7 +527,7 @@ int menu_iterate(bool render_this_frame, unsigned action)
}
if (menu->state.do_pop_stack && action == MENU_ACTION_OK)
menu_list_pop(menu_list->menu_stack, menu->state.pop_selected);
menu_list_pop_stack(menu_list, menu->state.pop_selected);
if (menu->state.do_post_iterate)
menu_input_post_iterate(&ret, action);

View File

@ -133,6 +133,16 @@ static INLINE int menu_list_flush_stack_type(
return needle ? strcmp(needle, label) : (type != final_type);
}
static void menu_list_pop(file_list_t *list, size_t *directory_ptr)
{
if (list->size != 0)
menu_driver_list_free(list, list->size - 1, list->size - 1);
file_list_pop(list, directory_ptr);
menu_driver_list_set_selection(list);
}
void menu_list_flush_stack(menu_list_t *list,
const char *needle, unsigned final_type)
{
@ -157,9 +167,8 @@ void menu_list_flush_stack(menu_list_t *list,
}
}
void menu_list_pop_stack(menu_list_t *list)
void menu_list_pop_stack(menu_list_t *list, size_t *directory_ptr)
{
menu_navigation_t *nav = menu_navigation_get_ptr();
if (!list)
return;
@ -168,19 +177,10 @@ void menu_list_pop_stack(menu_list_t *list)
menu_driver_list_cache(MENU_LIST_PLAIN, 0);
menu_list_pop(list->menu_stack, &nav->selection_ptr);
menu_list_pop(list->menu_stack, directory_ptr);
menu_entries_set_refresh(false);
}
void menu_list_pop(file_list_t *list, size_t *directory_ptr)
{
if (list->size != 0)
menu_driver_list_free(list, list->size - 1, list->size - 1);
file_list_pop(list, directory_ptr);
menu_driver_list_set_selection(list);
}
void menu_list_clear(file_list_t *list)
{

View File

@ -78,9 +78,7 @@ menu_list_t *menu_list_new(void);
void menu_list_flush_stack(menu_list_t *list,
const char *needle, unsigned final_type);
void menu_list_pop(file_list_t *list, size_t *directory_ptr);
void menu_list_pop_stack(menu_list_t *list);
void menu_list_pop_stack(menu_list_t *list, size_t *directory_ptr);
void menu_list_get_at_offset(const file_list_t *list, size_t idx,
const char **path, const char **label, unsigned *file_type,