Split up action cancel callbacks to new file

This commit is contained in:
twinaphex 2015-02-26 17:22:00 +01:00
parent 12efaa0631
commit b4a8ee4006
6 changed files with 85 additions and 32 deletions

View File

@ -313,7 +313,8 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/menu_texture.o \
menu/menu_entries.o \
menu/menu_entries_cbs.o \
menu/menu_entries_ok_cbs.o \
menu/menu_entries_cbs_ok.o \
menu/menu_entries_cbs_cancel.o \
menu/menu_list.o \
menu/menu_animation.o
endif

View File

@ -679,7 +679,8 @@ MENU
#include "../menu/menu_setting.c"
#include "../menu/menu_list.c"
#include "../menu/menu_entries.c"
#include "../menu/menu_entries_ok_cbs.c"
#include "../menu/menu_entries_cbs_ok.c"
#include "../menu/menu_entries_cbs_cancel.c"
#include "../menu/menu_entries_cbs.c"
#include "../menu/menu_shader.c"
#include "../menu/menu_texture.c"

View File

@ -787,24 +787,6 @@ int cb_core_updater_download(void *data_, size_t len)
}
#endif
static int action_cancel_lookup_setting(const char *path,
const char *label, unsigned type, size_t idx)
{
return menu_setting_set(type, label, MENU_ACTION_CANCEL);
}
static int action_cancel_pop_default(const char *path,
const char *label, unsigned type, size_t idx)
{
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return -1;
menu_apply_deferred_settings();
menu_list_pop_stack(menu->menu_list);
return 0;
}
static int action_start_remap_file_load(unsigned type, const char *label,
unsigned action)
{
@ -4219,18 +4201,6 @@ static void menu_entries_cbs_init_bind_content_list_switch(menu_file_list_cbs_t
cbs->action_content_list_switch = deferred_push_content_list;
}
static void menu_entries_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1)
{
if (!cbs)
return;
cbs->action_cancel = action_cancel_lookup_setting;
/* TODO - add some stuff here. */
cbs->action_cancel = action_cancel_pop_default;
}
static int is_settings_entry(const char *label)
{

View File

@ -25,6 +25,10 @@ extern "C" {
void menu_entries_common_load_content(bool persist);
void menu_entries_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1);
void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1, const char *menu_label);

View File

@ -0,0 +1,77 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <file/file_path.h>
#include "menu.h"
#include "menu_entries_cbs.h"
#include "menu_setting.h"
#include "menu_input.h"
#include "menu_entries.h"
#include "menu_shader.h"
#include "menu_navigation.h"
#include "../file_ext.h"
#include "../file_extract.h"
#include "../file_ops.h"
#include "../config.def.h"
#include "../cheats.h"
#include "../retroarch.h"
#include "../performance.h"
#ifdef HAVE_NETWORKING
#include "../net_http.h"
#endif
#ifdef HAVE_LIBRETRODB
#include "../database_info.h"
#endif
#include "menu_database.h"
#include "../input/input_autodetect.h"
#include "../input/input_remapping.h"
#include "../gfx/video_viewport.h"
static int action_cancel_lookup_setting(const char *path,
const char *label, unsigned type, size_t idx)
{
return menu_setting_set(type, label, MENU_ACTION_CANCEL);
}
static int action_cancel_pop_default(const char *path,
const char *label, unsigned type, size_t idx)
{
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return -1;
menu_apply_deferred_settings();
menu_list_pop_stack(menu->menu_list);
return 0;
}
void menu_entries_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1)
{
if (!cbs)
return;
cbs->action_cancel = action_cancel_lookup_setting;
/* TODO - add some stuff here. */
cbs->action_cancel = action_cancel_pop_default;
}