From c881b5bc5e61d04b18d4ab46ad70533e7340d15b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 21 Oct 2010 16:21:19 -0400 Subject: Simplify EActivity. With unintrusive error dialogs gone, we can cut some unnecessary bits out of EActivity. I'm also adding a new enum property called "state", which is one of: E_ACTIVITY_RUNNING E_ACTIVITY_WAITING E_ACTIVITY_CANCELLED E_ACTIVITY_COMPLETED The state of an activity must be explicitly changed. In particular, when the user cancels an activity the state should be set only after confirming the operation has been cancelled and not when cancellation is requested (e.g. after receiving a G_IO_ERROR_CANCELLED, not when the GCancellable emits "cancelled"). EActivityBar and EActivityProxy widgets have been updated to make this distinction clearer in the UI. E_ACTIVITY_WAITING will be used when activities have to be queued and dispatched in sequence, which I haven't written yet. --- mail/em-format-html.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'mail/em-format-html.c') diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 1e3c6b9abd..de8c0b5961 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -166,7 +166,9 @@ efh_format_desc (struct _format_msg *m) } static void -efh_format_exec (struct _format_msg *m) +efh_format_exec (struct _format_msg *m, + GCancellable *cancellable, + GError **error) { EMFormat *format; struct _EMFormatHTMLJob *job; @@ -195,7 +197,7 @@ efh_format_exec (struct _format_msg *m) if (format->mode == EM_FORMAT_MODE_SOURCE) { em_format_format_source ( format, (CamelStream *) m->estream, - (CamelMimePart *) m->message, m->base.cancellable); + (CamelMimePart *) m->message, cancellable); } else { const EMFormatHandler *handle; const gchar *mime_type; @@ -207,7 +209,7 @@ efh_format_exec (struct _format_msg *m) handle->handler ( format, CAMEL_STREAM (m->estream), CAMEL_MIME_PART (m->message), handle, - m->base.cancellable, FALSE); + cancellable, FALSE); mime_type = "x-evolution/message/rfc822"; handle = em_format_find_handler (format, mime_type); @@ -216,10 +218,10 @@ efh_format_exec (struct _format_msg *m) handle->handler ( format, CAMEL_STREAM (m->estream), CAMEL_MIME_PART (m->message), handle, - m->base.cancellable, FALSE); + cancellable, FALSE); } - camel_stream_flush ((CamelStream *)m->estream, m->base.cancellable, NULL); + camel_stream_flush ((CamelStream *)m->estream, cancellable, NULL); puri_level = format->pending_uri_level; base = format->base; @@ -232,13 +234,13 @@ efh_format_exec (struct _format_msg *m) /* This is an implicit check to see if the gtkhtml has been destroyed */ if (m->format->priv->web_view == NULL) - g_cancellable_cancel (m->base.cancellable); + g_cancellable_cancel (cancellable); /* call jobs even if cancelled, so they can clean up resources */ format->pending_uri_level = job->puri_level; if (job->base) format->base = job->base; - job->callback (job, m->base.cancellable); + job->callback (job, cancellable); format->base = base; /* clean up the job */ @@ -257,8 +259,8 @@ efh_format_exec (struct _format_msg *m) d(printf("out of jobs, closing root stream\n")); camel_stream_write_string ( (CamelStream *) m->estream, - "\n\n", m->base.cancellable, NULL); - camel_stream_close ((CamelStream *)m->estream, m->base.cancellable, NULL); + "\n\n", cancellable, NULL); + camel_stream_close ((CamelStream *)m->estream, cancellable, NULL); g_object_unref (m->estream); m->estream = NULL; } @@ -287,7 +289,7 @@ efh_format_free (struct _format_msg *m) d(printf("formatter freed\n")); g_object_unref (m->format); if (m->estream) { - camel_stream_close ((CamelStream *)m->estream, m->base.cancellable, NULL); + camel_stream_close ((CamelStream *)m->estream, NULL, NULL); g_object_unref (m->estream); } if (m->folder) -- cgit