Get rid of one of the last remaining hash dependencies in menu_displaylist.c

This commit is contained in:
twinaphex 2016-07-10 03:08:18 +02:00
parent 4e347d96b8
commit c938f86235
4 changed files with 31 additions and 4 deletions

View File

@ -257,6 +257,13 @@ int generic_action_ok_displaylist_push(const char *path,
info_label = label;
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_SCAN_DIR_LIST:
info.type = FILE_TYPE_DIRECTORY;
info.directory_ptr = idx;
info_path = new_path;
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SCAN_DIR;
break;
case ACTION_OK_DL_REMAP_FILE:
info.type = type;
info.directory_ptr = idx;
@ -2651,6 +2658,15 @@ static int action_ok_push_content_list(const char *path,
entry_idx, ACTION_OK_DL_CONTENT_LIST);
}
static int action_ok_scan_directory_list(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
return generic_action_ok_displaylist_push(path,
settings->directory.menu_content, label, type, idx,
entry_idx, ACTION_OK_DL_SCAN_DIR_LIST);
}
static int action_ok_push_downloads_dir(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -3201,8 +3217,10 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_CONTENT_SETTINGS:
BIND_ACTION_OK(cbs, action_ok_push_default);
break;
case MENU_ENUM_LABEL_SCAN_FILE:
case MENU_ENUM_LABEL_SCAN_DIRECTORY:
BIND_ACTION_OK(cbs, action_ok_scan_directory_list);
break;
case MENU_ENUM_LABEL_SCAN_FILE:
case MENU_ENUM_LABEL_LOAD_CONTENT:
case MENU_ENUM_LABEL_DETECT_CORE_LIST:
BIND_ACTION_OK(cbs, action_ok_push_content_list);

View File

@ -27,6 +27,7 @@ enum
ACTION_OK_DL_DEFAULT = 0,
ACTION_OK_DL_OPEN_ARCHIVE,
ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE,
ACTION_OK_DL_SCAN_DIR_LIST,
ACTION_OK_DL_HELP,
ACTION_OK_DL_RPL_ENTRY,
ACTION_OK_DL_RDB_ENTRY,

View File

@ -3208,6 +3208,7 @@ enum filebrowser_enums
{
FILEBROWSER_NONE = 0,
FILEBROWSER_SELECT_DIR,
FILEBROWSER_SCAN_DIR,
FILEBROWSER_SELECT_COLLECTION
};
@ -3340,7 +3341,7 @@ static int menu_displaylist_parse_generic(
filter_ext ? info->exts : NULL,
true, true);
if (string_is_equal(info->label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY)))
if (BIT32_GET(filebrowser_types, FILEBROWSER_SCAN_DIR))
menu_entries_prepend(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY),
msg_hash_to_str(MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY),
@ -3448,8 +3449,9 @@ static int menu_displaylist_parse_generic(
if (!is_dir)
{
uint32_t hash_label = msg_hash_calculate(info->label);
if (push_dir || hash_label == MENU_LABEL_SCAN_DIRECTORY)
if (push_dir)
continue;
if (BIT32_GET(filebrowser_types, FILEBROWSER_SCAN_DIR))
continue;
}
@ -3928,6 +3930,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
switch (type)
{
case DISPLAYLIST_FILE_BROWSER_SCAN_DIR:
BIT32_CLEAR_ALL(filebrowser_types);
BIT32_SET(filebrowser_types, FILEBROWSER_SCAN_DIR);
break;
case DISPLAYLIST_FILE_BROWSER_SELECT_DIR:
BIT32_CLEAR_ALL(filebrowser_types);
BIT32_SET(filebrowser_types, FILEBROWSER_SELECT_DIR);
@ -3948,6 +3954,7 @@ 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_SCAN_DIR:
case DISPLAYLIST_FILE_BROWSER_SELECT_DIR:
case DISPLAYLIST_FILE_BROWSER_SELECT_FILE:
case DISPLAYLIST_FILE_BROWSER_SELECT_CORE:

View File

@ -65,6 +65,7 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_PLAYLIST_COLLECTION,
DISPLAYLIST_DEFAULT,
DISPLAYLIST_FILE_BROWSER_SELECT_DIR,
DISPLAYLIST_FILE_BROWSER_SCAN_DIR,
DISPLAYLIST_FILE_BROWSER_SELECT_FILE,
DISPLAYLIST_FILE_BROWSER_SELECT_CORE,
DISPLAYLIST_FILE_BROWSER_SELECT_COLLECTION,