Add MENU_SETTING_CTL_NEW

This commit is contained in:
twinaphex 2016-03-18 22:31:14 +01:00
parent a5cbafe0e5
commit 033cf569e4
3 changed files with 12 additions and 14 deletions

View File

@ -657,7 +657,7 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
menu_entries_list_settings = NULL; menu_entries_list_settings = NULL;
break; break;
case MENU_ENTRIES_CTL_SETTINGS_INIT: case MENU_ENTRIES_CTL_SETTINGS_INIT:
menu_entries_list_settings = menu_setting_new(); menu_setting_ctl(MENU_SETTING_CTL_NEW, &menu_entries_list_settings);
if (!menu_entries_list_settings) if (!menu_entries_list_settings)
return false; return false;

View File

@ -7400,7 +7400,7 @@ static bool menu_setting_free(void *data)
* Returns: settings list composed of all requested * Returns: settings list composed of all requested
* settings on success, otherwise NULL. * settings on success, otherwise NULL.
**/ **/
rarch_setting_t *menu_setting_new(void) static rarch_setting_t *menu_setting_new(void)
{ {
rarch_setting_t terminator = { ST_NONE }; rarch_setting_t terminator = { ST_NONE };
rarch_setting_t* list = NULL; rarch_setting_t* list = NULL;
@ -7569,9 +7569,17 @@ bool menu_setting_ctl(enum menu_setting_ctl_state state, void *data)
if (!(flags & SD_FLAG_BROWSER_ACTION)) if (!(flags & SD_FLAG_BROWSER_ACTION))
return false; return false;
} }
return true; break;
case MENU_SETTING_CTL_FREE: case MENU_SETTING_CTL_FREE:
return menu_setting_free(data); return menu_setting_free(data);
case MENU_SETTING_CTL_NEW:
{
rarch_setting_t **setting = (rarch_setting_t**)data;
if (!setting)
return false;
*setting = menu_setting_new();
}
break;
case MENU_SETTING_CTL_NONE: case MENU_SETTING_CTL_NONE:
default: default:
break; break;

View File

@ -67,6 +67,7 @@ enum menu_setting_ctl_state
{ {
MENU_SETTING_CTL_NONE = 0, MENU_SETTING_CTL_NONE = 0,
MENU_SETTING_CTL_FREE, MENU_SETTING_CTL_FREE,
MENU_SETTING_CTL_NEW,
MENU_SETTING_CTL_IS_OF_PATH_TYPE MENU_SETTING_CTL_IS_OF_PATH_TYPE
}; };
@ -318,17 +319,6 @@ void menu_setting_get_label(void *data, char *s,
size_t len, unsigned *w, unsigned type, size_t len, unsigned *w, unsigned type,
const char *menu_label, const char *label, unsigned idx); const char *menu_label, const char *label, unsigned idx);
/**
* setting_new:
* @mask : Bitmask of settings to include.
*
* Request a list of settings based on @mask.
*
* Returns: settings list composed of all requested
* settings on success, otherwise NULL.
**/
rarch_setting_t* menu_setting_new(void);
int menu_action_handle_setting(rarch_setting_t *setting, int menu_action_handle_setting(rarch_setting_t *setting,
unsigned type, unsigned action, bool wraparound); unsigned type, unsigned action, bool wraparound);