From 5d9f96bc075c0d824b3077d0e4155efca86feed5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 31 Aug 2014 22:49:07 +0200 Subject: [PATCH] Refactor menu_parse_and_resolve - add call to menu_entries_push and add int returnvalue for menu_entries_push --- frontend/menu/backend/menu_common_backend.c | 16 +++++++--------- frontend/menu/menu_entries.c | 6 ++++-- frontend/menu/menu_entries.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index bcba42d266..9ff9436c8b 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -1685,6 +1685,12 @@ static int menu_parse_and_resolve(void) /* Directory parse */ file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type); + if ( + menu_type == MENU_SETTINGS_DEFERRED_CORE || + menu_type == MENU_SETTINGS_OPEN_HISTORY + ) + return menu_entries_push(driver.menu, dir, label, menu_type); + if (!((menu_type == MENU_FILE_DIRECTORY || menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS || menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY || @@ -2380,15 +2386,7 @@ static int menu_common_iterate(unsigned action) // refresh values in case the stack changed file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type); - if (driver.menu->need_refresh && - (menu_type == MENU_SETTINGS_DEFERRED_CORE || - menu_type == MENU_SETTINGS_OPEN_HISTORY) - ) - { - driver.menu->need_refresh = false; - menu_entries_push(driver.menu, dir, label, menu_type); - } - else if (driver.menu->need_refresh) + if (driver.menu->need_refresh) { if (menu_parse_and_resolve() == 0) driver.menu->need_refresh = false; diff --git a/frontend/menu/menu_entries.c b/frontend/menu/menu_entries.c index 55c22cb90e..f99413f055 100644 --- a/frontend/menu/menu_entries.c +++ b/frontend/menu/menu_entries.c @@ -39,7 +39,7 @@ static void add_setting_entry(menu_handle_t *menu, const char *label, unsigned i id, 0); } -void menu_entries_push(menu_handle_t *menu, +int menu_entries_push(menu_handle_t *menu, const char *path, const char *label, unsigned menu_type) { @@ -171,7 +171,7 @@ void menu_entries_push(menu_handle_t *menu, struct gfx_shader *shader = (struct gfx_shader*)menu->shader; if (!shader) - return; + return -1; file_list_clear(menu->selection_buf); file_list_push(menu->selection_buf, "Apply Shader Changes", "", @@ -544,4 +544,6 @@ void menu_entries_push(menu_handle_t *menu, if (driver.menu_ctx && driver.menu_ctx->populate_entries) driver.menu_ctx->populate_entries(menu, path, label, menu_type); + + return 0; } diff --git a/frontend/menu/menu_entries.h b/frontend/menu/menu_entries.h index 4b4440abb3..336b93141d 100644 --- a/frontend/menu/menu_entries.h +++ b/frontend/menu/menu_entries.h @@ -19,7 +19,7 @@ #include "menu_common.h" -void menu_entries_push(menu_handle_t *menu, const char *path, +int menu_entries_push(menu_handle_t *menu, const char *path, const char *label, unsigned menu_type); #endif