From d099536de8a102bf133672a54bb2d5f17df5f8e2 Mon Sep 17 00:00:00 2001 From: caro Date: Sat, 23 Oct 2010 11:33:56 +0000 Subject: [PATCH] [ecore-file] use function pointers for callbacks git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@53811 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_file/Ecore_File.h | 28 +++++++++++++++++++--------- src/lib/ecore_file/ecore_file_download.c | 22 ++++++++-------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/lib/ecore_file/Ecore_File.h b/src/lib/ecore_file/Ecore_File.h index 0ead8b9..0af0ec4 100644 --- a/src/lib/ecore_file/Ecore_File.h +++ b/src/lib/ecore_file/Ecore_File.h @@ -88,6 +88,23 @@ enum _Ecore_File_Event */ typedef void (*Ecore_File_Monitor_Cb)(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); +/** + * @typedef Ecore_File_Download_Completion_Cb + * Callback type used when a download is finished. + */ +typedef void (*Ecore_File_Download_Completion_Cb)(void *data, const char *file, int status); + +/** + * @typedef Ecore_File_Download_Progress_Cb + * Callback type used when a download is finished. + */ +typedef int (*Ecore_File_Download_Progress_Cb)(void *data, + const char *file, + long int dltotal, + long int dlnow, + long int ultotal, + long int ulnow); + /* File operations */ EAPI int ecore_file_init (void); @@ -140,15 +157,8 @@ EAPI Eina_List *ecore_file_app_list(void); EAPI Eina_Bool ecore_file_download(const char *url, const char *dst, - void (*completion_cb)(void *data, - const char *file, - int status), - int (*progress_cb)(void *data, - const char *file, - long int dltotal, - long int dlnow, - long int ultotal, - long int ulnow), + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, void *data, Ecore_File_Download_Job **job_ret); EAPI void ecore_file_download_abort_all(void); diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c index 12f9a22..aa4b6a1 100644 --- a/src/lib/ecore_file/ecore_file_download.c +++ b/src/lib/ecore_file/ecore_file_download.c @@ -24,17 +24,14 @@ struct _Ecore_File_Download_Job char *dst; - void (*completion_cb)(void *data, const char *file, int status); - - int (*progress_cb) (void *data, const char *file, - long int dltotal, long int dlnow, - long int ultotal, long int ulnow); + Ecore_File_Download_Completion_Cb completion_cb; + Ecore_File_Download_Progress_Cb progress_cb; }; #ifdef HAVE_CURL Ecore_File_Download_Job *_ecore_file_download_curl(const char *url, const char *dst, - void (*completion_cb)(void *data, const char *file, int status), - int (*progress_cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow), + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, void *data); static Eina_Bool _ecore_file_download_url_complete_cb(void *data, int type, void *event); @@ -117,8 +114,8 @@ ecore_file_download_shutdown(void) EAPI Eina_Bool ecore_file_download(const char *url, const char *dst, - void (*completion_cb)(void *data, const char *file, int status), - int (*progress_cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow), + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, void *data, Ecore_File_Download_Job **job_ret) { @@ -257,11 +254,8 @@ _ecore_file_download_url_progress_cb(void *data __UNUSED__, int type __UNUSED__, Ecore_File_Download_Job * _ecore_file_download_curl(const char *url, const char *dst, - void (*completion_cb)(void *data, const char *file, - int status), - int (*progress_cb)(void *data, const char *file, - long int dltotal, long int dlnow, - long int ultotal, long int ulnow), + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, void *data) { Ecore_File_Download_Job *job; -- 2.7.4