forked from enlightenment/efl
allow the compilation of ecore_file without ecore_con
SVN revision: 43075
This commit is contained in:
parent
1b5648be62
commit
297e9817df
|
@ -12,6 +12,8 @@
|
||||||
#include "Ecore_Con.h"
|
#include "Ecore_Con.h"
|
||||||
#include "ecore_file_private.h"
|
#include "ecore_file_private.h"
|
||||||
|
|
||||||
|
#ifdef BUILD_ECORE_CON
|
||||||
|
|
||||||
#define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8
|
#define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8
|
||||||
|
|
||||||
typedef struct _Ecore_File_Download_Job Ecore_File_Download_Job;
|
typedef struct _Ecore_File_Download_Job Ecore_File_Download_Job;
|
||||||
|
@ -46,10 +48,12 @@ static Ecore_Event_Handler *_url_complete_handler = NULL;
|
||||||
static Ecore_Event_Handler *_url_progress_download = NULL;
|
static Ecore_Event_Handler *_url_progress_download = NULL;
|
||||||
static Eina_List *_job_list;
|
static Eina_List *_job_list;
|
||||||
|
|
||||||
|
#endif /* BUILD_ECORE_CON */
|
||||||
|
|
||||||
int
|
int
|
||||||
ecore_file_download_init(void)
|
ecore_file_download_init(void)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifdef BUILD_ECORE_CON
|
||||||
if (!ecore_con_url_init())
|
if (!ecore_con_url_init())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -58,16 +62,15 @@ ecore_file_download_init(void)
|
||||||
_url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
|
_url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#endif /* BUILD_ECORE_CON */
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ecore_file_download_shutdown(void)
|
ecore_file_download_shutdown(void)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifdef BUILD_ECORE_CON
|
||||||
if (_url_complete_handler)
|
if (_url_complete_handler)
|
||||||
ecore_event_handler_del(_url_complete_handler);
|
ecore_event_handler_del(_url_complete_handler);
|
||||||
if (_url_progress_download)
|
if (_url_progress_download)
|
||||||
|
@ -77,16 +80,18 @@ ecore_file_download_shutdown(void)
|
||||||
ecore_file_download_abort_all();
|
ecore_file_download_abort_all();
|
||||||
|
|
||||||
ecore_con_url_shutdown();
|
ecore_con_url_shutdown();
|
||||||
#endif
|
#endif /* BUILD_ECORE_CON */
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_file_download_abort_all(void)
|
ecore_file_download_abort_all(void)
|
||||||
{
|
{
|
||||||
|
#ifdef BUILD_ECORE_CON
|
||||||
Ecore_File_Download_Job *job;
|
Ecore_File_Download_Job *job;
|
||||||
|
|
||||||
EINA_LIST_FREE(_job_list, job)
|
EINA_LIST_FREE(_job_list, job)
|
||||||
_ecore_file_download_abort(job);
|
_ecore_file_download_abort(job);
|
||||||
|
#endif /* BUILD_ECORE_CON */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,6 +112,7 @@ ecore_file_download(const char *url, const char *dst,
|
||||||
int (*progress_cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow),
|
int (*progress_cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow),
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
#ifdef BUILD_ECORE_CON
|
||||||
char *dir = ecore_file_dir_get(dst);
|
char *dir = ecore_file_dir_get(dst);
|
||||||
|
|
||||||
if (!ecore_file_is_dir(dir))
|
if (!ecore_file_is_dir(dir))
|
||||||
|
@ -147,11 +153,11 @@ ecore_file_download(const char *url, const char *dst,
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifndef HAVE_CURL
|
#else
|
||||||
completion_cb = NULL;
|
completion_cb = NULL;
|
||||||
progress_cb = NULL;
|
progress_cb = NULL;
|
||||||
data = NULL;
|
data = NULL;
|
||||||
#endif
|
#endif /* BUILD_ECORE_CON */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,15 +171,19 @@ ecore_file_download(const char *url, const char *dst,
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_download_protocol_available(const char *protocol)
|
ecore_file_download_protocol_available(const char *protocol)
|
||||||
{
|
{
|
||||||
|
#ifdef BUILD_ECORE_CON
|
||||||
if (!strncmp(protocol, "file://", 7)) return 1;
|
if (!strncmp(protocol, "file://", 7)) return 1;
|
||||||
# ifdef HAVE_CURL
|
# ifdef HAVE_CURL
|
||||||
else if (!strncmp(protocol, "http://", 7)) return 1;
|
else if (!strncmp(protocol, "http://", 7)) return 1;
|
||||||
else if (!strncmp(protocol, "ftp://", 6)) return 1;
|
else if (!strncmp(protocol, "ftp://", 6)) return 1;
|
||||||
# endif
|
# endif
|
||||||
|
#endif /* BUILD_ECORE_CON */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BUILD_ECORE_CON
|
||||||
|
|
||||||
# ifdef HAVE_CURL
|
# ifdef HAVE_CURL
|
||||||
static int
|
static int
|
||||||
_ecore_file_download_url_compare_job(const void *data1, const void *data2)
|
_ecore_file_download_url_compare_job(const void *data1, const void *data2)
|
||||||
|
@ -282,3 +292,4 @@ _ecore_file_download_abort(Ecore_File_Download_Job *job)
|
||||||
free(job->dst);
|
free(job->dst);
|
||||||
free(job);
|
free(job);
|
||||||
}
|
}
|
||||||
|
#endif /* BUILD_ECORE_CON */
|
||||||
|
|
Loading…
Reference in New Issue