mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-31 08:33:40 +00:00
Refactor menu_entries_pop_stack
This commit is contained in:
parent
2de0775213
commit
b4cebd605e
@ -426,25 +426,6 @@ void menu_flush_stack_type(file_list_t *list,
|
||||
}
|
||||
}
|
||||
|
||||
void menu_entries_pop_stack(file_list_t *list,
|
||||
const char *needle)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned type = 0;
|
||||
|
||||
if (!driver.menu || !list)
|
||||
return;
|
||||
|
||||
driver.menu->need_refresh = true;
|
||||
file_list_get_last(list, &path, &label, &type);
|
||||
while (strcmp(needle, label) == 0)
|
||||
{
|
||||
menu_list_pop(list, &driver.menu->selection_ptr);
|
||||
file_list_get_last(list, &path, &label, &type);
|
||||
}
|
||||
}
|
||||
|
||||
void menu_flush_stack_label(file_list_t *list,
|
||||
const char *needle)
|
||||
{
|
||||
|
@ -36,8 +36,6 @@ int menu_entries_parse_list(file_list_t *list, file_list_t *menu_list,
|
||||
|
||||
int menu_entries_deferred_push(file_list_t *list, file_list_t *menu_list);
|
||||
|
||||
void menu_entries_pop_stack(file_list_t *list, const char *needle);
|
||||
|
||||
void menu_flush_stack_type(file_list_t *list, unsigned final_type);
|
||||
void menu_flush_stack_label(file_list_t *list, const char *needle);
|
||||
|
||||
|
@ -256,7 +256,7 @@ static int action_ok_path_use_directory(const char *path,
|
||||
if (setting->type == ST_DIR)
|
||||
{
|
||||
menu_action_setting_set_current_string(setting, menu_path);
|
||||
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
|
||||
menu_list_pop_stack_by_needle(driver.menu->menu_stack, setting->name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -448,7 +448,7 @@ static int action_ok_file_load(const char *path,
|
||||
if (setting && setting->type == ST_PATH)
|
||||
{
|
||||
menu_action_setting_set_current_string_path(setting, menu_path, path);
|
||||
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
|
||||
menu_list_pop_stack_by_needle(driver.menu->menu_stack, setting->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -489,7 +489,7 @@ static int action_ok_set_path(const char *path,
|
||||
return -1;
|
||||
|
||||
menu_action_setting_set_current_string_path(setting, menu_path, path);
|
||||
menu_entries_pop_stack(driver.menu->menu_stack, setting->name);
|
||||
menu_list_pop_stack_by_needle(driver.menu->menu_stack, setting->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "menu_list.h"
|
||||
#include <string.h>
|
||||
|
||||
void menu_list_free(file_list_t *list)
|
||||
{
|
||||
@ -49,6 +50,25 @@ void menu_list_pop_stack(file_list_t *list)
|
||||
}
|
||||
}
|
||||
|
||||
void menu_list_pop_stack_by_needle(file_list_t *list,
|
||||
const char *needle)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned type = 0;
|
||||
|
||||
if (!driver.menu || !list)
|
||||
return;
|
||||
|
||||
driver.menu->need_refresh = true;
|
||||
file_list_get_last(list, &path, &label, &type);
|
||||
while (strcmp(needle, label) == 0)
|
||||
{
|
||||
menu_list_pop(list, &driver.menu->selection_ptr);
|
||||
file_list_get_last(list, &path, &label, &type);
|
||||
}
|
||||
}
|
||||
|
||||
void menu_list_pop(file_list_t *list, size_t *directory_ptr)
|
||||
{
|
||||
if (!driver.menu_ctx)
|
||||
|
@ -29,6 +29,9 @@ void menu_list_pop(file_list_t *list, size_t *directory_ptr);
|
||||
|
||||
void menu_list_pop_stack(file_list_t *list);
|
||||
|
||||
void menu_list_pop_stack_by_needle(file_list_t *list,
|
||||
const char *needle);
|
||||
|
||||
void menu_list_clear(file_list_t *list);
|
||||
|
||||
void menu_list_push(file_list_t *list,
|
||||
|
Loading…
x
Reference in New Issue
Block a user