extra: add a data field to the progress struct

the data field will be passed to the callback when its called.
This commit is contained in:
Marcel Hollerbach 2017-01-14 14:04:11 +01:00
parent 4a3007e094
commit 285cb4864a
2 changed files with 9 additions and 5 deletions

View File

@ -269,7 +269,7 @@ _url_complete_cb(void *data, int type EINA_UNUSED, void *event_info)
}
if (progress->done_cb)
progress->done_cb();
progress->done_cb(progress->data);
ecore_event_handler_del(_data);
ecore_event_handler_del(_complete);
@ -349,7 +349,7 @@ _download_complete_cb(void *data, const char *file EINA_UNUSED, int status EINA_
job->theme->state &= (~job->nand_mask);
if (job->progress->done_cb)
job->progress->done_cb();
job->progress->done_cb(job->progress->data);
}
static int
@ -364,7 +364,7 @@ _download_progress_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED,
percent = ((double)(double)dlnow / (double)dltotal);
if (job->progress->progress_cb)
job->progress->progress_cb(percent);
job->progress->progress_cb(job->progress->data, percent);
return ECORE_FILE_PROGRESS_CONTINUE;
}

View File

@ -38,6 +38,9 @@ extern "C" {
* @brief These routines are used for extra library interaction.
*/
typedef void (*Extra_Progress_Cb)(void *data, double progress);
typedef void (*Extra_Done_Cb)(void *data);
typedef struct _Extra_Theme
{
const char *id;
@ -49,8 +52,9 @@ typedef struct _Extra_Theme
typedef struct _Extra_Progress
{
void (*progress_cb)(double progress);
void (*done_cb)(void);
Extra_Progress_Cb progress_cb;
Extra_Done_Cb done_cb;
void *data;
} Extra_Progress;
/**