Fix 'Use this directory' for directory settings

This commit is contained in:
twinaphex 2016-07-08 22:51:47 +02:00
parent 5cefbbfc57
commit 60eb15bf0b
4 changed files with 39 additions and 8 deletions

View File

@ -227,6 +227,16 @@ int generic_action_ok_displaylist_push(const char *path,
info_label = label;
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_FILE_BROWSER_SELECT_DIR:
if (path)
strlcpy(menu->deferred_path, path,
sizeof(menu->deferred_path));
info.type = type;
info.directory_ptr = idx;
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_DIR;
break;
case ACTION_OK_DL_PUSH_DEFAULT:
info.type = type;
info.directory_ptr = idx;
@ -267,14 +277,14 @@ int generic_action_ok_displaylist_push(const char *path,
info.directory_ptr = idx;
info_path = global->record.config_dir;
info_label = label;
dl_type = DISPLAYLIST_GENERIC;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
break;
case ACTION_OK_DL_DISK_IMAGE_APPEND_LIST:
info.type = type;
info.directory_ptr = idx;
info_path = settings->directory.menu_content;
info_label = label;
dl_type = DISPLAYLIST_GENERIC;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
break;
case ACTION_OK_DL_PLAYLIST_COLLECTION:
info.type = type;
@ -375,7 +385,7 @@ int generic_action_ok_displaylist_push(const char *path,
info.directory_ptr = idx;
info_path = action_path;
info_label = menu_label;
dl_type = DISPLAYLIST_GENERIC;
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_DATABASE_MANAGER_LIST:
fill_pathname_join(tmp,
@ -2338,6 +2348,7 @@ static int action_ok_shader_apply_changes(const char *path,
static int action_ok_lookup_setting(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_displaylist_reset_filebrowser();
return menu_setting_set(type, label, MENU_ACTION_OK, false);
}
@ -2663,6 +2674,13 @@ int action_ok_push_generic_list(const char *path,
entry_idx, ACTION_OK_DL_GENERIC);
}
int action_ok_push_filebrowser_list_dir_select(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_displaylist_push(path, label, type, idx,
entry_idx, ACTION_OK_DL_FILE_BROWSER_SELECT_DIR);
}
static int action_ok_push_default(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -2997,7 +3015,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
if (menu_setting_get_browser_selection_type(cbs->setting) == ST_DIR)
{
BIND_ACTION_OK(cbs, action_ok_push_generic_list);
BIND_ACTION_OK(cbs, action_ok_push_filebrowser_list_dir_select);
return 0;
}

View File

@ -37,6 +37,7 @@ enum
ACTION_OK_DL_SHADER_PRESET,
ACTION_OK_DL_GENERIC,
ACTION_OK_DL_PUSH_DEFAULT,
ACTION_OK_DL_FILE_BROWSER_SELECT_DIR,
ACTION_OK_DL_DOWNLOADS_DIR,
ACTION_OK_DL_INPUT_SETTINGS_LIST,
ACTION_OK_DL_DRIVER_SETTINGS_LIST,

View File

@ -3235,8 +3235,7 @@ static int menu_displaylist_parse_generic(
}
path_is_compressed = path_is_compressed_file(info->path);
push_dir =
(menu_setting_get_browser_selection_type(info->setting) == ST_DIR);
push_dir = BIT32_GET(filebrowser_types, FILEBROWSER_SELECT_DIR);
filter_ext =
settings->menu.navigation.browser.filter.supported_extensions_enable;
@ -3708,6 +3707,11 @@ static bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry)
return true;
}
void menu_displaylist_reset_filebrowser(void)
{
filebrowser_types = 0;
}
bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
{
size_t i;
@ -3840,10 +3844,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
switch (type)
{
case DISPLAYLIST_FILE_BROWSER_SELECT_DIR:
filebrowser_types = FILEBROWSER_SELECT_DIR;
filebrowser_types = 0;
BIT32_SET(filebrowser_types, FILEBROWSER_SELECT_DIR);
break;
case DISPLAYLIST_FILE_BROWSER_SELECT_FILE:
filebrowser_types = FILEBROWSER_SELECT_FILE;
filebrowser_types = 0;
BIT32_SET(filebrowser_types, FILEBROWSER_SELECT_FILE);
break;
case DISPLAYLIST_GENERIC:
break;
default:
break;
@ -3857,6 +3865,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
menu_entries_add_enum(info->list, info->path,
info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0);
break;
case DISPLAYLIST_FILE_BROWSER_SELECT_DIR:
case DISPLAYLIST_FILE_BROWSER_SELECT_FILE:
case DISPLAYLIST_GENERIC:
{
menu_ctx_list_t list_info;

View File

@ -187,6 +187,8 @@ typedef struct menu_displaylist_ctx_entry
file_list_t *list;
} menu_displaylist_ctx_entry_t;
void menu_displaylist_reset_filebrowser(void);
bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data);
RETRO_END_DECLS