diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 9763738cb1..ef55e5e0e5 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -514,12 +514,6 @@ static void menu_common_setting_push_current_menu(file_list_t *list, } } -static void menu_action_cancel(void) -{ - file_list_pop(driver.menu->menu_stack, &driver.menu->selection_ptr); - driver.menu->need_refresh = true; -} - static int menu_common_core_setting_toggle(unsigned setting, unsigned action) { unsigned index = setting - MENU_SETTINGS_CORE_OPTION_START; @@ -1340,8 +1334,7 @@ static int menu_settings_iterate(unsigned action) break; case MENU_ACTION_CANCEL: - if (file_list_get_size(driver.menu->menu_stack) > 1) - menu_action_cancel(); + menu_entries_pop(); break; case MENU_ACTION_SELECT: { @@ -2057,8 +2050,7 @@ static int menu_common_iterate(unsigned action) break; case MENU_ACTION_CANCEL: - if (file_list_get_size(driver.menu->menu_stack) > 1) - menu_action_cancel(); + menu_entries_pop(); break; case MENU_ACTION_OK: diff --git a/frontend/menu/menu_entries.c b/frontend/menu/menu_entries.c index 031231cc5d..cf1f3ac43a 100644 --- a/frontend/menu/menu_entries.c +++ b/frontend/menu/menu_entries.c @@ -69,6 +69,15 @@ void menu_entries_push_perfcounter(menu_handle_t *menu, id + i, 0); } +void menu_entries_pop(void) +{ + if (file_list_get_size(driver.menu->menu_stack) > 1) + { + file_list_pop(driver.menu->menu_stack, &driver.menu->selection_ptr); + driver.menu->need_refresh = true; + } +} + int menu_entries_push(menu_handle_t *menu, const char *path, const char *label, unsigned menu_type) @@ -802,3 +811,4 @@ void menu_entries_push_info(void) { file_list_push(driver.menu->menu_stack, "", "help", 0, 0); } + diff --git a/frontend/menu/menu_entries.h b/frontend/menu/menu_entries.h index 6c61d39222..32cf56249d 100644 --- a/frontend/menu/menu_entries.h +++ b/frontend/menu/menu_entries.h @@ -24,5 +24,6 @@ int menu_entries_push(menu_handle_t *menu, const char *path, void menu_entries_push_info(void); int menu_parse_check(unsigned menu_type); int menu_parse_and_resolve(void); +void menu_entries_pop(void); #endif