From 71978000b42168ef8d30650c297dd3cf32c7a915 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 12 Oct 2014 17:46:08 +0200 Subject: [PATCH] (Menu) Hook up action OK for help screen --- frontend/menu/backend/menu_common_backend.c | 61 +++++++++++---------- frontend/menu/menu_entries_cbs.c | 9 +-- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index f33bb7f456..2e6c849e9e 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -121,6 +121,30 @@ static int menu_info_screen_iterate(unsigned action) return 0; } +static int menu_action_ok(void) +{ + const char *label = NULL; + const char *path = NULL; + menu_file_list_cbs_t *cbs = NULL; + unsigned type = 0; + + if (file_list_get_size(driver.menu->selection_buf) == 0) + return 0; + + file_list_get_at_offset(driver.menu->selection_buf, + driver.menu->selection_ptr, &path, &label, &type); + + cbs = (menu_file_list_cbs_t*) + file_list_get_actiondata_at_offset(driver.menu->selection_buf, + driver.menu->selection_ptr); + + if (cbs && cbs->action_ok) + return cbs->action_ok(path, label, type, driver.menu->selection_ptr); + + return 0; +} + + static int menu_start_screen_iterate(unsigned action) { unsigned i; @@ -188,7 +212,6 @@ static int menu_start_screen_iterate(unsigned action) return 0; } - static int menu_setting_start_toggle(unsigned type, const char *dir, const char *label, unsigned action) @@ -316,13 +339,6 @@ static int menu_settings_iterate(unsigned action) menu_entries_push_list(driver.menu, driver.menu->selection_buf, path, label, menu_type); - /* Have to defer it so we let settings refresh. */ - if (driver.menu->push_start_screen) - { - driver.menu->push_start_screen = false; - file_list_push(driver.menu->menu_stack, "", "help", 0, 0); - } - driver.menu->need_refresh = false; break; @@ -337,6 +353,13 @@ static int menu_settings_iterate(unsigned action) if (driver.menu_ctx && driver.menu_ctx->render) driver.menu_ctx->render(); + /* Have to defer it so we let settings refresh. */ + if (driver.menu->push_start_screen) + { + file_list_push(driver.menu->menu_stack, "", "help", 0, 0); + driver.menu->push_start_screen = false; + } + return 0; } @@ -596,28 +619,6 @@ static int menu_load_or_open_zip_iterate(unsigned action) return 0; } -static int menu_action_ok(void) -{ - const char *label = NULL; - const char *path = NULL; - menu_file_list_cbs_t *cbs = NULL; - unsigned type = 0; - - if (file_list_get_size(driver.menu->selection_buf) == 0) - return 0; - - file_list_get_at_offset(driver.menu->selection_buf, - driver.menu->selection_ptr, &path, &label, &type); - - cbs = (menu_file_list_cbs_t*) - file_list_get_actiondata_at_offset(driver.menu->selection_buf, - driver.menu->selection_ptr); - - if (cbs && cbs->action_ok) - return cbs->action_ok(path, label, type, driver.menu->selection_ptr); - - return 0; -} static int menu_common_iterate(unsigned action) { diff --git a/frontend/menu/menu_entries_cbs.c b/frontend/menu/menu_entries_cbs.c index 020ca9c9f8..01d6d5de47 100644 --- a/frontend/menu/menu_entries_cbs.c +++ b/frontend/menu/menu_entries_cbs.c @@ -575,13 +575,14 @@ static int action_ok_push_default(const char *path, return 0; } -static int action_ok_info_screen(const char *path, +static int action_ok_help(const char *path, const char *label, unsigned type, size_t index) { if (!driver.menu) return -1; - menu_entries_pop_list(driver.menu->menu_stack); + file_list_push(driver.menu->menu_stack, "", "help", 0, 0); + driver.menu->push_start_screen = false; return 0; } @@ -683,8 +684,8 @@ static void menu_entries_cbs_init_bind_ok_toggle(menu_file_list_cbs_t *cbs, if (menu_entries_cbs_init_bind_ok(cbs, path, label, type, index) == 0) return; - else if (!strcmp(label, "info_screen")) - cbs->action_ok = action_ok_info_screen; + else if (!strcmp(label, "help")) + cbs->action_ok = action_ok_help; else if ( !strcmp(label, "Shader Options") || !strcmp(label, "Input Options") ||