Adding a function to abort all downloads.

SVN revision: 25634
This commit is contained in:
balony 2006-09-08 16:52:29 +00:00 committed by balony
parent 7b44542ef9
commit 54c1f3e1ee
2 changed files with 24 additions and 0 deletions

View File

@ -102,6 +102,7 @@ extern "C" {
long int ultotal,
long int ulnow),
void *data);
EAPI void ecore_file_download_abort_all(void);
EAPI int ecore_file_download_protocol_available(const char *protocol);
#ifdef __cplusplus

View File

@ -82,6 +82,29 @@ ecore_file_download_shutdown(void)
return init;
}
void
ecore_file_download_abort_all(void)
{
#ifdef HAVE_CURL
Ecore_File_Download_Job *job;
if (!_job_list)
return;
ecore_list_goto_first(_job_list);
while ((job = ecore_list_next(_job_list)))
{
ecore_main_fd_handler_del(job->fd_handler);
curl_multi_remove_handle(curlm, job->curl);
curl_easy_cleanup(job->curl);
fclose(job->file);
free(job->dst);
free(job);
}
ecore_list_clear(_job_list);
#endif
}
EAPI int
ecore_file_download(const char *url, const char *dst,
void (*completion_cb)(void *data, const char *file, int status),