First working implementation of subdirs for URL lists

This commit is contained in:
twinaphex 2016-07-12 18:29:31 +02:00
parent 490af3cb3e
commit d903ad2b97
7 changed files with 54 additions and 14 deletions

View File

@ -1461,6 +1461,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
return "deferred_core_content_list";
case MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST:
return "deferred_core_content_dirs_list";
case MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST:
return "deferred_core_content_dirs_subdir_list";
case MENU_ENUM_LABEL_DEFERRED_LAKKA_LIST:
return "deferred_lakka_list";
case MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT:

View File

@ -357,6 +357,11 @@ static int deferred_push_core_content_dirs_list(menu_displaylist_info_t *info)
return deferred_push_dlist(info, DISPLAYLIST_CORE_CONTENT_DIRS);
}
static int deferred_push_core_content_dirs_subdir_list(menu_displaylist_info_t *info)
{
return deferred_push_dlist(info, DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR);
}
static int deferred_push_lakka_list(menu_displaylist_info_t *info)
{
return deferred_push_dlist(info, DISPLAYLIST_LAKKA);
@ -778,6 +783,14 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
return 0;
}
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST)))
{
#ifdef HAVE_NETWORKING
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_content_dirs_subdir_list);
#endif
return 0;
}
if (strstr(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_rdb_entry_detail);
@ -834,6 +847,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
case MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST:
#ifdef HAVE_NETWORKING
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_content_dirs_list);
#endif
break;
case MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST:
#ifdef HAVE_NETWORKING
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_content_dirs_subdir_list);
#endif
break;
case MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST:

View File

@ -81,25 +81,13 @@ static void cb_net_generic_subdir(void *task_data, void *user_data, const char *
finish:
if (!err && !strstr(subdir_path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
{
char *last = NULL;
char parent_dir[PATH_MAX_LENGTH] = {0};
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
bool refresh = true;
fill_pathname_parent_dir(parent_dir,
state->path, sizeof(parent_dir));
last = (char*)strrchr(parent_dir, '/');
if (*last)
*last = '\0';
menu_entries_prepend(selection_buf,
subdir_path,
parent_dir,
MENU_ENUM_LABEL_URL_ENTRY,
FILE_TYPE_DOWNLOAD_URL, 0 ,0);
menu_entries_ctl(MENU_ENTRIES_CTL_UNSET_REFRESH, &refresh);
/* TODO/FIXME - fix this */
generic_action_ok_displaylist_push(parent_dir, NULL,
subdir_path, 0, 0, 0, ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST);
}
if (err)
@ -494,6 +482,19 @@ int generic_action_ok_displaylist_push(const char *path,
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST;
dl_type = DISPLAYLIST_PENDING_CLEAR;
break;
case ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST:
{
char new_path[PATH_MAX_LENGTH];
snprintf(new_path, sizeof(new_path), "%s;%s", path, label);
info.type = type;
info.directory_ptr = idx;
info_path = new_path;
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST;
dl_type = DISPLAYLIST_GENERIC;
}
break;
case ACTION_OK_DL_CORE_CONTENT_DIRS_LIST:
info.type = type;
info.directory_ptr = idx;

View File

@ -74,6 +74,7 @@ enum
ACTION_OK_DL_THUMBNAILS_UPDATER_LIST,
ACTION_OK_DL_CORE_CONTENT_LIST,
ACTION_OK_DL_CORE_CONTENT_DIRS_LIST,
ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST,
ACTION_OK_DL_DEFERRED_CORE_LIST,
ACTION_OK_DL_DEFERRED_CORE_LIST_SET,
ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST,

View File

@ -5109,6 +5109,22 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
info->need_refresh = true;
#endif
break;
case DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR:
{
#ifdef HAVE_NETWORKING
struct string_list *str_list = string_split(info->path, ";");
char new_label[PATH_MAX_LENGTH] = {0};
strlcpy(new_label, str_list->elems[0].data, sizeof(new_label));
strlcpy(core_buf, str_list->elems[1].data, core_len);
print_buf_lines(info->list, core_buf, new_label,
core_len, FILE_TYPE_DOWNLOAD_URL);
info->need_push = true;
info->need_refresh = true;
string_list_free(str_list);
#endif
}
break;
case DISPLAYLIST_CORE_CONTENT_DIRS:
{
#ifdef HAVE_NETWORKING

View File

@ -145,6 +145,7 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_ARCHIVE_ACTION_DETECT_CORE,
DISPLAYLIST_CORE_CONTENT,
DISPLAYLIST_CORE_CONTENT_DIRS,
DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR,
DISPLAYLIST_PROCESS,
DISPLAYLIST_PUSH_ONTO_STACK,
DISPLAYLIST_PENDING_CLEAR

View File

@ -721,6 +721,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN,
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST,
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST,
MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST,
MENU_ENUM_LABEL_DEFERRED_LAKKA_LIST,
MENU_ENUM_LABEL_DEFERRED_INPUT_HOTKEY_BINDS_LIST,
MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST,