Reduce further dependence on MENU_VALUE_

This commit is contained in:
twinaphex 2016-06-17 20:50:36 +02:00
parent 41c7d76017
commit 79bd87e12a
2 changed files with 38 additions and 33 deletions

View File

@ -391,9 +391,9 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
if (cbs->setting)
{
const char *parent_group = menu_setting_get_parent_group(cbs->setting);
uint32_t parent_group_hash = menu_hash_calculate(parent_group);
if ((parent_group_hash == MENU_VALUE_MAIN_MENU) && (menu_setting_get_type(cbs->setting) == ST_GROUP))
if (string_is_equal(parent_group, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU))
&& (menu_setting_get_type(cbs->setting) == ST_GROUP))
{
BIND_ACTION_LEFT(cbs, action_left_mainmenu);
return 0;
@ -606,15 +606,16 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs,
if (type == MENU_SETTING_NO_ITEM)
{
switch (menu_label_hash)
if ( string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HORIZONTAL_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_SETTINGS_TAB))
)
{
case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU:
case 153956705: /* TODO/FIXME - dehardcode */
BIND_ACTION_LEFT(cbs, action_left_mainmenu);
return 0;
default:
break;
}
}

View File

@ -405,7 +405,8 @@ int bind_right_generic(unsigned type, const char *label,
}
static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
unsigned type, uint32_t label_hash, uint32_t menu_label_hash)
unsigned type, uint32_t label_hash, const char *menu_label,
uint32_t menu_label_hash)
{
if (type >= MENU_SETTINGS_CHEAT_BEGIN
&& type <= MENU_SETTINGS_CHEAT_END)
@ -475,16 +476,18 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
case MENU_FILE_DOWNLOAD_THUMBNAIL_CONTENT:
case MENU_FILE_SCAN_DIRECTORY:
case MENU_SETTING_GROUP:
switch (menu_label_hash)
if ( string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HORIZONTAL_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_SETTINGS_TAB))
)
{
case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU:
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
break;
default:
}
BIND_ACTION_RIGHT(cbs, action_right_scroll);
break;
}
case MENU_SETTING_ACTION:
case MENU_FILE_CONTENTLIST_ENTRY:
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
@ -506,9 +509,9 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
if (cbs->setting)
{
const char *parent_group = menu_setting_get_parent_group(cbs->setting);
uint32_t parent_group_hash = menu_hash_calculate(parent_group);
if ((parent_group_hash == MENU_LABEL_SETTINGS) && (menu_setting_get_type(cbs->setting) == ST_GROUP))
if (string_is_equal(parent_group, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU))
&& (menu_setting_get_type(cbs->setting) == ST_GROUP))
{
BIND_ACTION_RIGHT(cbs, action_right_scroll);
return 0;
@ -626,15 +629,16 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
if (type == MENU_SETTING_NO_ITEM)
{
switch (menu_label_hash)
if ( string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HISTORY_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_ADD_TAB)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_MAIN_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_HORIZONTAL_MENU)) ||
string_is_equal(menu_label, menu_hash_to_str_enum(MENU_ENUM_LABEL_SETTINGS_TAB))
)
{
case MENU_VALUE_HORIZONTAL_MENU:
case MENU_VALUE_MAIN_MENU:
case 153956705: /* TODO/FIXME - dehardcode */
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
return 0;
default:
break;
}
}
@ -642,7 +646,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
menu_label_hash, elem0) == 0)
return 0;
if (menu_cbs_init_bind_right_compare_type(cbs, type, label_hash, menu_label_hash) == 0)
if (menu_cbs_init_bind_right_compare_type(cbs, type, label_hash, menu_label, menu_label_hash) == 0)
return 0;
return menu_cbs_exit();