From 25b5cfdb1c9ab477f9dc9ff0bb09dbe0a7df3ca9 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 21 Jun 2008 02:45:15 +0000 Subject: [PATCH] updated svn path=/trunk/; revision=9014 --- camel/camel-mime-filter-progress.c | 19 +++++++++---------- camel/camel-mime-filter-progress.h | 8 +++++--- camel/camel-stream-null.h | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/camel/camel-mime-filter-progress.c b/camel/camel-mime-filter-progress.c index 2dd84d5..9784f00 100644 --- a/camel/camel-mime-filter-progress.c +++ b/camel/camel-mime-filter-progress.c @@ -79,19 +79,16 @@ filter_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace, char **out, size_t *outlen, size_t *outprespace) { CamelMimeFilterProgress *progress = (CamelMimeFilterProgress *) filter; - CamelOperation *operation; double percent; progress->count += len; - if ((operation = camel_operation_registered ())) { - if (progress->count < progress->total) - percent = ((double) progress->count * 100.0) / ((double) progress->total); - else - percent = 100.0; - - camel_operation_progress (operation, (int) percent); - } + if (progress->count < progress->total) + percent = ((double) progress->count * 100.0) / ((double) progress->total); + else + percent = 100.0; + + camel_operation_progress (progress->operation, (int) percent); *outprespace = prespace; *outlen = len; @@ -128,6 +125,7 @@ camel_mime_filter_progress_class_init (CamelMimeFilterProgressClass *klass) /** * camel_mime_filter_progress_new: + * @operation: a #CamelOperation * @total: total number of bytes to report progress on * * Create a new #CamelMimeFilterProgress object that will report @@ -136,11 +134,12 @@ camel_mime_filter_progress_class_init (CamelMimeFilterProgressClass *klass) * Returns a new #CamelMimeFilter object **/ CamelMimeFilter * -camel_mime_filter_progress_new (guint32 total) +camel_mime_filter_progress_new (CamelOperation *operation, size_t total) { CamelMimeFilter *filter; filter = (CamelMimeFilter *) camel_object_new (camel_mime_filter_progress_get_type ()); + ((CamelMimeFilterProgress *) filter)->operation = operation; ((CamelMimeFilterProgress *) filter)->total = total; return filter; diff --git a/camel/camel-mime-filter-progress.h b/camel/camel-mime-filter-progress.h index 9ea7529..bd81263 100644 --- a/camel/camel-mime-filter-progress.h +++ b/camel/camel-mime-filter-progress.h @@ -24,6 +24,7 @@ #ifndef __CAMEL_MIME_FILTER_PROGRESS_H__ #define __CAMEL_MIME_FILTER_PROGRESS_H__ +#include #include #define CAMEL_MIME_FILTER_PROGRESS(obj) CAMEL_CHECK_CAST (obj, camel_mime_filter_progress_get_type (), CamelMimeFilterProgress) @@ -38,8 +39,9 @@ typedef struct _CamelMimeFilterProgress CamelMimeFilterProgress; struct _CamelMimeFilterProgress { CamelMimeFilter parent; - guint32 total; - guint32 count; + CamelOperation *operation; + size_t total; + size_t count; }; struct _CamelMimeFilterProgressClass { @@ -50,7 +52,7 @@ struct _CamelMimeFilterProgressClass { CamelType camel_mime_filter_progress_get_type (void); -CamelMimeFilter *camel_mime_filter_progress_new (guint32 total); +CamelMimeFilter *camel_mime_filter_progress_new (CamelOperation *operation, size_t total); G_END_DECLS diff --git a/camel/camel-stream-null.h b/camel/camel-stream-null.h index 9ca1bfb..2a5a99f 100644 --- a/camel/camel-stream-null.h +++ b/camel/camel-stream-null.h @@ -43,9 +43,9 @@ struct _CamelStreamNullClass { CamelStreamClass parent_class; }; -CamelType camel_stream_null_get_type (void); +CamelType camel_stream_null_get_type (void); -CamelStream *camel_stream_null_new (void); +CamelStream *camel_stream_null_new (void); G_END_DECLS -- 2.7.4