Refactor menu_entry_select
This commit is contained in:
parent
e75c061bce
commit
e735cc93c2
|
@ -386,6 +386,7 @@ int menu_entry_get_current_id(bool use_representation)
|
||||||
int menu_entry_select(uint32_t i)
|
int menu_entry_select(uint32_t i)
|
||||||
{
|
{
|
||||||
menu_entry_t entry;
|
menu_entry_t entry;
|
||||||
|
enum menu_action action = MENU_ACTION_NOOP;
|
||||||
menu_file_list_cbs_t *cbs = NULL;
|
menu_file_list_cbs_t *cbs = NULL;
|
||||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||||
menu_list_t *menu_list = menu_list_get_ptr();
|
menu_list_t *menu_list = menu_list_get_ptr();
|
||||||
|
@ -399,28 +400,20 @@ int menu_entry_select(uint32_t i)
|
||||||
|
|
||||||
if (setting_is_of_path_type(setting))
|
if (setting_is_of_path_type(setting))
|
||||||
return 0;
|
return 0;
|
||||||
if (setting_is_of_general_type(setting))
|
|
||||||
{
|
|
||||||
nav->selection_ptr = i;
|
|
||||||
|
|
||||||
if (cbs && cbs->action_ok)
|
|
||||||
cbs->action_ok(entry.path, entry.label, entry.type, i);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav->selection_ptr = i;
|
nav->selection_ptr = i;
|
||||||
if (cbs && cbs->action_ok)
|
if ((cbs && cbs->action_ok) || setting_is_of_general_type(setting))
|
||||||
cbs->action_ok(entry.path, entry.label, entry.type, i);
|
action = MENU_ACTION_OK;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cbs && cbs->action_start)
|
if (cbs && cbs->action_start)
|
||||||
cbs->action_start(entry.type, entry.label, MENU_ACTION_START);
|
action = MENU_ACTION_START;
|
||||||
if (cbs && cbs->action_toggle)
|
if (cbs && cbs->action_toggle)
|
||||||
cbs->action_toggle(entry.type, entry.label, MENU_ACTION_RIGHT, true);
|
action = MENU_ACTION_RIGHT;
|
||||||
menu_list_push(menu_list->menu_stack, "",
|
|
||||||
"info_screen", 0, i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (action != MENU_ACTION_NOOP)
|
||||||
|
return menu_entry_action(&entry, i, action);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue