Refactor some code
This commit is contained in:
parent
ff8f587c30
commit
6cd2173382
|
@ -34,16 +34,15 @@ static void menu_cbs_init_log(const char *entry_label, const char *bind_label, c
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_cbs_init(void *data,
|
void menu_cbs_init(void *data,
|
||||||
|
menu_file_list_cbs_t *cbs,
|
||||||
const char *path, const char *label,
|
const char *path, const char *label,
|
||||||
unsigned type, size_t idx)
|
unsigned type, size_t idx)
|
||||||
{
|
{
|
||||||
char elem0[PATH_MAX_LENGTH];
|
char elem0[PATH_MAX_LENGTH];
|
||||||
char elem1[PATH_MAX_LENGTH];
|
char elem1[PATH_MAX_LENGTH];
|
||||||
const char *repr_label = NULL;
|
const char *repr_label = NULL;
|
||||||
rarch_setting_t *setting = NULL;
|
|
||||||
struct string_list *str_list = NULL;
|
struct string_list *str_list = NULL;
|
||||||
const char *menu_label = NULL;
|
const char *menu_label = NULL;
|
||||||
menu_file_list_cbs_t *cbs = NULL;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint32_t label_hash = 0;
|
uint32_t label_hash = 0;
|
||||||
uint32_t menu_label_hash = 0;
|
uint32_t menu_label_hash = 0;
|
||||||
|
@ -51,16 +50,6 @@ void menu_cbs_init(void *data,
|
||||||
if (!list)
|
if (!list)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(list, idx);
|
|
||||||
|
|
||||||
if (!cbs)
|
|
||||||
return;
|
|
||||||
|
|
||||||
setting = menu_setting_find(label);
|
|
||||||
|
|
||||||
if (setting)
|
|
||||||
cbs->setting = setting;
|
|
||||||
|
|
||||||
elem0[0] = '\0';
|
elem0[0] = '\0';
|
||||||
elem1[0] = '\0';
|
elem1[0] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,7 @@ int action_scan_file(const char *path,
|
||||||
const char *label, unsigned type, size_t idx);
|
const char *label, unsigned type, size_t idx);
|
||||||
|
|
||||||
void menu_cbs_init(void *data,
|
void menu_cbs_init(void *data,
|
||||||
|
menu_file_list_cbs_t *cbs,
|
||||||
const char *path, const char *label,
|
const char *path, const char *label,
|
||||||
unsigned type, size_t idx);
|
unsigned type, size_t idx);
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,7 @@ static void menu_list_push(file_list_t *list,
|
||||||
size_t idx;
|
size_t idx;
|
||||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||||
menu_file_list_cbs_t *cbs = NULL;
|
menu_file_list_cbs_t *cbs = NULL;
|
||||||
|
rarch_setting_t *setting = NULL;
|
||||||
if (!list || !label)
|
if (!list || !label)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -251,7 +252,12 @@ static void menu_list_push(file_list_t *list,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
file_list_set_actiondata(list, idx, cbs);
|
file_list_set_actiondata(list, idx, cbs);
|
||||||
menu_cbs_init(list, path, label, type, idx);
|
|
||||||
|
setting = menu_setting_find(label);
|
||||||
|
|
||||||
|
cbs->setting = (setting) ? setting : NULL;
|
||||||
|
|
||||||
|
menu_cbs_init(list, cbs, path, label, type, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,
|
void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,
|
||||||
|
|
|
@ -43,8 +43,6 @@ int menu_entry_go_back(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum menu_entry_type menu_entry_get_type(uint32_t i)
|
enum menu_entry_type menu_entry_get_type(uint32_t i)
|
||||||
{
|
{
|
||||||
rarch_setting_t *setting = menu_entries_get_setting(i);
|
rarch_setting_t *setting = menu_entries_get_setting(i);
|
||||||
|
|
Loading…
Reference in New Issue