From 40c6ec37907068c356a623d13d6969a834c958e1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 25 Sep 2015 17:47:51 +0200 Subject: [PATCH] Revert "Refactor code to no longer need menu_navigation_get_ptr" This reverts commit a7b83cfd45f086370946aaf710d5c9fea6308550. --- menu/menu_entry.c | 18 ++++-------------- menu/menu_list.c | 8 ++------ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/menu/menu_entry.c b/menu/menu_entry.c index dc08baca13..c41d9b2966 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -33,16 +33,11 @@ /* Clicks the back button */ int menu_entry_go_back(void) { - size_t new_selection_ptr; menu_list_t *menu_list = menu_list_get_ptr(); - + menu_navigation_t *nav = menu_navigation_get_ptr(); if (!menu_list) return -1; - - menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr); - menu_list_pop_stack(menu_list, &new_selection_ptr); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection_ptr); - + menu_list_pop_stack(menu_list, &nav->selection_ptr); return 0; } @@ -354,7 +349,6 @@ int menu_entry_select(uint32_t i) int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action) { - size_t new_selection_ptr; int ret = 0; menu_navigation_t *nav = menu_navigation_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr(); @@ -371,14 +365,10 @@ int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action) ret = cbs->action_down(entry->type, entry->label); break; case MENU_ACTION_SCROLL_UP: - menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr); - menu_navigation_descend_alphabet(nav, &new_selection_ptr); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection_ptr); + menu_navigation_descend_alphabet(nav, &nav->selection_ptr); break; case MENU_ACTION_SCROLL_DOWN: - menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr); - menu_navigation_ascend_alphabet(nav, &new_selection_ptr); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection_ptr); + menu_navigation_ascend_alphabet(nav, &nav->selection_ptr); break; case MENU_ACTION_CANCEL: diff --git a/menu/menu_list.c b/menu/menu_list.c index b79e79cdbd..b875878401 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -150,6 +150,7 @@ void menu_list_flush_stack(menu_list_t *list, const char *label = NULL; unsigned type = 0; size_t entry_idx = 0; + menu_navigation_t *nav = menu_navigation_get_ptr(); if (!list) return; @@ -160,12 +161,7 @@ void menu_list_flush_stack(menu_list_t *list, while (menu_list_flush_stack_type( needle, label, type, final_type) != 0) { - size_t new_selection_ptr; - - menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr); - menu_list_pop(list->menu_stack, &new_selection_ptr); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection_ptr); - + menu_list_pop(list->menu_stack, &nav->selection_ptr); menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx); }