Use new 'Download Content' option

This commit is contained in:
twinaphex 2016-06-21 04:21:18 +02:00
parent 4eaf718a6e
commit 982330ef86
6 changed files with 29 additions and 9 deletions

View File

@ -14,9 +14,11 @@
*/
#include <file/file_path.h>
#include <string/stdstring.h>
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../../msg_hash.h"
#ifndef BIND_ACTION_CANCEL
#define BIND_ACTION_CANCEL(cbs, name) \
@ -30,11 +32,24 @@ static int action_cancel_pop_default(const char *path,
return menu_entry_go_back();
}
static int action_cancel_core_content(const char *path,
const char *label, unsigned type, size_t idx)
{
menu_entries_flush_stack(msg_hash_to_str(MENU_ENUM_LABEL_ADD_CONTENT_LIST), 0);
return 0;
}
static int menu_cbs_init_bind_cancel_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t hash, const char *elem0)
const char *label, uint32_t hash, const char *elem0, const char *menu_label)
{
uint32_t elem0_hash = msg_hash_calculate(elem0);
if (string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST)))
{
BIND_ACTION_CANCEL(cbs, action_cancel_core_content);
return 0;
}
return -1;
}
@ -47,15 +62,16 @@ static int menu_cbs_init_bind_cancel_compare_type(
int menu_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1,
const char *elem0, const char *elem1, const char *menu_label,
uint32_t label_hash, uint32_t menu_label_hash)
{
if (!cbs)
return -1;
BIND_ACTION_CANCEL(cbs, action_cancel_pop_default);
if (menu_cbs_init_bind_cancel_compare_label(cbs, label, label_hash, elem0) == 0)
if (menu_cbs_init_bind_cancel_compare_label(cbs, label, label_hash, elem0, menu_label) == 0)
return 0;
if (menu_cbs_init_bind_cancel_compare_type(

View File

@ -1665,8 +1665,6 @@ static void cb_generic_dir_download(void *task_data,
menu_file_transfer_t *transf = (menu_file_transfer_t*)user_data;
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
RARCH_LOG("transf->path: %s\n", transf->path);
generic_action_ok_network(transf->path, transf->path, 0, 0, 0,
MENU_ENUM_LABEL_CB_CORE_CONTENT_LIST);
}

View File

@ -750,6 +750,12 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
return 0;
}
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST)))
{
BIND_ACTION_GET_TITLE(cbs, action_get_download_core_content_list);
return 0;
}
if (cbs->enum_idx != MSG_UNKNOWN)
{
switch (cbs->enum_idx)

View File

@ -85,7 +85,7 @@ void menu_cbs_init(void *data,
menu_cbs_init_log(repr_label, "OK", cbs->action_ok_ident);
menu_cbs_init_bind_cancel(cbs, path, label, type, idx, elem0, elem1, label_hash, menu_label_hash);
menu_cbs_init_bind_cancel(cbs, path, label, type, idx, elem0, elem1, menu_label, label_hash, menu_label_hash);
menu_cbs_init_log(repr_label, "CANCEL", cbs->action_cancel_ident);

View File

@ -159,7 +159,7 @@ int menu_cbs_init_bind_content_list_switch(menu_file_list_cbs_t *cbs,
int menu_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1,
const char *elem0, const char *elem1, const char *menu_label,
uint32_t label_hash, uint32_t menu_label_hash);
int menu_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,

View File

@ -2826,8 +2826,8 @@ static int menu_displaylist_parse_add_content_list(
#ifdef HAVE_NETWORKING
menu_entries_add_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT),
msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT),
MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT,
msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT_DIRS),
MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT_DIRS,
MENU_SETTING_ACTION, 0, 0);
#endif