(Menu) Create menu_parse_check

This commit is contained in:
twinaphex 2014-09-01 02:38:54 +02:00
parent de0ba69948
commit dbcb6c51ec
3 changed files with 19 additions and 32 deletions

View File

@ -1421,17 +1421,7 @@ static int menu_settings_iterate(unsigned action)
file_list_get_last(driver.menu->menu_stack, &path, &label, &menu_type);
if (driver.menu->need_refresh && !(menu_type == MENU_FILE_DIRECTORY ||
menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY ||
menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
menu_type == MENU_CONTENT_HISTORY_PATH ||
menu_type == MENU_SETTINGS_CORE ||
menu_type == MENU_SETTINGS_CONFIG ||
menu_type == MENU_SETTINGS_DISK_APPEND ||
menu_type == MENU_SETTINGS_OPEN_HISTORY))
if (driver.menu->need_refresh && (menu_parse_check(menu_type) == -1))
{
driver.menu->need_refresh = false;
menu_entries_push(driver.menu, path, label, menu_type);
@ -1724,17 +1714,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type)
file_list_get_at_offset(driver.menu->selection_buf, driver.menu->selection_ptr, &path, &label, &type);
if (
menu_common_type_is(type) == MENU_SETTINGS_SHADER_OPTIONS ||
menu_common_type_is(type) == MENU_FILE_DIRECTORY ||
type == MENU_SETTINGS_OVERLAY_PRESET ||
type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
type == MENU_CONTENT_HISTORY_PATH ||
type == MENU_SETTINGS_CORE ||
type == MENU_SETTINGS_CONFIG ||
type == MENU_SETTINGS_DISK_APPEND ||
type == MENU_FILE_DIRECTORY)
if (menu_parse_check(type) == 0)
{
char cat_path[PATH_MAX];
fill_pathname_join(cat_path, dir, path, sizeof(cat_path));

View File

@ -563,6 +563,21 @@ int menu_entries_push(menu_handle_t *menu,
return 0;
}
int menu_parse_check(unsigned menu_type)
{
if (!((menu_type == MENU_FILE_DIRECTORY ||
menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY ||
menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
menu_type == MENU_CONTENT_HISTORY_PATH ||
menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
menu_type == MENU_SETTINGS_CORE ||
menu_type == MENU_SETTINGS_CONFIG ||
menu_type == MENU_SETTINGS_DISK_APPEND)))
return -1;
return 0;
}
int menu_parse_and_resolve(void)
{
@ -580,16 +595,7 @@ int menu_parse_and_resolve(void)
)
return menu_entries_push(driver.menu, dir, label, menu_type);
if (!((menu_type == MENU_FILE_DIRECTORY ||
menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS ||
menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY ||
menu_type == MENU_SETTINGS_OVERLAY_PRESET ||
menu_type == MENU_CONTENT_HISTORY_PATH ||
menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER ||
menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER ||
menu_type == MENU_SETTINGS_CORE ||
menu_type == MENU_SETTINGS_CONFIG ||
menu_type == MENU_SETTINGS_DISK_APPEND)))
if (menu_parse_check(menu_type) == -1)
return - 1;
file_list_clear(driver.menu->selection_buf);

View File

@ -22,6 +22,7 @@
int menu_entries_push(menu_handle_t *menu, const char *path,
const char *label, unsigned menu_type);
void menu_entries_push_info(void);
int menu_parse_check(unsigned menu_type);
int menu_parse_and_resolve(void);
#endif