Refactor menu_entries_push into menu_list_push_refresh

This commit is contained in:
twinaphex 2014-10-17 22:25:23 +02:00
parent 1daf8c354e
commit 4c6aff67f2
8 changed files with 81 additions and 40 deletions

View File

@ -503,7 +503,11 @@ static int menu_load_or_open_zip_iterate(unsigned action)
char cat_path[PATH_MAX];
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
menu_entries_push(driver.menu->menu_stack, cat_path, menu_label, type,
menu_list_push_refresh(
driver.menu->menu_stack,
cat_path,
menu_label,
type,
driver.menu->selection_ptr);
}
break;
@ -519,8 +523,11 @@ static int menu_load_or_open_zip_iterate(unsigned action)
return -1;
}
else if (ret == 0)
menu_entries_push(driver.menu->menu_stack,
g_settings.libretro_directory, "deferred_core_list", 0,
menu_list_push_refresh(
driver.menu->menu_stack,
g_settings.libretro_directory,
"deferred_core_list",
0,
driver.menu->selection_ptr);
}
break;

View File

@ -18,6 +18,7 @@
#include "menu_input_line_cb.h"
#include "menu_action.h"
#include "menu_entries.h"
#include "menu_list.h"
#include "menu_shader.h"
int setting_handler(
@ -106,8 +107,11 @@ static int menu_entries_set_current_path_selection(
switch (action)
{
case MENU_ACTION_OK:
menu_entries_push(driver.menu->menu_stack,
start_path, label, type,
menu_list_push_refresh(
driver.menu->menu_stack,
start_path,
label,
type,
driver.menu->selection_ptr);
if (setting->cmd_trigger.idx != RARCH_CMD_NONE)

View File

@ -118,17 +118,6 @@ int setting_set_flags(rarch_setting_t *setting)
return 0;
}
void menu_entries_push(
file_list_t *list,
const char *path, const char *label,
unsigned type,
size_t directory_ptr)
{
menu_list_push(list, path, label, type, directory_ptr);
menu_navigation_clear(driver.menu, true);
driver.menu->need_refresh = true;
}
static int entries_push_main_menu_list(menu_handle_t *menu,
file_list_t *list,
const char *path, const char *label,

View File

@ -26,10 +26,6 @@
extern "C" {
#endif
void menu_entries_push(file_list_t *list,
const char *path, const char *label, unsigned type,
size_t directory_ptr);
int menu_entries_parse_list(file_list_t *list, file_list_t *menu_list,
const char *dir, const char *label, unsigned type,
unsigned default_type_plain, const char *exts);

View File

@ -127,8 +127,11 @@ static int action_ok_push_content_list(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
g_settings.menu_content_directory, label, MENU_FILE_DIRECTORY,
menu_list_push_refresh(
driver.menu->menu_stack,
g_settings.menu_content_directory,
label,
MENU_FILE_DIRECTORY,
driver.menu->selection_ptr);
return 0;
}
@ -151,8 +154,12 @@ static int action_ok_push_history_list(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
"", label, type, driver.menu->selection_ptr);
menu_list_push_refresh(
driver.menu->menu_stack,
"",
label,
type,
driver.menu->selection_ptr);
return 0;
}
@ -162,8 +169,12 @@ static int action_ok_push_path_list(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
"", label, type, driver.menu->selection_ptr);
menu_list_push_refresh(
driver.menu->menu_stack,
"",
label,
type,
driver.menu->selection_ptr);
return 0;
}
@ -332,8 +343,12 @@ static int action_ok_compressed_archive_push(const char *path,
}
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
menu_entries_push(driver.menu->menu_stack,
cat_path, menu_label, type, driver.menu->selection_ptr);
menu_list_push_refresh(
driver.menu->menu_stack,
cat_path,
menu_label,
type,
driver.menu->selection_ptr);
return 0;
}
@ -351,8 +366,12 @@ static int action_ok_directory_push(const char *path,
file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label, NULL);
fill_pathname_join(cat_path, menu_path, path, sizeof(cat_path));
menu_entries_push(driver.menu->menu_stack,
cat_path, menu_label, type, driver.menu->selection_ptr);
menu_list_push_refresh(
driver.menu->menu_stack,
cat_path,
menu_label,
type,
driver.menu->selection_ptr);
return 0;
}
@ -422,7 +441,7 @@ static int action_ok_file_load_with_detect_core(const char *path,
return -1;
}
else if (ret == 0)
menu_entries_push(
menu_list_push_refresh(
driver.menu->menu_stack,
g_settings.libretro_directory,
"deferred_core_list",
@ -620,7 +639,7 @@ static int action_ok_core_list(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
menu_list_push_refresh(driver.menu->menu_stack,
dir, label, type,
driver.menu->selection_ptr);
@ -635,7 +654,7 @@ static int action_ok_disk_image_append_list(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
menu_list_push_refresh(driver.menu->menu_stack,
dir, label, type,
driver.menu->selection_ptr);
return 0;
@ -648,7 +667,7 @@ static int action_ok_configurations_list(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
menu_list_push_refresh(driver.menu->menu_stack,
dir ? dir : label, label, type,
driver.menu->selection_ptr);
return 0;
@ -660,7 +679,7 @@ static int action_ok_push_default(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
menu_list_push_refresh(driver.menu->menu_stack,
label, label, type,
driver.menu->selection_ptr);
return 0;
@ -780,7 +799,8 @@ static int action_ok_shader_pass(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
menu_list_push_refresh(
driver.menu->menu_stack,
g_settings.video.shader_dir,
"video_shader_pass",
type,
@ -813,7 +833,8 @@ static int action_ok_shader_preset(const char *path,
if (!driver.menu)
return -1;
menu_entries_push(driver.menu->menu_stack,
menu_list_push_refresh(
driver.menu->menu_stack,
g_settings.video.shader_dir,
"video_shader_preset",
type,
@ -976,9 +997,11 @@ static int action_ok_shader_parameters(const char *path,
const char *label, unsigned type, size_t index)
{
#ifdef HAVE_SHADER_MANAGER
menu_entries_push(driver.menu->menu_stack, "",
menu_list_push_refresh(
driver.menu->menu_stack, "",
"video_shader_parameters",
MENU_FILE_PUSH, driver.menu->selection_ptr);
MENU_FILE_PUSH,
driver.menu->selection_ptr);
#endif
return 0;

View File

@ -15,6 +15,7 @@
#include "../../driver.h"
#include "menu_list.h"
#include "menu_navigation.h"
#include <string.h>
void menu_list_free(file_list_t *list)
@ -185,6 +186,17 @@ void menu_list_push(file_list_t *list,
label, type, list->size - 1);
}
void menu_list_push_refresh(file_list_t *list,
const char *path, const char *label,
unsigned type, size_t directory_ptr)
{
if (!list)
return;
menu_list_push(list, path, label, type, directory_ptr);
menu_navigation_clear(driver.menu, true);
driver.menu->need_refresh = true;
}
void menu_list_push_stack(file_list_t *list,
const char *path, const char *label,
unsigned type, size_t directory_ptr)

View File

@ -48,6 +48,10 @@ void menu_list_push(file_list_t *list,
const char *path, const char *label,
unsigned type, size_t directory_ptr);
void menu_list_push_refresh(file_list_t *list,
const char *path, const char *label,
unsigned type, size_t directory_ptr);
void menu_list_push_stack(file_list_t *list,
const char *path, const char *label,
unsigned type, size_t directory_ptr);

View File

@ -34,6 +34,7 @@
#endif
#ifdef HAVE_MENU
#include "frontend/menu/menu_list.h"
#include "frontend/menu/menu_entries.h"
#include "frontend/menu/menu_input_line_cb.h"
#include "frontend/menu/menu_shader.h"
@ -2383,7 +2384,12 @@ static void general_write_handler(void *data)
if (*setting->value.boolean)
{
#ifdef HAVE_MENU
menu_entries_push(driver.menu->menu_stack, "", "help", 0, 0);
menu_list_push_refresh(
driver.menu->menu_stack,
"",
"help",
0,
0);
#endif
*setting->value.boolean = false;
}