[evolution] Adapt to Camel API changes.



commit 31b57ed0383b2ea225195d4b72a872f7f2d93163
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Sep 20 23:13:43 2010 -0400

    Adapt to Camel API changes.

 calendar/gui/dialogs/comp-editor.c               |    6 +-
 composer/e-composer-private.c                    |    3 +-
 composer/e-msg-composer.c                        |  167 +++++++--------
 composer/e-msg-composer.h                        |   14 +-
 e-util/e-activity.c                              |    6 +-
 e-util/e-signature-utils.c                       |    5 +-
 em-format/em-format-quote.c                      |   38 ++--
 em-format/em-format.c                            |  117 ++++++-----
 em-format/em-format.h                            |   12 +-
 mail/e-mail-backend.c                            |    4 +-
 mail/e-mail-local.c                              |    2 +-
 mail/e-mail-migrate.c                            |    8 +-
 mail/e-mail-store.c                              |    8 +-
 mail/em-composer-utils.c                         |   22 ++-
 mail/em-folder-tree.c                            |   22 +-
 mail/em-folder-utils.c                           |   28 ++--
 mail/em-format-html-display.c                    |   53 +++--
 mail/em-format-html.c                            |  253 +++++++++++++---------
 mail/em-format-html.h                            |    3 +-
 mail/em-html-stream.c                            |    2 +-
 mail/em-inline-filter.c                          |    6 +-
 mail/em-subscribe-editor.c                       |    6 +-
 mail/em-sync-stream.c                            |    3 +
 mail/em-utils.c                                  |   44 ++--
 mail/importers/evolution-mbox-importer.c         |    4 +-
 mail/importers/mail-importer.c                   |   35 +--
 mail/mail-folder-cache.c                         |   14 +-
 mail/mail-mt.c                                   |   16 +-
 mail/mail-ops.c                                  |  172 ++++++---------
 mail/mail-ops.h                                  |    3 +-
 mail/mail-send-recv.c                            |    5 +-
 mail/mail-session.c                              |    8 +-
 mail/mail-tools.c                                |   11 +-
 mail/mail-vfolder.c                              |   10 +-
 modules/calendar/e-cal-attachment-handler.c      |    2 +-
 modules/composer-autosave/e-autosave-utils.c     |   13 +-
 modules/mail/e-mail-attachment-handler.c         |    9 +-
 modules/mail/e-mail-shell-view.c                 |    2 -
 plugins/audio-inline/audio-inline.c              |    5 +-
 plugins/bogo-junk-plugin/bf-junk-filter.c        |   31 ++-
 plugins/dbx-import/dbx-importer.c                |   29 +--
 plugins/groupwise-features/install-shared.c      |    7 +-
 plugins/groupwise-features/proxy.c               |    2 +-
 plugins/groupwise-features/share-folder-common.c |    4 +-
 plugins/groupwise-features/status-track.c        |    2 +-
 plugins/image-inline/image-inline.c              |    3 +-
 plugins/itip-formatter/itip-formatter.c          |    4 +-
 plugins/mail-to-task/mail-to-task.c              |    4 +-
 plugins/mark-all-read/mark-all-read.c            |    4 +-
 plugins/prefer-plain/prefer-plain.c              |    2 +-
 plugins/pst-import/pst-importer.c                |   34 ++--
 plugins/sa-junk-plugin/em-junk-filter.c          |   59 +++--
 plugins/templates/templates.c                    |   15 +-
 plugins/tnef-attachments/tnef-plugin.c           |    7 +-
 plugins/vcard-inline/vcard-inline.c              |    3 +-
 widgets/misc/e-attachment.c                      |   11 +-
 56 files changed, 725 insertions(+), 637 deletions(-)
---
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 6c3179c..2213d47 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -3040,14 +3040,16 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
 		byte_array = g_byte_array_new ();
 		stream = camel_stream_mem_new_with_byte_array (byte_array);
 
-		camel_data_wrapper_decode_to_stream (wrapper, stream, NULL);
+		camel_data_wrapper_decode_to_stream_sync (
+			wrapper, stream, NULL, NULL);
 		buffer = g_memdup (byte_array->data, byte_array->len);
 
 		camel_mime_part_set_content_id (mime_part, NULL);
 
 		cal_mime_attach->encoded_data = (gchar *)buffer;
 		cal_mime_attach->length = byte_array->len;
-		cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part));
+		cal_mime_attach->filename =
+			g_strdup (camel_mime_part_get_filename (mime_part));
 		desc = camel_mime_part_get_description (mime_part);
 		if (!desc || *desc == '\0')
 			desc = _("attachment");
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index d4dcb46..01ffda6 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -110,7 +110,8 @@ msg_composer_url_requested_cb (GtkHTML *html,
 	array = g_byte_array_new ();
 	camel_stream = camel_stream_mem_new_with_byte_array (array);
 	wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
-	camel_data_wrapper_decode_to_stream (wrapper, camel_stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (
+		wrapper, camel_stream, NULL, NULL);
 
 	gtk_html_write (html, stream, (gchar *) array->data, array->len);
 
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 5ef78d5..f5f4778 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -105,19 +105,19 @@ static void	add_attachments_from_multipart	(EMsgComposer *composer,
 /* used by e_msg_composer_new_with_message () */
 static void	handle_multipart		(EMsgComposer *composer,
 						 CamelMultipart *multipart,
-						 CamelOperation *operation,
+						 GCancellable *cancellable,
 						 gint depth);
 static void	handle_multipart_alternative	(EMsgComposer *composer,
 						 CamelMultipart *multipart,
-						 CamelOperation *operation,
+						 GCancellable *cancellable,
 						 gint depth);
 static void	handle_multipart_encrypted	(EMsgComposer *composer,
 						 CamelMimePart *multipart,
-						 CamelOperation *operation,
+						 GCancellable *cancellable,
 						 gint depth);
 static void	handle_multipart_signed		(EMsgComposer *composer,
 						 CamelMultipart *multipart,
-						 CamelOperation *operation,
+						 GCancellable *cancellable,
 						 gint depth);
 
 G_DEFINE_TYPE_WITH_CODE (
@@ -141,7 +141,7 @@ static gchar *
 emcu_part_to_html (CamelMimePart *part,
                    gssize *len,
                    EMFormat *source,
-                   CamelOperation *operation)
+                   GCancellable *cancellable)
 {
 	EMFormatQuote *emfq;
 	CamelStreamMem *mem;
@@ -165,11 +165,10 @@ emcu_part_to_html (CamelMimePart *part,
 				(EMFormat *) emfq, source->charset);
 	}
 	em_format_part (
-		EM_FORMAT (emfq), CAMEL_STREAM (mem),
-		part, G_CANCELLABLE (operation));
+		EM_FORMAT (emfq), CAMEL_STREAM (mem), part, cancellable);
 	g_object_unref (emfq);
 
-	camel_stream_write((CamelStream *) mem, "", 1, NULL);
+	camel_stream_write((CamelStream *) mem, "", 1, cancellable, NULL);
 	g_object_unref (mem);
 
 	text = (gchar *)buf->data;
@@ -610,6 +609,7 @@ static CamelMimeMessage *
 build_message (EMsgComposer *composer,
                gboolean html_content,
                gboolean save_html_object_data,
+               GCancellable *cancellable,
                GError **error)
 {
 	GtkhtmlEditor *editor;
@@ -623,7 +623,6 @@ build_message (EMsgComposer *composer,
 	CamelTransferEncoding plain_encoding;
 	const gchar *iconv_charset = NULL;
 	GPtrArray *recipients = NULL;
-	CamelOperation *operation;
 	CamelMultipart *body = NULL;
 	CamelContentType *type;
 	CamelMimeMessage *new;
@@ -656,8 +655,6 @@ build_message (EMsgComposer *composer,
 		return p->redirect;
 	}
 
-	operation = camel_operation_registered ();
-
 	new = camel_mime_message_new ();
 	build_message_headers (composer, new, FALSE);
 	for (i = 0; i < p->extra_hdr_names->len; i++) {
@@ -761,7 +758,8 @@ build_message (EMsgComposer *composer,
 
 	/* construct the content object */
 	plain = camel_data_wrapper_new ();
-	camel_data_wrapper_construct_from_stream (plain, stream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		plain, stream, NULL, NULL);
 	g_object_unref (stream);
 
 	if (plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE) {
@@ -818,7 +816,8 @@ build_message (EMsgComposer *composer,
 			g_object_unref (mf);
 		}
 
-		camel_data_wrapper_construct_from_stream (html, stream, NULL);
+		camel_data_wrapper_construct_from_stream_sync (
+			html, stream, NULL, NULL);
 		g_object_unref (stream);
 		camel_data_wrapper_set_mime_type (html, "text/html; charset=utf-8");
 
@@ -973,15 +972,11 @@ build_message (EMsgComposer *composer,
 					CAMEL_GPG_CONTEXT (cipher),
 					account->pgp_always_trust);
 
-			camel_operation_start (
-				operation, _("Signing message"));
-			camel_cipher_sign (
+			camel_cipher_context_sign_sync (
 				cipher, pgp_userid,
 				account_hash_algo_to_camel_hash (
 				account ? e_account_get_string (account, E_ACCOUNT_PGP_HASH_ALGORITHM) : NULL),
-				part, npart, G_CANCELLABLE (operation),
-				&local_error);
-			camel_operation_end (operation);
+				part, npart, cancellable, &local_error);
 
 			g_object_unref (cipher);
 
@@ -1008,13 +1003,9 @@ build_message (EMsgComposer *composer,
 					CAMEL_GPG_CONTEXT (cipher),
 					account->pgp_always_trust);
 
-			camel_operation_start (
-				operation, _("Encrypting mesage"));
-			camel_cipher_encrypt (
+			camel_cipher_context_encrypt_sync (
 				cipher, pgp_userid, recipients,
-				part, npart, G_CANCELLABLE (operation),
-				&local_error);
-			camel_operation_end (operation);
+				part, npart, cancellable, &local_error);
 
 			g_object_unref (cipher);
 
@@ -1094,17 +1085,13 @@ build_message (EMsgComposer *composer,
 					TRUE, account->smime_encrypt_key);
 			}
 
-			camel_operation_start (
-				operation, _("Signing message"));
-			camel_cipher_sign (
+			camel_cipher_context_sign_sync (
 				cipher, account->smime_sign_key,
 				account_hash_algo_to_camel_hash (
 					(account != NULL) ?
 					e_account_get_string (account,
 					E_ACCOUNT_SMIME_HASH_ALGORITHM) : NULL),
-				part, npart, G_CANCELLABLE (operation),
-				&local_error);
-			camel_operation_end (operation);
+				part, npart, cancellable, &local_error);
 
 			g_object_unref (cipher);
 
@@ -1130,14 +1117,10 @@ build_message (EMsgComposer *composer,
 				(CamelSMIMEContext *) cipher, TRUE,
 				account->smime_encrypt_key);
 
-			camel_operation_start (
-				operation, _("Encrypting message"));
-			camel_cipher_encrypt (
+			camel_cipher_context_encrypt_sync (
 				cipher, NULL, recipients, part,
-				(CamelMimePart *) new,
-				G_CANCELLABLE (operation),
+				(CamelMimePart *) new, cancellable,
 				&local_error);
-			camel_operation_end (operation);
 
 			g_object_unref (cipher);
 
@@ -1182,9 +1165,6 @@ skip_content:
 		CAMEL_MEDIUM (new), "X-Evolution-Format",
 		html_content ? "text/html" : "text/plain");
 
-	if (operation != NULL)
-		g_object_unref (operation);
-
 	return new;
 
 exception:
@@ -2483,7 +2463,7 @@ e_msg_composer_add_message_attachments (EMsgComposer *composer,
 static void
 handle_multipart_signed (EMsgComposer *composer,
                          CamelMultipart *multipart,
-                         CamelOperation *operation,
+                         GCancellable *cancellable,
                          gint depth)
 {
 	CamelContentType *content_type;
@@ -2527,31 +2507,31 @@ handle_multipart_signed (EMsgComposer *composer,
 			/* Handle the signed content and configure
 			 * the composer to sign outgoing messages. */
 			handle_multipart_signed (
-				composer, multipart, operation, depth);
+				composer, multipart, cancellable, depth);
 
 		} else if (CAMEL_IS_MULTIPART_ENCRYPTED (content)) {
 			/* Decrypt the encrypted content and configure
 			 * the composer to encrypt outgoing messages. */
 			handle_multipart_encrypted (
-				composer, mime_part, operation, depth);
+				composer, mime_part, cancellable, depth);
 
 		} else if (camel_content_type_is (content_type, "multipart", "alternative")) {
 			/* This contains the text/plain and text/html
 			 * versions of the message body. */
 			handle_multipart_alternative (
-				composer, multipart, operation, depth);
+				composer, multipart, cancellable, depth);
 
 		} else {
 			/* There must be attachments... */
 			handle_multipart (
-				composer, multipart, operation, depth);
+				composer, multipart, cancellable, depth);
 		}
 
 	} else if (camel_content_type_is (content_type, "text", "*")) {
 		gchar *html;
 		gssize length;
 
-		html = emcu_part_to_html (mime_part, &length, NULL, operation);
+		html = emcu_part_to_html (mime_part, &length, NULL, cancellable);
 		e_msg_composer_set_pending_body (composer, html, length);
 	} else {
 		e_msg_composer_attach (composer, mime_part);
@@ -2561,7 +2541,7 @@ handle_multipart_signed (EMsgComposer *composer,
 static void
 handle_multipart_encrypted (EMsgComposer *composer,
                             CamelMimePart *multipart,
-                            CamelOperation *operation,
+                            GCancellable *cancellable,
                             gint depth)
 {
 	CamelContentType *content_type;
@@ -2589,11 +2569,8 @@ handle_multipart_encrypted (EMsgComposer *composer,
 	session = e_msg_composer_get_session (composer);
 	cipher = camel_gpg_context_new (session);
 	mime_part = camel_mime_part_new ();
-	camel_operation_start (operation, _("Decrypting message"));
-	valid = camel_cipher_decrypt (
-		cipher, multipart, mime_part,
-		G_CANCELLABLE (operation), NULL);
-	camel_operation_end (operation);
+	valid = camel_cipher_context_decrypt_sync (
+		cipher, multipart, mime_part, cancellable, NULL);
 	g_object_unref (cipher);
 
 	if (valid == NULL)
@@ -2617,31 +2594,31 @@ handle_multipart_encrypted (EMsgComposer *composer,
 			/* Handle the signed content and configure the
 			 * composer to sign outgoing messages. */
 			handle_multipart_signed (
-				composer, content_multipart, operation, depth);
+				composer, content_multipart, cancellable, depth);
 
 		} else if (CAMEL_IS_MULTIPART_ENCRYPTED (content)) {
 			/* Decrypt the encrypted content and configure the
 			 * composer to encrypt outgoing messages. */
 			handle_multipart_encrypted (
-				composer, mime_part, operation, depth);
+				composer, mime_part, cancellable, depth);
 
 		} else if (camel_content_type_is (content_type, "multipart", "alternative")) {
 			/* This contains the text/plain and text/html
 			 * versions of the message body. */
 			handle_multipart_alternative (
-				composer, content_multipart, operation, depth);
+				composer, content_multipart, cancellable, depth);
 
 		} else {
 			/* There must be attachments... */
 			handle_multipart (
-				composer, content_multipart, operation, depth);
+				composer, content_multipart, cancellable, depth);
 		}
 
 	} else if (camel_content_type_is (content_type, "text", "*")) {
 		gchar *html;
 		gssize length;
 
-		html = emcu_part_to_html (mime_part, &length, NULL, operation);
+		html = emcu_part_to_html (mime_part, &length, NULL, cancellable);
 		e_msg_composer_set_pending_body (composer, html, length);
 	} else {
 		e_msg_composer_attach (composer, mime_part);
@@ -2653,7 +2630,7 @@ handle_multipart_encrypted (EMsgComposer *composer,
 static void
 handle_multipart_alternative (EMsgComposer *composer,
                               CamelMultipart *multipart,
-                              CamelOperation *operation,
+                              GCancellable *cancellable,
                               gint depth)
 {
 	/* Find the text/html part and set the composer body to it's contents */
@@ -2684,20 +2661,20 @@ handle_multipart_alternative (EMsgComposer *composer,
 				/* Handle the signed content and configure
 				 * the composer to sign outgoing messages. */
 				handle_multipart_signed (
-					composer, mp, operation, depth + 1);
+					composer, mp, cancellable, depth + 1);
 
 			} else if (CAMEL_IS_MULTIPART_ENCRYPTED (content)) {
 				/* Decrypt the encrypted content and configure
 				 * the composer to encrypt outgoing messages. */
 				handle_multipart_encrypted (
 					composer, mime_part,
-					operation, depth + 1);
+					cancellable, depth + 1);
 
 			} else {
 				/* Depth doesn't matter so long as we
 				 * don't pass 0. */
 				handle_multipart (
-					composer, mp, operation, depth + 1);
+					composer, mp, cancellable, depth + 1);
 			}
 
 		} else if (camel_content_type_is (content_type, "text", "html")) {
@@ -2718,7 +2695,7 @@ handle_multipart_alternative (EMsgComposer *composer,
 		gchar *html;
 		gssize length;
 
-		html = emcu_part_to_html (text_part, &length, NULL, operation);
+		html = emcu_part_to_html (text_part, &length, NULL, cancellable);
 		e_msg_composer_set_pending_body (composer, html, length);
 	}
 }
@@ -2726,7 +2703,7 @@ handle_multipart_alternative (EMsgComposer *composer,
 static void
 handle_multipart (EMsgComposer *composer,
                   CamelMultipart *multipart,
-                  CamelOperation *operation,
+                  GCancellable *cancellable,
                   gint depth)
 {
 	gint i, nparts;
@@ -2755,24 +2732,24 @@ handle_multipart (EMsgComposer *composer,
 				/* Handle the signed content and configure
 				 * the composer to sign outgoing messages. */
 				handle_multipart_signed (
-					composer, mp, operation, depth + 1);
+					composer, mp, cancellable, depth + 1);
 
 			} else if (CAMEL_IS_MULTIPART_ENCRYPTED (content)) {
 				/* Decrypt the encrypted content and configure
 				 * the composer to encrypt outgoing messages. */
 				handle_multipart_encrypted (
 					composer, mime_part,
-					operation, depth + 1);
+					cancellable, depth + 1);
 
 			} else if (camel_content_type_is (content_type, "multipart", "alternative")) {
 				handle_multipart_alternative (
-					composer, mp, operation, depth + 1);
+					composer, mp, cancellable, depth + 1);
 
 			} else {
 				/* Depth doesn't matter so long as we
 				 * don't pass 0. */
 				handle_multipart (
-					composer, mp, operation, depth + 1);
+					composer, mp, cancellable, depth + 1);
 			}
 
 		} else if (depth == 0 && i == 0) {
@@ -2782,7 +2759,7 @@ handle_multipart (EMsgComposer *composer,
 			/* Since the first part is not multipart/alternative,
 			 * this must be the body. */
 			html = emcu_part_to_html (
-				mime_part, &length, NULL, operation);
+				mime_part, &length, NULL, cancellable);
 			e_msg_composer_set_pending_body (composer, html, length);
 		} else if (camel_mime_part_get_content_id (mime_part) ||
 			   camel_mime_part_get_content_location (mime_part)) {
@@ -2837,7 +2814,8 @@ set_signature_gui (EMsgComposer *composer)
  **/
 EMsgComposer *
 e_msg_composer_new_with_message (EShell *shell,
-                                 CamelMimeMessage *message)
+                                 CamelMimeMessage *message,
+                                 GCancellable *cancellable)
 {
 	CamelInternetAddress *to, *cc, *bcc;
 	GList *To = NULL, *Cc = NULL, *Bcc = NULL, *postto = NULL;
@@ -2845,7 +2823,6 @@ e_msg_composer_new_with_message (EShell *shell,
 	EDestination **Tov, **Ccv, **Bccv;
 	GHashTable *auto_cc, *auto_bcc;
 	CamelContentType *content_type;
-	CamelOperation *operation = NULL;  /* FIXME Pass this in. */
 	struct _camel_header_raw *headers;
 	CamelDataWrapper *content;
 	EAccount *account = NULL;
@@ -3093,25 +3070,25 @@ e_msg_composer_new_with_message (EShell *shell,
 			/* Handle the signed content and configure the
 			 * composer to sign outgoing messages. */
 			handle_multipart_signed (
-				composer, multipart, operation, 0);
+				composer, multipart, cancellable, 0);
 
 		} else if (CAMEL_IS_MULTIPART_ENCRYPTED (content)) {
 			/* Decrypt the encrypted content and configure the
 			 * composer to encrypt outgoing messages. */
 			handle_multipart_encrypted (
 				composer, CAMEL_MIME_PART (message),
-				operation, 0);
+				cancellable, 0);
 
 		} else if (camel_content_type_is (content_type, "multipart", "alternative")) {
 			/* This contains the text/plain and text/html
 			 * versions of the message body. */
 			handle_multipart_alternative (
-				composer, multipart, operation, 0);
+				composer, multipart, cancellable, 0);
 
 		} else {
 			/* There must be attachments... */
 			handle_multipart (
-				composer, multipart, operation, 0);
+				composer, multipart, cancellable, 0);
 		}
 	} else {
 		gchar *html;
@@ -3125,7 +3102,7 @@ e_msg_composer_new_with_message (EShell *shell,
 			gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT)), TRUE);
 
 		html = emcu_part_to_html (
-			CAMEL_MIME_PART (message), &length, NULL, operation);
+			CAMEL_MIME_PART (message), &length, NULL, cancellable);
 		e_msg_composer_set_pending_body (composer, html, length);
 	}
 
@@ -3138,9 +3115,6 @@ e_msg_composer_new_with_message (EShell *shell,
 
 	set_signature_gui (composer);
 
-	if (operation != NULL)
-		g_object_unref (operation);
-
 	return composer;
 }
 
@@ -3180,7 +3154,8 @@ disable_editor (EMsgComposer *composer)
 EMsgComposer *
 e_msg_composer_new_redirect (EShell *shell,
                              CamelMimeMessage *message,
-                             const gchar *resent_from)
+                             const gchar *resent_from,
+                             GCancellable *cancellable)
 {
 	EMsgComposer *composer;
 	EComposerHeaderTable *table;
@@ -3189,7 +3164,8 @@ e_msg_composer_new_redirect (EShell *shell,
 	g_return_val_if_fail (E_IS_SHELL (shell), NULL);
 	g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
 
-	composer = e_msg_composer_new_with_message (shell, message);
+	composer = e_msg_composer_new_with_message (
+		shell, message, cancellable);
 	table = e_msg_composer_get_header_table (composer);
 
 	subject = camel_mime_message_get_subject (message);
@@ -3713,7 +3689,8 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
 		return NULL;
 
 	wrapper = camel_data_wrapper_new ();
-	camel_data_wrapper_construct_from_stream (wrapper, stream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		wrapper, stream, NULL, NULL);
 	g_object_unref (CAMEL_OBJECT (stream));
 
 	mime_type = e_util_guess_mime_type (dec_file_name, TRUE);
@@ -3791,6 +3768,7 @@ e_msg_composer_add_inline_image_from_mime_part (EMsgComposer  *composer,
 CamelMimeMessage *
 e_msg_composer_get_message (EMsgComposer *composer,
                             gboolean save_html_object_data,
+                            GCancellable *cancellable,
                             GError **error)
 {
 	EAttachmentView *view;
@@ -3815,7 +3793,7 @@ e_msg_composer_get_message (EMsgComposer *composer,
 
 	return build_message (
 		composer, html_content,
-		save_html_object_data, error);
+		save_html_object_data, cancellable, error);
 }
 
 static gchar *
@@ -3857,7 +3835,8 @@ msg_composer_get_message_print_helper (EMsgComposer *composer,
 
 CamelMimeMessage *
 e_msg_composer_get_message_print (EMsgComposer *composer,
-                                  gboolean save_html_object_data)
+                                  gboolean save_html_object_data,
+                                  GCancellable *cancellable)
 {
 	EShell *shell;
 	GtkhtmlEditor *editor;
@@ -3872,12 +3851,14 @@ e_msg_composer_get_message_print (EMsgComposer *composer,
 	html_content = gtkhtml_editor_get_html_mode (editor);
 
 	msg = build_message (
-		composer, html_content, save_html_object_data, NULL);
+		composer, html_content, save_html_object_data,
+		cancellable, NULL);
 	if (msg == NULL)
 		return NULL;
 
 	shell = e_msg_composer_get_shell (composer);
-	temp_composer = e_msg_composer_new_with_message (shell, msg);
+	temp_composer = e_msg_composer_new_with_message (
+		shell, msg, cancellable);
 	g_object_unref (msg);
 
 	/* Override composer flags. */
@@ -3885,7 +3866,8 @@ e_msg_composer_get_message_print (EMsgComposer *composer,
 		temp_composer, html_content);
 
 	msg = build_message (
-		temp_composer, TRUE, save_html_object_data, NULL);
+		temp_composer, TRUE, save_html_object_data,
+		cancellable, NULL);
 	if (msg != NULL)
 		camel_medium_set_header (
 			CAMEL_MEDIUM (msg), "X-Evolution-Format", flags);
@@ -3898,6 +3880,7 @@ e_msg_composer_get_message_print (EMsgComposer *composer,
 
 CamelMimeMessage *
 e_msg_composer_get_message_draft (EMsgComposer *composer,
+                                  GCancellable *cancellable,
                                   GError **error)
 {
 	GtkhtmlEditor *editor;
@@ -3932,7 +3915,7 @@ e_msg_composer_get_message_draft (EMsgComposer *composer,
 	smime_encrypt = gtk_toggle_action_get_active (action);
 	gtk_toggle_action_set_active (action, FALSE);
 
-	msg = build_message (composer, TRUE, TRUE, error);
+	msg = build_message (composer, TRUE, TRUE, cancellable, error);
 	if (msg == NULL)
 		return NULL;
 
@@ -4182,7 +4165,8 @@ e_msg_composer_can_close (EMsgComposer *composer,
 
 EMsgComposer *
 e_msg_composer_load_from_file (EShell *shell,
-                               const gchar *filename)
+                               const gchar *filename,
+                               GCancellable *cancellable)
 {
 	CamelStream *stream;
 	CamelMimeMessage *message;
@@ -4197,11 +4181,12 @@ e_msg_composer_load_from_file (EShell *shell,
 		return NULL;
 
 	message = camel_mime_message_new ();
-	camel_data_wrapper_construct_from_stream (
-		CAMEL_DATA_WRAPPER (message), stream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		CAMEL_DATA_WRAPPER (message), stream, NULL, NULL);
 	g_object_unref (stream);
 
-	composer = e_msg_composer_new_with_message (shell, message);
+	composer = e_msg_composer_new_with_message (
+		shell, message, cancellable);
 	if (composer != NULL)
 		gtk_widget_show (GTK_WIDGET (composer));
 
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 5cb4395..866774e 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -71,12 +71,14 @@ struct _EMsgComposerClass {
 GType		e_msg_composer_get_type		(void);
 EMsgComposer *	e_msg_composer_new		(EShell *shell);
 EMsgComposer *	e_msg_composer_new_with_message	(EShell *shell,
-						 CamelMimeMessage *msg);
+						 CamelMimeMessage *msg,
+						 GCancellable *cancellable);
 EMsgComposer *	e_msg_composer_new_from_url	(EShell *shell,
 						 const gchar *url);
 EMsgComposer *	e_msg_composer_new_redirect	(EShell *shell,
 						 CamelMimeMessage *message,
-						 const gchar *resent_from);
+						 const gchar *resent_from,
+						 GCancellable *cancellable);
 EFocusTracker *	e_msg_composer_get_focus_tracker
 						(EMsgComposer *composer);
 CamelSession *	e_msg_composer_get_session	(EMsgComposer *composer);
@@ -115,14 +117,17 @@ void		e_msg_composer_add_inline_image_from_mime_part
 CamelMimeMessage *
 		e_msg_composer_get_message	(EMsgComposer *composer,
 						 gboolean save_html_object_data,
+						 GCancellable *cancellable,
 						 GError **error);
 CamelMimeMessage *
 		e_msg_composer_get_message_print
 						(EMsgComposer *composer,
-						 gboolean save_html_object_data);
+						 gboolean save_html_object_data,
+						 GCancellable *cancellable);
 CamelMimeMessage *
 		e_msg_composer_get_message_draft
 						(EMsgComposer *composer,
+						 GCancellable *cancellable,
 						 GError **error);
 void		e_msg_composer_show_sig_file	(EMsgComposer *composer);
 
@@ -143,7 +148,8 @@ gboolean	e_msg_composer_can_close	(EMsgComposer *composer,
 						 gboolean can_save_draft);
 
 EMsgComposer *	e_msg_composer_load_from_file	(EShell *shell,
-						 const gchar *filename);
+						 const gchar *filename,
+						 GCancellable *cancellable);
 
 void		e_msg_composer_reply_indent	(EMsgComposer *composer);
 
diff --git a/e-util/e-activity.c b/e-util/e-activity.c
index f90361d..38196e8 100644
--- a/e-util/e-activity.c
+++ b/e-util/e-activity.c
@@ -266,10 +266,8 @@ activity_describe (EActivity *activity)
 	} else if (e_activity_is_completed (activity)) {
 		/* Translators: This is a completed activity. */
 		g_string_printf (string, _("%s (completed)"), text);
-	} else if (percent < 0.0) {
-		/* Translators: This is an activity whose percent
-		 * complete is unknown. */
-		g_string_printf (string, _("%s..."), text);
+	} else if (percent <= 0.0) {
+		g_string_printf (string, _("%s"), text);
 	} else {
 		/* Translators: This is an activity whose percent
 		 * complete is known. */
diff --git a/e-util/e-signature-utils.c b/e-util/e-signature-utils.c
index cf55c73..d42d6f3 100644
--- a/e-util/e-signature-utils.c
+++ b/e-util/e-signature-utils.c
@@ -196,7 +196,7 @@ e_read_signature_file (ESignature *signature,
 	output_stream = camel_stream_mem_new ();
 	camel_stream_mem_set_byte_array (
 		CAMEL_STREAM_MEM (output_stream), buffer);
-	camel_stream_write_to_stream (input_stream, output_stream, NULL);
+	camel_stream_write_to_stream (input_stream, output_stream, NULL, NULL);
 	g_object_unref (output_stream);
 	g_object_unref (input_stream);
 
@@ -290,7 +290,8 @@ e_run_signature_script (const gchar *filename)
 			CAMEL_STREAM_MEM (output_stream), buffer);
 
 		input_stream = camel_stream_fs_new_with_fd (in_fds[0]);
-		camel_stream_write_to_stream (input_stream, output_stream, NULL);
+		camel_stream_write_to_stream (
+			input_stream, output_stream, NULL, NULL);
 		g_object_unref (input_stream);
 
 		g_object_unref (output_stream);
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c
index 3313f2a..569c46f 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -88,7 +88,7 @@ emfq_format_clone (EMFormat *emf,
 			CAMEL_MIME_PART (msg),
 			handle, cancellable, FALSE);
 
-	camel_stream_flush (emfq->stream, NULL);
+	camel_stream_flush (emfq->stream, cancellable, NULL);
 
 	g_signal_emit_by_name(emf, "complete");
 }
@@ -104,7 +104,8 @@ emfq_format_error (EMFormat *emf,
 static void
 emfq_format_source (EMFormat *emf,
                     CamelStream *stream,
-                    CamelMimePart *part)
+                    CamelMimePart *part,
+                    GCancellable *cancellable)
 {
 	CamelStream *filtered_stream;
 	CamelMimeFilter *html_filter;
@@ -119,7 +120,8 @@ emfq_format_source (EMFormat *emf,
 	g_object_unref (html_filter);
 
 	em_format_format_text (
-		emf, filtered_stream, CAMEL_DATA_WRAPPER (part));
+		emf, filtered_stream,
+		CAMEL_DATA_WRAPPER (part), cancellable);
 
 	g_object_unref (filtered_stream);
 }
@@ -140,18 +142,19 @@ emfq_format_attachment (EMFormat *emf,
 
 	camel_stream_write_string (
 		stream, "<table border=1 cellspacing=0 cellpadding=0>"
-		"<tr><td><font size=-1>\n", NULL);
+		"<tr><td><font size=-1>\n", cancellable, NULL);
 
 	/* output some info about it */
 	text = em_format_describe_part (part, mime_type);
 	html = camel_text_to_html (
 		text, emfq->text_html_flags &
 		CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
-	camel_stream_write_string (stream, html, NULL);
+	camel_stream_write_string (stream, html, cancellable, NULL);
 	g_free (html);
 	g_free (text);
 
-	camel_stream_write_string (stream, "</font></td></tr></table>", NULL);
+	camel_stream_write_string (
+		stream, "</font></td></tr></table>", cancellable, NULL);
 
 	handle->handler (emf, stream, part, handle, cancellable, FALSE);
 }
@@ -518,7 +521,8 @@ emfq_format_message (EMFormat *emf,
 	if (emfq->flags & EM_FORMAT_QUOTE_CITE)
 		camel_stream_write_string (
 			stream, "</blockquote><!--+GtkHTML:"
-			"<DATA class=\"ClueFlow\" clear=\"orig\">-->", NULL);
+			"<DATA class=\"ClueFlow\" clear=\"orig\">-->",
+			cancellable, NULL);
 }
 
 static void
@@ -565,9 +569,9 @@ emfq_text_plain (EMFormat *emf,
 
 	em_format_format_text (
 		EM_FORMAT (emfq), filtered_stream,
-		CAMEL_DATA_WRAPPER (part));
+		CAMEL_DATA_WRAPPER (part), cancellable);
 
-	camel_stream_flush (filtered_stream, NULL);
+	camel_stream_flush (filtered_stream, cancellable, NULL);
 	g_object_unref (filtered_stream);
 }
 
@@ -586,10 +590,12 @@ emfq_text_enriched (EMFormat *emf,
 	if (g_strcmp0 (info->mime_type, "text/richtext") == 0) {
 		flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT;
 		camel_stream_write_string (
-			stream, "\n<!-- text/richtext -->\n", NULL);
+			stream, "\n<!-- text/richtext -->\n",
+			cancellable, NULL);
 	} else {
 		camel_stream_write_string (
-			stream, "\n<!-- text/enriched -->\n", NULL);
+			stream, "\n<!-- text/enriched -->\n",
+			cancellable, NULL);
 	}
 
 	enriched = camel_mime_filter_enriched_new (flags);
@@ -598,9 +604,9 @@ emfq_text_enriched (EMFormat *emf,
 		CAMEL_STREAM_FILTER (filtered_stream), enriched);
 	g_object_unref (enriched);
 
-	camel_stream_write_string (stream, "<br><hr><br>", NULL);
+	camel_stream_write_string (stream, "<br><hr><br>", cancellable, NULL);
 	em_format_format_text (
-		emf, filtered_stream, CAMEL_DATA_WRAPPER (part));
+		emf, filtered_stream, CAMEL_DATA_WRAPPER (part), cancellable);
 	g_object_unref (filtered_stream);
 }
 
@@ -612,8 +618,10 @@ emfq_text_html (EMFormat *emf,
                 GCancellable *cancellable,
                 gboolean is_fallback)
 {
-	camel_stream_write_string(stream, "\n<!-- text/html -->\n", NULL);
-	em_format_format_text (emf, stream, (CamelDataWrapper *)part);
+	camel_stream_write_string (
+		stream, "\n<!-- text/html -->\n", cancellable, NULL);
+	em_format_format_text (
+		emf, stream, (CamelDataWrapper *)part, cancellable);
 }
 
 static void
diff --git a/em-format/em-format.c b/em-format/em-format.c
index f2efac9..9574530 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1281,7 +1281,8 @@ em_format_format_secure (EMFormat *emf,
 void
 em_format_format_source (EMFormat *emf,
                          CamelStream *stream,
-                         CamelMimePart *mime_part)
+                         CamelMimePart *mime_part,
+                         GCancellable *cancellable)
 {
 	EMFormatClass *class;
 
@@ -1292,7 +1293,7 @@ em_format_format_source (EMFormat *emf,
 	class = EM_FORMAT_GET_CLASS (emf);
 	g_return_if_fail (class->format_source != NULL);
 
-	class->format_source (emf, stream, mime_part);
+	class->format_source (emf, stream, mime_part, cancellable);
 }
 
 gboolean
@@ -1318,9 +1319,11 @@ em_format_format_content (EMFormat *emf,
 	CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)part);
 
 	if (camel_content_type_is (dw->mime_type, "text", "*"))
-		em_format_format_text (emf, stream, (CamelDataWrapper *)part);
+		em_format_format_text (
+			emf, stream, (CamelDataWrapper *)part, cancellable);
 	else
-		camel_data_wrapper_decode_to_stream (dw, stream, NULL);
+		camel_data_wrapper_decode_to_stream_sync (
+			dw, stream, cancellable, NULL);
 }
 
 /**
@@ -1328,13 +1331,15 @@ em_format_format_content (EMFormat *emf,
  * @emf:
  * @stream: Where to write the converted text
  * @part: Part whose container is to be formatted
+ * @cancellable: optional #GCancellable object, or %NULL
  *
  * Decode/output a part's content to @stream.
  **/
 void
 em_format_format_text (EMFormat *emf,
                        CamelStream *stream,
-                       CamelDataWrapper *dw)
+                       CamelDataWrapper *dw,
+                       GCancellable *cancellable)
 {
 	CamelStream *filter_stream;
 	CamelMimeFilter *filter;
@@ -1367,9 +1372,9 @@ em_format_format_text (EMFormat *emf,
 			CAMEL_STREAM_FILTER (filter_stream),
 			CAMEL_MIME_FILTER (windows));
 
-		camel_data_wrapper_decode_to_stream (
-			dw, (CamelStream *)filter_stream, NULL);
-		camel_stream_flush ((CamelStream *)filter_stream, NULL);
+		camel_data_wrapper_decode_to_stream_sync (
+			dw, (CamelStream *)filter_stream, cancellable, NULL);
+		camel_stream_flush ((CamelStream *)filter_stream, cancellable, NULL);
 		g_object_unref (filter_stream);
 
 		charset = camel_mime_filter_windows_real_charset (windows);
@@ -1399,21 +1404,22 @@ em_format_format_text (EMFormat *emf,
 	}
 	g_object_unref (gconf);
 
-	size = camel_data_wrapper_decode_to_stream (
+	size = camel_data_wrapper_decode_to_stream_sync (
 		emf->mode == EM_FORMAT_MODE_SOURCE ?
 			(CamelDataWrapper *) dw :
 			camel_medium_get_content ((CamelMedium *)dw),
-		(CamelStream *)filter_stream, NULL);
-	camel_stream_flush ((CamelStream *)filter_stream, NULL);
+		(CamelStream *)filter_stream, cancellable, NULL);
+	camel_stream_flush ((CamelStream *)filter_stream, cancellable, NULL);
 	g_object_unref (filter_stream);
 	camel_stream_reset (mem_stream, NULL);
 
 	if (max == -1 || size == -1 || size < (max * 1024) || emf->composer) {
-		camel_stream_write_to_stream (mem_stream, (CamelStream *)stream, NULL);
-		camel_stream_flush ((CamelStream *)stream, NULL);
+		camel_stream_write_to_stream (mem_stream, (CamelStream *)stream, cancellable, NULL);
+		camel_stream_flush ((CamelStream *)stream, cancellable, NULL);
 	} else {
 		EM_FORMAT_GET_CLASS (emf)->format_optional (
-			emf, stream, (CamelMimePart *)dw, mem_stream);
+			emf, stream, (CamelMimePart *)dw,
+			mem_stream, cancellable);
 	}
 
 	if (windows)
@@ -1513,7 +1519,7 @@ emf_application_xpkcs7mime (EMFormat *emf,
 		EM_FORMAT_VALIDITY_FOUND_SMIME;
 
 	opart = camel_mime_part_new ();
-	valid = camel_cipher_decrypt (
+	valid = camel_cipher_context_decrypt_sync (
 		context, part, opart, cancellable, &local_error);
 	if (valid == NULL) {
 		em_format_format_error (
@@ -1554,7 +1560,7 @@ emf_multipart_appledouble (EMFormat *emf,
 	gint len;
 
 	if (!CAMEL_IS_MULTIPART (mp)) {
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
@@ -1566,7 +1572,7 @@ emf_multipart_appledouble (EMFormat *emf,
 		em_format_part (emf, stream, mime_part, cancellable);
 		g_string_truncate (emf->part_id, len);
 	} else
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 
 }
 
@@ -1583,7 +1589,7 @@ emf_multipart_mixed (EMFormat *emf,
 	gint i, nparts, len;
 
 	if (!CAMEL_IS_MULTIPART (mp)) {
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
@@ -1611,20 +1617,36 @@ emf_multipart_alternative (EMFormat *emf,
 	CamelMimePart *best = NULL;
 
 	if (!CAMEL_IS_MULTIPART (mp)) {
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
 	/* as per rfc, find the last part we know how to display */
 	nparts = camel_multipart_get_number (mp);
 	for (i = 0; i < nparts; i++) {
+		CamelDataWrapper *data_wrapper;
 		CamelContentType *type;
+		CamelStream *null_stream;
 		gchar *mime_type;
+		gsize content_size;
 
 		/* is it correct to use the passed in *part here? */
 		part = camel_multipart_get_part (mp, i);
 
-		if (!part || !camel_mime_part_get_content_size (part))
+		if (part == NULL)
+			continue;
+
+		/* This may block even though the stream does not.
+		 * XXX Pretty inefficient way to test if the MIME part
+		 *     is empty.  Surely there's a quicker way? */
+		null_stream = camel_stream_null_new ();
+		data_wrapper = camel_medium_get_content (CAMEL_MEDIUM (part));
+		camel_data_wrapper_decode_to_stream_sync (
+			data_wrapper, null_stream, cancellable, NULL);
+		content_size = CAMEL_STREAM_NULL (null_stream)->written;
+		g_object_unref (null_stream);
+
+		if (content_size == 0)
 			continue;
 
 		type = camel_mime_part_get_content_type (part);
@@ -1687,7 +1709,7 @@ emf_multipart_encrypted (EMFormat *emf,
 		em_format_format_error (
 			emf, stream, _("Could not parse MIME message. "
 			"Displaying as source."));
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
@@ -1709,7 +1731,7 @@ emf_multipart_encrypted (EMFormat *emf,
 
 	context = camel_gpg_context_new (emf->session);
 	opart = camel_mime_part_new ();
-	valid = camel_cipher_decrypt (
+	valid = camel_cipher_context_decrypt_sync (
 		context, part, opart, cancellable, &local_error);
 	if (valid == NULL) {
 		em_format_format_error (
@@ -1748,7 +1770,7 @@ emf_write_related (EMFormat *emf,
                    GCancellable *cancellable)
 {
 	em_format_format_content (emf, stream, puri->part, cancellable);
-	camel_stream_close (stream, NULL);
+	camel_stream_close (stream, cancellable, NULL);
 }
 
 /* RFC 2387 */
@@ -1769,7 +1791,7 @@ emf_multipart_related (EMFormat *emf,
 	GList *link;
 
 	if (!CAMEL_IS_MULTIPART (mp)) {
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
@@ -1829,7 +1851,7 @@ emf_multipart_related (EMFormat *emf,
 	g_string_append_printf(emf->part_id, ".related.%d", displayid);
 	em_format_part (emf, stream, display_part, cancellable);
 	g_string_truncate (emf->part_id, partidlen);
-	camel_stream_flush (stream, NULL);
+	camel_stream_flush (stream, NULL, NULL);
 
 	link = g_queue_peek_head_link (emf->pending_uri_level->data);
 
@@ -1883,7 +1905,7 @@ emf_multipart_signed (EMFormat *emf,
 		em_format_format_error (
 			emf, stream, _("Could not parse MIME message. "
 			"Displaying as source."));
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
@@ -1914,7 +1936,7 @@ emf_multipart_signed (EMFormat *emf,
 		CamelCipherValidity *valid;
 		GError *local_error = NULL;
 
-		valid = camel_cipher_verify (
+		valid = camel_cipher_context_verify_sync (
 			cipher, part, cancellable, &local_error);
 		if (valid == NULL) {
 			em_format_format_error (
@@ -1981,9 +2003,9 @@ emf_application_mbox (EMFormat *emf,
 	camel_mime_parser_scan_from (parser, TRUE);
 
 	mem_stream = camel_stream_mem_new ();
-	camel_data_wrapper_decode_to_stream (
+	camel_data_wrapper_decode_to_stream_sync (
 		camel_medium_get_content (CAMEL_MEDIUM (mime_part)),
-		mem_stream, NULL);
+		mem_stream, NULL, NULL);
 	camel_seekable_stream_seek (
 		CAMEL_SEEKABLE_STREAM (mem_stream), 0, CAMEL_STREAM_SET, NULL);
 	camel_mime_parser_init_with_stream (parser, mem_stream, NULL);
@@ -1997,7 +2019,7 @@ emf_application_mbox (EMFormat *emf,
 		message = camel_mime_message_new ();
 		mime_part = CAMEL_MIME_PART (message);
 
-		if (camel_mime_part_construct_from_parser (mime_part, parser, NULL) == -1) {
+		if (!camel_mime_part_construct_from_parser_sync (mime_part, parser, NULL, NULL)) {
 			g_object_unref (message);
 			break;
 		}
@@ -2031,7 +2053,7 @@ emf_message_rfc822 (EMFormat *emf,
 	gint len;
 
 	if (!CAMEL_IS_MIME_MESSAGE (dw)) {
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
@@ -2055,7 +2077,8 @@ emf_message_deliverystatus (EMFormat *emf,
                             GCancellable *cancellable,
                             gboolean is_fallback)
 {
-	em_format_format_text (emf, stream, (CamelDataWrapper *)part);
+	em_format_format_text (
+		emf, stream, (CamelDataWrapper *)part, cancellable);
 }
 
 static void
@@ -2086,7 +2109,8 @@ emf_inlinepgp_signed (EMFormat *emf,
 
 	cipher = camel_gpg_context_new (emf->session);
 	/* Verify the signature of the message */
-	valid = camel_cipher_verify (cipher, ipart, cancellable, &local_error);
+	valid = camel_cipher_context_verify_sync (
+		cipher, ipart, cancellable, &local_error);
 	if (!valid) {
 		em_format_format_error (
 			emf, stream, local_error->message ?
@@ -2095,7 +2119,7 @@ emf_inlinepgp_signed (EMFormat *emf,
 		if (local_error->message)
 			em_format_format_error (
 				emf, stream, "%s", local_error->message);
-		em_format_format_source (emf, stream, ipart);
+		em_format_format_source (emf, stream, ipart, cancellable);
 		/* I think this will loop: em_format_part_as(emf, stream, part, "text/plain"); */
 		g_clear_error (&local_error);
 		g_object_unref (cipher);
@@ -2115,9 +2139,9 @@ emf_inlinepgp_signed (EMFormat *emf,
 
 	/* Pass through the filters that have been setup */
 	dw = camel_medium_get_content ((CamelMedium *)ipart);
-	camel_data_wrapper_decode_to_stream (
-		dw, (CamelStream *)filtered_stream, NULL);
-	camel_stream_flush ((CamelStream *)filtered_stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (
+		dw, (CamelStream *)filtered_stream, NULL, NULL);
+	camel_stream_flush ((CamelStream *)filtered_stream, NULL, NULL);
 	g_object_unref (filtered_stream);
 
 	/* Create a new text/plain MIME part containing the signed
@@ -2135,7 +2159,7 @@ emf_inlinepgp_signed (EMFormat *emf,
 	camel_content_type_unref (content_type);
 
 	dw = camel_data_wrapper_new ();
-	camel_data_wrapper_construct_from_stream (dw, ostream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (dw, ostream, NULL, NULL);
 	camel_data_wrapper_set_mime_type (dw, type);
 	g_free (type);
 
@@ -2166,7 +2190,6 @@ emf_inlinepgp_encrypted (EMFormat *emf,
 	CamelCipherValidity *valid;
 	CamelMimePart *opart;
 	CamelDataWrapper *dw;
-	CamelOperation *operation;
 	gchar *mime_type;
 	GError *local_error = NULL;
 
@@ -2178,16 +2201,8 @@ emf_inlinepgp_encrypted (EMFormat *emf,
 	opart = camel_mime_part_new ();
 
 	/* Decrypt the message */
-	operation = camel_operation_registered ();
-	if (operation != NULL)
-		camel_operation_start (operation, _("Decrypting message"));
-	valid = camel_cipher_decrypt (
-		cipher, ipart, opart,
-		G_CANCELLABLE (operation), &local_error);
-	if (operation != NULL) {
-		camel_operation_end (operation);
-		g_object_unref (operation);
-	}
+	valid = camel_cipher_context_decrypt_sync (
+		cipher, ipart, opart, cancellable, &local_error);
 
 	if (!valid) {
 		em_format_format_error (
@@ -2198,7 +2213,7 @@ emf_inlinepgp_encrypted (EMFormat *emf,
 		else
 			em_format_format_error (
 				emf, stream, _("Unknown error"));
-		em_format_format_source (emf, stream, ipart);
+		em_format_format_source (emf, stream, ipart, cancellable);
 		/* I think this will loop: em_format_part_as(emf, stream, part, "text/plain"); */
 
 		g_clear_error (&local_error);
@@ -2302,7 +2317,7 @@ em_format_snoop_type (CamelMimePart *part)
 		byte_array = g_byte_array_new ();
 		stream = camel_stream_mem_new_with_byte_array (byte_array);
 
-		if (camel_data_wrapper_decode_to_stream (dw, stream, NULL) > 0) {
+		if (camel_data_wrapper_decode_to_stream_sync (dw, stream, NULL, NULL) > 0) {
 			gchar *content_type;
 
 			content_type = g_content_type_guess (
diff --git a/em-format/em-format.h b/em-format/em-format.h
index 64f1d5f..64336a9 100644
--- a/em-format/em-format.h
+++ b/em-format/em-format.h
@@ -273,7 +273,8 @@ struct _EMFormatClass {
 	/* use for unparsable content */
 	void		(*format_source)	(EMFormat *emf,
 						 CamelStream *stream,
-						 CamelMimePart *mime_part);
+						 CamelMimePart *mime_part,
+						 GCancellable *cancellable);
 	/* for outputing secure(d) content */
 	void		(*format_secure)	(EMFormat *emf,
 						 CamelStream *stream,
@@ -288,7 +289,8 @@ struct _EMFormatClass {
 	void		(*format_optional)	(EMFormat *emf,
 						 CamelStream *filter_stream,
 						 CamelMimePart *mime_part,
-						 CamelStream *mem_stream);
+						 CamelStream *mem_stream,
+						 GCancellable *cancellable);
 
 	gboolean	(*is_inline)		(EMFormat *emf,
 						 const gchar *part_id,
@@ -392,7 +394,8 @@ void		em_format_format_secure		(EMFormat *emf,
 						 GCancellable *cancellable);
 void		em_format_format_source		(EMFormat *emf,
 						 CamelStream *stream,
-						 CamelMimePart *mime_part);
+						 CamelMimePart *mime_part,
+						 GCancellable *cancellable);
 
 gboolean	em_format_busy			(EMFormat *emf);
 
@@ -405,7 +408,8 @@ void		em_format_format_content	(EMFormat *emf,
 /* raw content text parts - should this just be checked/done by above? */
 void		em_format_format_text		(EMFormat *emf,
 						 CamelStream *stream,
-						 CamelDataWrapper *part);
+						 CamelDataWrapper *part,
+						 GCancellable *cancellable);
 
 void		em_format_part_as		(EMFormat *emf,
 						 CamelStream *stream,
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 690181d..8012cc7 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -153,8 +153,8 @@ mail_backend_delete_junk (CamelStore *store,
 	guint32 mask;
 	guint ii;
 
-	/* FIXME camel_store_get_junk() may block. */
-	folder = camel_store_get_junk (store, NULL, NULL);
+	/* FIXME camel_store_get_junk_folder_sync() may block. */
+	folder = camel_store_get_junk_folder_sync (store, NULL, NULL);
 	if (folder == NULL)
 		return;
 
diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c
index f0ad740..861ac8f 100644
--- a/mail/e-mail-local.c
+++ b/mail/e-mail-local.c
@@ -83,7 +83,7 @@ e_mail_local_init (const gchar *data_dir)
 
 		/* FIXME camel_store_get_folder() may block. */
 		default_local_folders[ii].folder_uri = folder_uri;
-		default_local_folders[ii].folder = camel_store_get_folder (
+		default_local_folders[ii].folder = camel_store_get_folder_sync (
 			CAMEL_STORE (service), display_name,
 			CAMEL_STORE_FOLDER_CREATE, NULL, NULL);
 	}
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index 360d3f6..f5481bc 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -556,11 +556,11 @@ migrate_folders (CamelStore *store,
 		g_idle_add ((GSourceFunc) update_states_in_main_thread, info);
 
 		if (is_local)
-			folder = camel_store_get_folder (
+			folder = camel_store_get_folder_sync (
 				store, fi->full_name,
 				CAMEL_STORE_IS_MIGRATING, NULL, NULL);
 		else
-			folder = camel_store_get_folder (
+			folder = camel_store_get_folder_sync (
 				store, fi->full_name, 0, NULL, NULL);
 
 		if (folder != NULL)
@@ -656,7 +656,7 @@ migrate_to_db (EShellBackend *shell_backend)
 
 	em_migrate_set_progress ( (double)i/(len+1));
 	store = setup_local_store (shell_backend, session);
-	info = camel_store_get_folder_info (
+	info = camel_store_get_folder_info_sync (
 		store, NULL,
 		CAMEL_STORE_FOLDER_INFO_RECURSIVE |
 		CAMEL_STORE_FOLDER_INFO_FAST |
@@ -697,7 +697,7 @@ migrate_to_db (EShellBackend *shell_backend)
 			e_mail_store_add_by_uri (service->url, name);
 
 			store = (CamelStore *) camel_session_get_service (CAMEL_SESSION (session), service->url, CAMEL_PROVIDER_STORE, NULL);
-			info = camel_store_get_folder_info (
+			info = camel_store_get_folder_info_sync (
 				store, NULL,
 				CAMEL_STORE_FOLDER_INFO_RECURSIVE |
 				CAMEL_STORE_FOLDER_INFO_FAST |
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index ea524ad..d27c01a 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -86,9 +86,11 @@ store_info_new (CamelStore *store,
 	/* If these are vfolders then they need to be opened now,
 	 * otherwise they won't keep track of all folders. */
 	if (store->flags & CAMEL_STORE_VTRASH)
-		store_info->vtrash = camel_store_get_trash (store, NULL, NULL);
+		store_info->vtrash =
+			camel_store_get_trash_folder_sync (store, NULL, NULL);
 	if (store->flags & CAMEL_STORE_VJUNK)
-		store_info->vjunk = camel_store_get_junk (store, NULL, NULL);
+		store_info->vjunk =
+			camel_store_get_junk_folder_sync (store, NULL, NULL);
 
 	return store_info;
 }
@@ -343,7 +345,7 @@ fail:
 static void
 mail_store_remove_cb (CamelStore *store)
 {
-	camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
+	camel_service_disconnect_sync (CAMEL_SERVICE (store), TRUE, NULL);
 	g_object_unref (store);
 }
 
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 01964d5..b65237b 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -473,7 +473,7 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data)
 
 	/* actually get the message now, this will sign/encrypt etc */
 	message = e_msg_composer_get_message (
-		composer, save_html_object_data, &error);
+		composer, save_html_object_data, NULL, &error);
 
 	/* Ignore cancellations. */
 	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -670,7 +670,7 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer)
 	local_drafts_folder_uri =
 		e_mail_local_get_folder_uri (E_MAIL_FOLDER_DRAFTS);
 
-	msg = e_msg_composer_get_message_draft (composer, &error);
+	msg = e_msg_composer_get_message_draft (composer, NULL, &error);
 
 	/* Ignore cancellations. */
 	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -742,7 +742,7 @@ em_utils_composer_print_cb (EMsgComposer *composer,
 	CamelMimeMessage *message;
 	EMFormatHTMLPrint *efhp;
 
-	message = e_msg_composer_get_message_print (composer, 1);
+	message = e_msg_composer_get_message_print (composer, 1, NULL);
 
 	efhp = em_format_html_print_new (NULL, action);
 	em_format_html_print_raw_message (efhp, message);
@@ -966,7 +966,8 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont
 
 		byte_array = g_byte_array_new ();
 		stream = camel_stream_mem_new_with_byte_array (byte_array);
-		camel_data_wrapper_decode_to_stream (content, stream, NULL);
+		camel_data_wrapper_decode_to_stream_sync (
+			content, stream, NULL, NULL);
 
 		str = g_strndup ((gchar *) byte_array->data, byte_array->len);
 		g_object_unref (stream);
@@ -974,7 +975,8 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont
 		if (replace_variables (clues, message, &str)) {
 			stream = camel_stream_mem_new_with_buffer (str, strlen (str));
 			camel_stream_reset (stream, NULL);
-			camel_data_wrapper_construct_from_stream (content, stream, NULL);
+			camel_data_wrapper_construct_from_stream_sync (
+				content, stream, NULL, NULL);
 			g_object_unref (stream);
 		}
 
@@ -1008,7 +1010,7 @@ edit_message (EShell *shell,
 		g_slist_free (clue_list);
 	}
 
-	composer = e_msg_composer_new_with_message (shell, message);
+	composer = e_msg_composer_new_with_message (shell, message, NULL);
 
 	if (em_utils_folder_is_drafts (drafts, NULL)) {
 		struct emcs_t *emcs;
@@ -1548,7 +1550,7 @@ redirect_get_composer (EShell *shell,
 	account = em_utils_guess_account_with_recipients (message, NULL);
 
 	composer = e_msg_composer_new_redirect (
-		shell, message, account ? account->name : NULL);
+		shell, message, account ? account->name : NULL, NULL);
 
 	return composer;
 }
@@ -1741,7 +1743,8 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
 	/* Translators: First %s is an email address, second %s is the subject of the email, third %s is the date */
 			     _("Your message to %s about \"%s\" on %s has been read."),
 			     self_address, message_subject, message_date);
-	camel_data_wrapper_construct_from_stream (receipt_text, stream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		receipt_text, stream, NULL, NULL);
 	g_object_unref (stream);
 
 	part = camel_mime_part_new ();
@@ -1769,7 +1772,8 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
 			     "Original-Message-ID: %s\n"
 			     "Disposition: manual-action/MDN-sent-manually; displayed\n",
 			     ua, recipient, message_id);
-	camel_data_wrapper_construct_from_stream (receipt_data, stream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		receipt_data, stream, NULL, NULL);
 	g_object_unref (stream);
 
 	g_free (ua);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 3d1bb68..512aa9b 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -200,7 +200,7 @@ folder_tree_get_folder_info__exec (struct _EMFolderTreeGetFolderInfo *m)
 {
 	guint32 flags = m->flags | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
 
-	m->fi = camel_store_get_folder_info (
+	m->fi = camel_store_get_folder_info_sync (
 		m->store, m->top, flags,
 		m->base.cancellable, &m->base.error);
 
@@ -625,7 +625,7 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree,
 
 	/* Check for duplicate folder name. */
 	/* FIXME camel_store_get_folder_info() may block. */
-	folder_info = camel_store_get_folder_info (
+	folder_info = camel_store_get_folder_info_sync (
 		store, new_full_name,
 		CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
 	if (folder_info != NULL) {
@@ -636,8 +636,8 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree,
 		goto exit;
 	}
 
-	/* FIXME camel_store_rename_folder() may block. */
-	if (!camel_store_rename_folder (
+	/* FIXME camel_store_rename_folder_sync() may block. */
+	if (!camel_store_rename_folder_sync (
 		store, old_full_name, new_full_name, NULL, &local_error)) {
 		e_alert_run_dialog_for_args (
 			parent, "mail:no-rename-folder",
@@ -1531,8 +1531,8 @@ tree_drag_data_delete (GtkWidget *widget,
 	if (is_store)
 		goto fail;
 
-	/* FIXME camel_store_delete_folder() may block. */
-	camel_store_delete_folder (store, full_name, NULL, NULL);
+	/* FIXME camel_store_delete_folder_sync() may block. */
+	camel_store_delete_folder_sync (store, full_name, NULL, NULL);
 
 fail:
 	gtk_tree_path_free (src_path);
@@ -1582,8 +1582,8 @@ tree_drag_data_get (GtkWidget *widget,
 		break;
 	case DND_DRAG_TYPE_TEXT_URI_LIST:
 		/* dragging to nautilus or something, probably */
-		/* FIXME camel_store_get_folder() may block. */
-		if ((folder = camel_store_get_folder (
+		/* FIXME camel_store_get_folder_sync() may block. */
+		if ((folder = camel_store_get_folder_sync (
 			store, full_name, 0, NULL, NULL))) {
 
 			GPtrArray *uids = camel_folder_get_uids (folder);
@@ -1698,7 +1698,7 @@ folder_tree_drop_async__exec (struct _DragDataReceivedAsync *m)
 		g_set_error (
 			&m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot drop message(s) into toplevel store"));
-	} else if ((folder = camel_store_get_folder (
+	} else if ((folder = camel_store_get_folder_sync (
 		m->store, m->full_name, 0,
 		m->base.cancellable, &m->base.error))) {
 
@@ -2810,9 +2810,9 @@ em_folder_tree_get_selected_folder (EMFolderTree *folder_tree)
 		gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store,
 				    COL_STRING_FULL_NAME, &full_name, -1);
 
-	/* FIXME camel_store_get_folder() may block. */
+	/* FIXME camel_store_get_folder_sync() may block. */
 	if (store && full_name)
-		folder = camel_store_get_folder (
+		folder = camel_store_get_folder_sync (
 			store, full_name,
 			CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
 
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 201a0b9..dbd673c 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -104,7 +104,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 	const gchar *tmp;
 	gint fromlen;
 
-	fi = camel_store_get_folder_info (
+	fi = camel_store_get_folder_info_sync (
 		m->fromstore, m->frombase, flags,
 		m->base.cancellable, &m->base.error);
 	if (fi == NULL)
@@ -147,7 +147,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 			if ((info->flags & CAMEL_FOLDER_NOSELECT) == 0) {
 				d(printf ("this folder is selectable\n"));
 				if (m->tostore == m->fromstore && m->delete) {
-					camel_store_rename_folder (
+					camel_store_rename_folder_sync (
 						m->fromstore, info->full_name, toname->str,
 						m->base.cancellable, &m->base.error);
 					if (m->base.error != NULL)
@@ -155,18 +155,18 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 
 					/* this folder no longer exists, unsubscribe it */
 					if (camel_store_supports_subscriptions (m->fromstore))
-						camel_store_unsubscribe_folder (
+						camel_store_unsubscribe_folder_sync (
 							m->fromstore, info->full_name, NULL, NULL);
 
 					deleted = 1;
 				} else {
-					fromfolder = camel_store_get_folder (
+					fromfolder = camel_store_get_folder_sync (
 						m->fromstore, info->full_name, 0,
 						m->base.cancellable, &m->base.error);
 					if (fromfolder == NULL)
 						goto exception;
 
-					tofolder = camel_store_get_folder (
+					tofolder = camel_store_get_folder_sync (
 						m->tostore, toname->str,
 						CAMEL_STORE_FOLDER_CREATE,
 						m->base.cancellable,
@@ -177,15 +177,15 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 					}
 
 					uids = camel_folder_get_uids (fromfolder);
-					camel_folder_transfer_messages_to (
+					camel_folder_transfer_messages_to_sync (
 						fromfolder, uids, tofolder,
-						NULL, m->delete,
+						m->delete, NULL,
 						m->base.cancellable,
 						&m->base.error);
 					camel_folder_free_uids (fromfolder, uids);
 
 					if (m->delete && m->base.error == NULL)
-						camel_folder_sync (
+						camel_folder_synchronize_sync (
 							fromfolder, TRUE,
 							NULL, NULL);
 
@@ -202,7 +202,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 			/* subscribe to the new folder if appropriate */
 			if (camel_store_supports_subscriptions (m->tostore)
 			    && !camel_store_folder_is_subscribed (m->tostore, toname->str))
-				camel_store_subscribe_folder (
+				camel_store_subscribe_folder_sync (
 					m->tostore, toname->str, NULL, NULL);
 
 			info = info->next;
@@ -220,10 +220,10 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
 		   since otherwise the users sees a failed operation
 		   with no error message or even any warnings */
 		if (camel_store_supports_subscriptions (m->fromstore))
-			camel_store_unsubscribe_folder (
+			camel_store_unsubscribe_folder_sync (
 				m->fromstore, info->full_name, NULL, NULL);
 
-		camel_store_delete_folder (
+		camel_store_delete_folder_sync (
 			m->fromstore, info->full_name, NULL, NULL);
 		l = l->next;
 	}
@@ -548,12 +548,12 @@ emfu_create_folder__exec (struct _EMCreateFolder *m)
 {
 	d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name));
 
-	if ((m->fi = camel_store_create_folder (
+	if ((m->fi = camel_store_create_folder_sync (
 		m->store, m->parent, m->name,
 		m->base.cancellable, &m->base.error))) {
 
 		if (camel_store_supports_subscriptions (m->store))
-			camel_store_subscribe_folder (
+			camel_store_subscribe_folder_sync (
 				m->store, m->full_name,
 				m->base.cancellable, &m->base.error);
 	}
@@ -751,7 +751,7 @@ emfu_unsubscribe_folder__exec (struct _folder_unsub_t *msg)
 		path = url->path + 1;
 
 	if (path != NULL)
-		camel_store_unsubscribe_folder (
+		camel_store_unsubscribe_folder_sync (
 			store, path, msg->base.cancellable,
 			&msg->base.error);
 
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index d68b1f2..3776d94 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -146,7 +146,12 @@ struct _attach_puri {
         camel_cipher_validity_encrypt_t encrypt;
 };
 
-static void efhd_message_prefix (EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info);
+static void	efhd_message_prefix		(EMFormat *emf,
+						 CamelStream *stream,
+						 CamelMimePart *part,
+						 const EMFormatHandler *info,
+						 GCancellable *cancellable,
+						 gboolean is_fallback);
 
 static void efhd_builtin_init (EMFormatHTMLDisplayClass *efhc);
 
@@ -428,14 +433,16 @@ efhd_format_attachment (EMFormat *emf,
 		stream, EM_FORMAT_HTML_VPAD
 		"<table cellspacing=0 cellpadding=0><tr><td>"
 		"<table width=10 cellspacing=0 cellpadding=0>"
-		"<tr><td></td></tr></table></td>", NULL);
+		"<tr><td></td></tr></table></td>",
+		cancellable, NULL);
 
 	camel_stream_printf (
 		stream, "<td><object classid=\"%s\"></object></td>", classid);
 
 	camel_stream_write_string (
 		stream, "<td><table width=3 cellspacing=0 cellpadding=0>"
-		"<tr><td></td></tr></table></td><td><font size=-1>", NULL);
+		"<tr><td></td></tr></table></td><td><font size=-1>",
+		cancellable, NULL);
 
 	/* output some info about it */
 	/* FIXME: should we look up mime_type from object again? */
@@ -443,13 +450,13 @@ efhd_format_attachment (EMFormat *emf,
 	html = camel_text_to_html (
 		text, EM_FORMAT_HTML (emf)->text_html_flags &
 		CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
-	camel_stream_write_string (stream, html, NULL);
+	camel_stream_write_string (stream, html, cancellable, NULL);
 	g_free (html);
 	g_free (text);
 
 	camel_stream_write_string (
 		stream, "</font></td></tr><tr></table>\n"
-		EM_FORMAT_HTML_VPAD, NULL);
+		EM_FORMAT_HTML_VPAD, cancellable, NULL);
 
 	if (handle && info->shown)
 		handle->handler (
@@ -462,7 +469,8 @@ static void
 efhd_format_optional (EMFormat *emf,
                       CamelStream *fstream,
                       CamelMimePart *part,
-                      CamelStream *mstream)
+                      CamelStream *mstream,
+                      GCancellable *cancellable)
 {
 	gchar *classid, *html;
 	struct _attach_puri *info;
@@ -494,7 +502,7 @@ efhd_format_optional (EMFormat *emf,
 	camel_stream_write_string (
 		stream, EM_FORMAT_HTML_VPAD
 		"<table cellspacing=0 cellpadding=0><tr><td>"
-		"<h3><font size=-1 color=red>", NULL);
+		"<h3><font size=-1 color=red>", cancellable, NULL);
 
 	html = camel_text_to_html (
 		_("Evolution cannot render this email as it is too "
@@ -502,18 +510,21 @@ efhd_format_optional (EMFormat *emf,
 		  "with an external text editor."),
 		EM_FORMAT_HTML (emf)->text_html_flags &
 		CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
-	camel_stream_write_string (stream, html, NULL);
+	camel_stream_write_string (stream, html, cancellable, NULL);
 	camel_stream_write_string (
-		stream, "</font></h3></td></tr></table>\n", NULL);
+		stream, "</font></h3></td></tr></table>\n",
+		cancellable, NULL);
 	camel_stream_write_string (
-		stream, "<table cellspacing=0 cellpadding=0><tr>", NULL);
+		stream, "<table cellspacing=0 cellpadding=0><tr>",
+		cancellable, NULL);
 	camel_stream_printf (
 		stream, "<td><object classid=\"%s\"></object>"
 		"</td></tr></table>", classid);
 
 	g_free (html);
 
-	camel_stream_write_string (stream, EM_FORMAT_HTML_VPAD, NULL);
+	camel_stream_write_string (
+		stream, EM_FORMAT_HTML_VPAD, cancellable, NULL);
 
 	g_free (classid);
 }
@@ -664,7 +675,7 @@ em_format_html_display_new (void)
 /* ********************************************************************** */
 
 static EMFormatHandler type_builtin_table[] = {
-	{ (gchar *) "x-evolution/message/prefix", (EMFormatFunc)efhd_message_prefix },
+	{ (gchar *) "x-evolution/message/prefix", efhd_message_prefix },
 	{ (gchar *) "x-evolution/message/post-header", (EMFormatFunc)efhd_message_add_bar }
 };
 
@@ -687,12 +698,18 @@ efhd_write_image (EMFormat *emf,
 
 	/* TODO: identical to efh_write_image */
 	d(printf("writing image '%s'\n", puri->cid));
-	camel_data_wrapper_decode_to_stream (dw, stream, NULL);
-	camel_stream_close (stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (
+		dw, stream, cancellable, NULL);
+	camel_stream_close (stream, cancellable, NULL);
 }
 
 static void
-efhd_message_prefix (EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+efhd_message_prefix (EMFormat *emf,
+                     CamelStream *stream,
+                     CamelMimePart *part,
+                     const EMFormatHandler *info,
+                     GCancellable *cancellable,
+                     gboolean is_fallback)
 {
 	const gchar *flag, *comp, *due;
 	time_t date;
@@ -711,7 +728,9 @@ efhd_message_prefix (EMFormat *emf, CamelStream *stream, CamelMimePart *part, EM
 	if (iconpath) {
 		CamelMimePart *iconpart;
 
-		iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", iconpath);
+		iconpart = em_format_html_file_part (
+			(EMFormatHTML *)emf, "image/png",
+			iconpath, cancellable);
 		g_free (iconpath);
 		if (iconpart) {
 			gchar *classid;
@@ -874,7 +893,7 @@ efhd_attachment_frame (EMFormat *emf,
 			emf, stream, info->puri.part,
 			info->handle, cancellable, FALSE);
 
-	camel_stream_close (stream, NULL);
+	camel_stream_close (stream, cancellable, NULL);
 }
 
 static void
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 49a203b..42edac3 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -126,7 +126,8 @@ static void	efh_format_message		(EMFormat *emf,
 						 CamelStream *stream,
 						 CamelMimePart *part,
 						 const EMFormatHandler *info,
-						 GCancellable *cancellable);
+						 GCancellable *cancellable,
+						 gboolean is_fallback);
 
 static void	efh_format_secure		(EMFormat *emf,
 						 CamelStream *stream,
@@ -194,7 +195,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);
+			(CamelMimePart *) m->message, m->base.cancellable);
 	} else {
 		const EMFormatHandler *handle;
 		const gchar *mime_type;
@@ -218,7 +219,7 @@ efh_format_exec (struct _format_msg *m)
 				m->base.cancellable, FALSE);
 	}
 
-	camel_stream_flush ((CamelStream *)m->estream, NULL);
+	camel_stream_flush ((CamelStream *)m->estream, m->base.cancellable, NULL);
 
 	puri_level = format->pending_uri_level;
 	base = format->base;
@@ -256,8 +257,8 @@ efh_format_exec (struct _format_msg *m)
 			d(printf("out of jobs, closing root stream\n"));
 			camel_stream_write_string (
 				(CamelStream *) m->estream,
-				"</body>\n</html>\n", NULL);
-			camel_stream_close ((CamelStream *)m->estream, NULL);
+				"</body>\n</html>\n", m->base.cancellable, NULL);
+			camel_stream_close ((CamelStream *)m->estream, m->base.cancellable, NULL);
 			g_object_unref (m->estream);
 			m->estream = NULL;
 		}
@@ -286,7 +287,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, NULL);
+		camel_stream_close ((CamelStream *)m->estream, m->base.cancellable, NULL);
 		g_object_unref (m->estream);
 	}
 	if (m->folder)
@@ -696,7 +697,8 @@ efh_format_error (EMFormat *emf,
 static void
 efh_format_source (EMFormat *emf,
                    CamelStream *stream,
-                   CamelMimePart *part)
+                   CamelMimePart *part,
+                   GCancellable *cancellable)
 {
 	CamelStream *filtered_stream;
 	CamelMimeFilter *filter;
@@ -712,11 +714,11 @@ efh_format_source (EMFormat *emf,
 		CAMEL_STREAM_FILTER (filtered_stream), filter);
 	g_object_unref (filter);
 
-	camel_stream_write_string (stream, "<table><tr><td><tt>", NULL);
-	em_format_format_text (emf, (CamelStream *) filtered_stream, dw);
+	camel_stream_write_string (stream, "<table><tr><td><tt>", cancellable, NULL);
+	em_format_format_text (emf, (CamelStream *) filtered_stream, dw, cancellable);
 	g_object_unref (filtered_stream);
 
-	camel_stream_write_string(stream, "</tt></td></tr></table>", NULL);
+	camel_stream_write_string(stream, "</tt></td></tr></table>", cancellable, NULL);
 }
 
 static void
@@ -739,19 +741,19 @@ efh_format_attachment (EMFormat *emf,
 		"<tr><td></td></tr></table></td>"
 		"<td><table width=3 cellspacing=0 cellpadding=0>"
 		"<tr><td></td></tr></table></td><td><font size=-1>\n",
-		NULL);
+		cancellable, NULL);
 
 	/* output some info about it */
 	text = em_format_describe_part (part, mime_type);
 	html = camel_text_to_html (
 		text, ((EMFormatHTML *)emf)->text_html_flags &
 		CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
-	camel_stream_write_string (stream, html, NULL);
+	camel_stream_write_string (stream, html, cancellable, NULL);
 	g_free (html);
 	g_free (text);
 
 	camel_stream_write_string (
-		stream, "</font></td></tr><tr></table>", NULL);
+		stream, "</font></td></tr><tr></table>", cancellable, NULL);
 
 	if (handle && em_format_is_inline (emf, emf->part_id->str, part, handle))
 		handle->handler (emf, stream, part, handle, cancellable, FALSE);
@@ -1226,7 +1228,10 @@ em_format_html_set_show_real_date (EMFormatHTML *efh,
 }
 
 CamelMimePart *
-em_format_html_file_part (EMFormatHTML *efh, const gchar *mime_type, const gchar *filename)
+em_format_html_file_part (EMFormatHTML *efh,
+                          const gchar *mime_type,
+                          const gchar *filename,
+                          GCancellable *cancellable)
 {
 	CamelMimePart *part;
 	CamelStream *stream;
@@ -1238,7 +1243,8 @@ em_format_html_file_part (EMFormatHTML *efh, const gchar *mime_type, const gchar
 		return NULL;
 
 	dw = camel_data_wrapper_new ();
-	camel_data_wrapper_construct_from_stream (dw, stream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		dw, stream, cancellable, NULL);
 	g_object_unref (stream);
 	if (mime_type)
 		camel_data_wrapper_set_mime_type (dw, mime_type);
@@ -1437,7 +1443,8 @@ emfh_gethttp (struct _EMFormatHTMLJob *job,
 			camel_http_stream_set_proxy ((CamelHttpStream *)instream, proxy);
 			g_free (proxy);
 		}
-		camel_operation_start (cancellable, _("Retrieving '%s'"), job->u.uri);
+		camel_operation_push_message (
+			cancellable, _("Retrieving '%s'"), job->u.uri);
 		tmp_stream = (CamelHttpStream *)instream;
 		content_type = camel_http_stream_get_content_type (tmp_stream);
 		length = camel_header_raw_find(&tmp_stream->headers, "Content-Length", NULL);
@@ -1446,7 +1453,8 @@ emfh_gethttp (struct _EMFormatHTMLJob *job,
 			total = atoi (length);
 		camel_content_type_unref (content_type);
 	} else
-		camel_operation_start_transient (cancellable, _("Retrieving '%s'"), job->u.uri);
+		camel_operation_push_message (
+			cancellable, _("Retrieving '%s'"), job->u.uri);
 
 	camel_url_free (url);
 
@@ -1462,7 +1470,7 @@ emfh_gethttp (struct _EMFormatHTMLJob *job,
 			break;
 		}
 		/* FIXME: progress reporting in percentage, can we get the length always?  do we care? */
-		n = camel_stream_read (instream, buffer, sizeof (buffer), NULL);
+		n = camel_stream_read (instream, buffer, sizeof (buffer), cancellable, NULL);
 		if (n > 0) {
 			nread += n;
 			/* If we didn't get a valid Content-Length header, do not try to calculate percentage */
@@ -1471,18 +1479,18 @@ emfh_gethttp (struct _EMFormatHTMLJob *job,
 				camel_operation_progress (cancellable, pc_complete);
 			}
 			d(printf("  read %d bytes\n", n));
-			if (costream && camel_stream_write (costream, buffer, n, NULL) == -1) {
+			if (costream && camel_stream_write (costream, buffer, n, cancellable, NULL) == -1) {
 				n = -1;
 				break;
 			}
 
-			camel_stream_write (job->stream, buffer, n, NULL);
+			camel_stream_write (job->stream, buffer, n, cancellable, NULL);
 		}
 	} while (n>0);
 
 	/* indicates success */
 	if (n == 0)
-		camel_stream_close (job->stream, NULL);
+		camel_stream_close (job->stream, cancellable, NULL);
 
 	if (costream) {
 		/* do not store broken files in a cache */
@@ -1493,7 +1501,7 @@ emfh_gethttp (struct _EMFormatHTMLJob *job,
 
 	g_object_unref (instream);
 done:
-	camel_operation_end (cancellable);
+	camel_operation_pop_message (cancellable);
 badurl:
 	g_free (job->u.uri);
 }
@@ -1649,7 +1657,7 @@ efh_format_secure (EMFormat *emf,
 		else
 			icon = smime_encrypt_table[valid->encrypt.status].icon;
 		iconpath = e_icon_factory_get_icon_filename (icon, GTK_ICON_SIZE_DIALOG);
-		iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", iconpath);
+		iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", iconpath, cancellable);
 		if (iconpart) {
 			(void)em_format_add_puri (emf, sizeof (EMFormatPURI), classid, iconpart, efh_write_image);
 			g_object_unref (iconpart);
@@ -1682,13 +1690,14 @@ efh_format_secure (EMFormat *emf,
 }
 
 static void
-efh_text_plain (EMFormatHTML *efh,
+efh_text_plain (EMFormat *emf,
                 CamelStream *stream,
                 CamelMimePart *part,
                 const EMFormatHandler *info,
                 GCancellable *cancellable,
                 gboolean is_fallback)
 {
+	EMFormatHTML *efh = EM_FORMAT_HTML (emf);
 	CamelStream *filtered_stream;
 	CamelMimeFilter *html_filter;
 	CamelMultipart *mp;
@@ -1721,7 +1730,10 @@ efh_text_plain (EMFormatHTML *efh,
 	   filters a bit.  Perhaps the superclass should just deal with
 	   html anyway and be done with it ... */
 
-	efhc = g_hash_table_lookup (efh->priv->text_inline_parts, ((EMFormat *)efh)->part_id->str);
+	efhc = g_hash_table_lookup (
+		efh->priv->text_inline_parts,
+		emf->part_id->str);
+
 	if (efhc == NULL || (mp = efhc->textmp) == NULL) {
 		EMInlineFilter *inline_filter;
 		CamelStream *null;
@@ -1729,8 +1741,8 @@ efh_text_plain (EMFormatHTML *efh,
 
 		/* if we had to snoop the part type to get here, then
 		 * use that as the base type, yuck */
-		if (((EMFormat *)efh)->snoop_mime_type == NULL
-		    || (ct = camel_content_type_decode (((EMFormat *)efh)->snoop_mime_type)) == NULL) {
+		if (emf->snoop_mime_type == NULL
+		    || (ct = camel_content_type_decode (emf->snoop_mime_type)) == NULL) {
 			ct = dw->mime_type;
 			camel_content_type_ref (ct);
 		}
@@ -1742,14 +1754,14 @@ efh_text_plain (EMFormatHTML *efh,
 		camel_stream_filter_add (
 			CAMEL_STREAM_FILTER (filtered_stream),
 			CAMEL_MIME_FILTER (inline_filter));
-		camel_data_wrapper_decode_to_stream (
-			dw, (CamelStream *)filtered_stream, NULL);
-		camel_stream_close ((CamelStream *)filtered_stream, NULL);
+		camel_data_wrapper_decode_to_stream_sync (
+			dw, (CamelStream *)filtered_stream, cancellable, NULL);
+		camel_stream_close ((CamelStream *)filtered_stream, cancellable, NULL);
 		g_object_unref (filtered_stream);
 
 		mp = em_inline_filter_get_multipart (inline_filter);
 		if (efhc == NULL)
-			efhc = efh_insert_cache (efh, ((EMFormat *)efh)->part_id->str);
+			efhc = efh_insert_cache (efh, emf->part_id->str);
 		efhc->textmp = mp;
 
 		g_object_unref (inline_filter);
@@ -1766,7 +1778,7 @@ efh_text_plain (EMFormatHTML *efh,
 
 	/* We handle our made-up multipart here, so we don't recursively call ourselves */
 
-	len = ((EMFormat *)efh)->part_id->len;
+	len = emf->part_id->len;
 	count = camel_multipart_get_number (mp);
 	for (i=0;i<count;i++) {
 		CamelMimePart *newpart = camel_multipart_get_part (mp, i);
@@ -1788,16 +1800,19 @@ efh_text_plain (EMFormatHTML *efh,
 					&efh->priv->colors[
 					EM_FORMAT_HTML_COLOR_TEXT]));
 			camel_stream_write_string (
-				stream, "<tt>\n" EFH_MESSAGE_START, NULL);
-			em_format_format_text ((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)newpart);
-			camel_stream_flush ((CamelStream *)filtered_stream, NULL);
-			camel_stream_write_string (stream, "</tt>\n", NULL);
-			camel_stream_write_string (stream, "</div>\n", NULL);
+				stream, "<tt>\n" EFH_MESSAGE_START, cancellable, NULL);
+			em_format_format_text (
+				emf, filtered_stream,
+				(CamelDataWrapper *) newpart,
+				cancellable);
+			camel_stream_flush ((CamelStream *)filtered_stream, cancellable, NULL);
+			camel_stream_write_string (stream, "</tt>\n", cancellable, NULL);
+			camel_stream_write_string (stream, "</div>\n", cancellable, NULL);
 		} else {
-			g_string_append_printf(((EMFormat *)efh)->part_id, ".inline.%d", i);
+			g_string_append_printf (emf->part_id, ".inline.%d", i);
 			em_format_part (
-				EM_FORMAT (efh), stream, newpart, cancellable);
-			g_string_truncate (((EMFormat *)efh)->part_id, len);
+				emf, stream, newpart, cancellable);
+			g_string_truncate (emf->part_id, len);
 		}
 	}
 
@@ -1805,8 +1820,14 @@ efh_text_plain (EMFormatHTML *efh,
 }
 
 static void
-efh_text_enriched (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+efh_text_enriched (EMFormat *emf,
+                   CamelStream *stream,
+                   CamelMimePart *part,
+                   const EMFormatHandler *info,
+                   GCancellable *cancellable,
+                   gboolean is_fallback)
 {
+	EMFormatHTML *efh = EM_FORMAT_HTML (emf);
 	CamelStream *filtered_stream;
 	CamelMimeFilter *enriched;
 	guint32 flags = 0;
@@ -1814,10 +1835,12 @@ efh_text_enriched (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part,
 	if (!strcmp(info->mime_type, "text/richtext")) {
 		flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT;
 		camel_stream_write_string (
-			stream, "\n<!-- text/richtext -->\n", NULL);
+			stream, "\n<!-- text/richtext -->\n",
+			cancellable, NULL);
 	} else {
 		camel_stream_write_string (
-			stream, "\n<!-- text/enriched -->\n", NULL);
+			stream, "\n<!-- text/enriched -->\n",
+			cancellable, NULL);
 	}
 
 	enriched = camel_mime_filter_enriched_new (flags);
@@ -1838,10 +1861,12 @@ efh_text_enriched (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part,
 			&efh->priv->colors[
 			EM_FORMAT_HTML_COLOR_TEXT]));
 
-	em_format_format_text ((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
+	em_format_format_text (
+		emf, (CamelStream *) filtered_stream,
+		(CamelDataWrapper *)part, cancellable);
 
 	g_object_unref (filtered_stream);
-	camel_stream_write_string (stream, "</div>", NULL);
+	camel_stream_write_string (stream, "</div>", cancellable, NULL);
 }
 
 static void
@@ -1863,12 +1888,19 @@ efh_write_text_html (EMFormat *emf,
 		camel_data_wrapper_write_to_stream (dw, out);
 	g_object_unref (out);
 #endif
-	em_format_format_text (emf, stream, (CamelDataWrapper *)puri->part);
+	em_format_format_text (
+		emf, stream, (CamelDataWrapper *)puri->part, cancellable);
 }
 
 static void
-efh_text_html (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+efh_text_html (EMFormat *emf,
+               CamelStream *stream,
+               CamelMimePart *part,
+               const EMFormatHandler *info,
+               GCancellable *cancellable,
+               gboolean is_fallback)
 {
+	EMFormatHTML *efh = EM_FORMAT_HTML (emf);
 	const gchar *location;
 	gchar *cid = NULL;
 
@@ -1892,15 +1924,15 @@ efh_text_html (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
 	   shouldn't blindly inherit the container's location. */
 	location = camel_mime_part_get_content_location (part);
 	if (location == NULL) {
-		if (((EMFormat *)efh)->base)
-			cid = camel_url_to_string (((EMFormat *)efh)->base, 0);
+		if (emf->base)
+			cid = camel_url_to_string (emf->base, 0);
 		else
-			cid = g_strdup (((EMFormat *)efh)->part_id->str);
+			cid = g_strdup (emf->part_id->str);
 	} else {
-		if (strchr (location, ':') == NULL && ((EMFormat *)efh)->base != NULL) {
+		if (strchr (location, ':') == NULL && emf->base != NULL) {
 			CamelURL *uri;
 
-			uri = camel_url_new_with_base (((EMFormat *)efh)->base, location);
+			uri = camel_url_new_with_base (emf->base, location);
 			cid = camel_url_to_string (uri, 0);
 			camel_url_free (uri);
 		} else {
@@ -1908,7 +1940,9 @@ efh_text_html (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
 		}
 	}
 
-	em_format_add_puri ((EMFormat *)efh, sizeof (EMFormatPURI), cid, part, efh_write_text_html);
+	em_format_add_puri (
+		emf, sizeof (EMFormatPURI), cid,
+		part, efh_write_text_html);
 	d(printf("adding iframe, location %s\n", cid));
 	camel_stream_printf (stream,
 			    "<iframe src=\"%s\" frameborder=0 scrolling=no>could not get %s</iframe>\n"
@@ -1919,7 +1953,12 @@ efh_text_html (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
 
 /* This is a lot of code for something useless ... */
 static void
-efh_message_external (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+efh_message_external (EMFormat *emf,
+                      CamelStream *stream,
+                      CamelMimePart *part,
+                      const EMFormatHandler *info,
+                      GCancellable *cancellable,
+                      gboolean is_fallback)
 {
 	CamelContentType *type;
 	const gchar *access_type;
@@ -2013,8 +2052,14 @@ fail:
 }
 
 static void
-efh_message_deliverystatus (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+efh_message_deliverystatus (EMFormat *emf,
+                            CamelStream *stream,
+                            CamelMimePart *part,
+                            const EMFormatHandler *info,
+                            GCancellable *cancellable,
+                            gboolean is_fallback)
 {
+	EMFormatHTML *efh = EM_FORMAT_HTML (emf);
 	CamelStream *filtered_stream;
 	CamelMimeFilter *html_filter;
 	guint32 rgb = 0x737373;
@@ -2038,12 +2083,14 @@ efh_message_deliverystatus (EMFormatHTML *efh, CamelStream *stream, CamelMimePar
 		CAMEL_STREAM_FILTER (filtered_stream), html_filter);
 	g_object_unref (html_filter);
 
-	camel_stream_write_string (stream, "<tt>\n" EFH_MESSAGE_START, NULL);
-	em_format_format_text ((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
-	camel_stream_flush ((CamelStream *)filtered_stream, NULL);
-	camel_stream_write_string (stream, "</tt>\n", NULL);
+	camel_stream_write_string (stream, "<tt>\n" EFH_MESSAGE_START, cancellable, NULL);
+	em_format_format_text (
+		emf, filtered_stream,
+		(CamelDataWrapper *)part, cancellable);
+	camel_stream_flush (filtered_stream, cancellable, NULL);
+	camel_stream_write_string (stream, "</tt>\n", cancellable, NULL);
 
-	camel_stream_write_string (stream, "</div>", NULL);
+	camel_stream_write_string (stream, "</div>", cancellable, NULL);
 }
 
 static void
@@ -2054,7 +2101,7 @@ emfh_write_related (EMFormat *emf,
 {
 	em_format_format_content (emf, stream, puri->part, cancellable);
 
-	camel_stream_close (stream, NULL);
+	camel_stream_close (stream, cancellable, NULL);
 }
 
 static void
@@ -2109,7 +2156,8 @@ efh_multipart_related (EMFormat *emf,
                        CamelStream *stream,
                        CamelMimePart *part,
                        const EMFormatHandler *info,
-                       GCancellable *cancellable)
+                       GCancellable *cancellable,
+                       gboolean is_fallback)
 {
 	CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content ((CamelMedium *)part);
 	CamelMimePart *body_part, *display_part = NULL;
@@ -2121,7 +2169,7 @@ efh_multipart_related (EMFormat *emf,
 	struct _EMFormatHTMLJob *job;
 
 	if (!CAMEL_IS_MULTIPART (mp)) {
-		em_format_format_source (emf, stream, part);
+		em_format_format_source (emf, stream, part, cancellable);
 		return;
 	}
 
@@ -2175,7 +2223,7 @@ efh_multipart_related (EMFormat *emf,
 	g_string_append_printf(emf->part_id, "related.%d", displayid);
 	em_format_part (emf, stream, display_part, cancellable);
 	g_string_truncate (emf->part_id, partidlen);
-	camel_stream_flush (stream, NULL);
+	camel_stream_flush (stream, cancellable, NULL);
 
 	/* queue a job to check for un-referenced parts to add as attachments */
 	job = em_format_html_job_new (
@@ -2196,55 +2244,62 @@ efh_write_image (EMFormat *emf,
 	CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)puri->part);
 
 	d(printf("writing image '%s'\n", puri->cid));
-	camel_data_wrapper_decode_to_stream (dw, stream, NULL);
-	camel_stream_close (stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (
+		dw, stream, cancellable, NULL);
+	camel_stream_close (stream, cancellable, NULL);
 }
 
 static void
-efh_image (EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+efh_image (EMFormat *emf,
+           CamelStream *stream,
+           CamelMimePart *part,
+           const EMFormatHandler *info,
+           GCancellable *cancellable,
+           gboolean is_fallback)
 {
 	EMFormatPURI *puri;
 
-	puri = em_format_add_puri ((EMFormat *)efh, sizeof (EMFormatPURI), NULL, part, efh_write_image);
-	d(printf("adding image '%s'\n", puri->cid));
-	camel_stream_printf(stream, "<img hspace=10 vspace=10 src=\"%s\">", puri->cid);
+	puri = em_format_add_puri (
+		emf, sizeof (EMFormatPURI), NULL, part, efh_write_image);
+	camel_stream_printf (
+		stream, "<img hspace=10 vspace=10 src=\"%s\">", puri->cid);
 }
 
 static EMFormatHandler type_builtin_table[] = {
-	{ (gchar *) "image/gif", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/jpeg", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/png", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-png", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/tiff", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-bmp", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/bmp", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/svg", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-cmu-raster", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-ico", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-portable-anymap", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-portable-bitmap", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-portable-graymap", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-portable-pixmap", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/x-xpixmap", (EMFormatFunc)efh_image },
-	{ (gchar *) "text/enriched", (EMFormatFunc)efh_text_enriched },
-	{ (gchar *) "text/plain", (EMFormatFunc)efh_text_plain },
-	{ (gchar *) "text/html", (EMFormatFunc)efh_text_html },
-	{ (gchar *) "text/richtext", (EMFormatFunc)efh_text_enriched },
-	{ (gchar *) "text/*", (EMFormatFunc)efh_text_plain },
-	{ (gchar *) "message/external-body", (EMFormatFunc)efh_message_external },
-	{ (gchar *) "message/delivery-status", (EMFormatFunc)efh_message_deliverystatus },
-	{ (gchar *) "multipart/related", (EMFormatFunc)efh_multipart_related },
+	{ (gchar *) "image/gif", efh_image },
+	{ (gchar *) "image/jpeg", efh_image },
+	{ (gchar *) "image/png", efh_image },
+	{ (gchar *) "image/x-png", efh_image },
+	{ (gchar *) "image/tiff", efh_image },
+	{ (gchar *) "image/x-bmp", efh_image },
+	{ (gchar *) "image/bmp", efh_image },
+	{ (gchar *) "image/svg", efh_image },
+	{ (gchar *) "image/x-cmu-raster", efh_image },
+	{ (gchar *) "image/x-ico", efh_image },
+	{ (gchar *) "image/x-portable-anymap", efh_image },
+	{ (gchar *) "image/x-portable-bitmap", efh_image },
+	{ (gchar *) "image/x-portable-graymap", efh_image },
+	{ (gchar *) "image/x-portable-pixmap", efh_image },
+	{ (gchar *) "image/x-xpixmap", efh_image },
+	{ (gchar *) "text/enriched", efh_text_enriched },
+	{ (gchar *) "text/plain", efh_text_plain },
+	{ (gchar *) "text/html", efh_text_html },
+	{ (gchar *) "text/richtext", efh_text_enriched },
+	{ (gchar *) "text/*", efh_text_plain },
+	{ (gchar *) "message/external-body", efh_message_external },
+	{ (gchar *) "message/delivery-status", efh_message_deliverystatus },
+	{ (gchar *) "multipart/related", efh_multipart_related },
 
 	/* This is where one adds those busted, non-registered types,
 	   that some idiot mailer writers out there decide to pull out
 	   of their proverbials at random. */
 
-	{ (gchar *) "image/jpg", (EMFormatFunc)efh_image },
-	{ (gchar *) "image/pjpeg", (EMFormatFunc)efh_image },
+	{ (gchar *) "image/jpg", efh_image },
+	{ (gchar *) "image/pjpeg", efh_image },
 
 	/* special internal types */
 
-	{ (gchar *) "x-evolution/message/rfc822", (EMFormatFunc)efh_format_message }
+	{ (gchar *) "x-evolution/message/rfc822", efh_format_message }
 };
 
 static void
@@ -2840,7 +2895,8 @@ efh_format_headers (EMFormatHTML *efh,
 			if (icon_info != NULL) {
 				iconpart = em_format_html_file_part (
 					(EMFormatHTML *) emf, "image/png",
-					gtk_icon_info_get_filename (icon_info));
+					gtk_icon_info_get_filename (icon_info),
+					cancellable);
 				gtk_icon_info_free (icon_info);
 			}
 
@@ -2861,7 +2917,8 @@ efh_format_message (EMFormat *emf,
                     CamelStream *stream,
                     CamelMimePart *part,
                     const EMFormatHandler *info,
-                    GCancellable *cancellable)
+                    GCancellable *cancellable,
+                    gboolean is_fallback)
 {
 	const EMFormatHandler *handle;
 
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index 81f2fee..bdfa62d 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -248,7 +248,8 @@ void		em_format_html_set_show_sender_photo
 /* retrieves a pseudo-part icon wrapper for a file */
 CamelMimePart *	em_format_html_file_part	(EMFormatHTML *efh,
 						 const gchar *mime_type,
-						 const gchar *filename);
+						 const gchar *filename,
+						 GCancellable *cancellable);
 
 /* for implementers */
 EMFormatHTMLPObject *
diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c
index f74ba8d..87e2296 100644
--- a/mail/em-html-stream.c
+++ b/mail/em-html-stream.c
@@ -64,7 +64,7 @@ html_stream_dispose (GObject *object)
 
 	if (emhs->html_stream) {
 		/* set 'in finalise' flag */
-		camel_stream_close (CAMEL_STREAM (emhs), NULL);
+		camel_stream_close (CAMEL_STREAM (emhs), NULL, NULL);
 	}
 }
 
diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c
index 11a4b32..c1376fc 100644
--- a/mail/em-inline-filter.c
+++ b/mail/em-inline-filter.c
@@ -92,12 +92,14 @@ inline_filter_add_part (EMInlineFilter *emif, const gchar *data, gint len)
 		camel_stream_filter_add (CAMEL_STREAM_FILTER (filter_stream), enc_filter);
 
 		/* properly encode content */
-		camel_data_wrapper_construct_from_stream (dw, filter_stream, NULL);
+		camel_data_wrapper_construct_from_stream_sync (
+			dw, filter_stream, NULL, NULL);
 
 		g_object_unref (enc_filter);
 		g_object_unref (filter_stream);
 	} else {
-		camel_data_wrapper_construct_from_stream (dw, mem, NULL);
+		camel_data_wrapper_construct_from_stream_sync (
+			dw, mem, NULL, NULL);
 	}
 	g_object_unref (mem);
 
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index c0d1120..b942e35 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -266,11 +266,11 @@ static void
 sub_folder_exec (struct _zsubscribe_msg *m)
 {
 	if (m->subscribe)
-		camel_store_subscribe_folder (
+		camel_store_subscribe_folder_sync (
 			m->sub->store, m->node->info->full_name,
 			m->base.cancellable, &m->base.error);
 	else
-		camel_store_unsubscribe_folder (
+		camel_store_unsubscribe_folder_sync (
 			m->sub->store, m->node->info->full_name,
 			m->base.cancellable, &m->base.error);
 }
@@ -454,7 +454,7 @@ sub_folderinfo_exec (struct _emse_folderinfo_msg *m)
 {
 	if (m->seq == m->sub->seq) {
 		/* get the full folder tree for search ability */
-		m->info = camel_store_get_folder_info (
+		m->info = camel_store_get_folder_info_sync (
 			m->sub->store, NULL,
 			CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL |
 			CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST |
diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c
index bb5a218..9c52cd7 100644
--- a/mail/em-sync-stream.c
+++ b/mail/em-sync-stream.c
@@ -141,6 +141,7 @@ static gssize
 sync_stream_write (CamelStream *stream,
                    const gchar *string,
                    gsize len,
+                   GCancellable *cancellable,
                    GError **error)
 {
 	EMSyncStream *emss = EM_SYNC_STREAM (stream);
@@ -168,6 +169,7 @@ sync_stream_write (CamelStream *stream,
 
 static gint
 sync_stream_flush (CamelStream *stream,
+                   GCancellable *cancellable,
                    GError **error)
 {
 	EMSyncStream *emss = EM_SYNC_STREAM (stream);
@@ -189,6 +191,7 @@ sync_stream_flush (CamelStream *stream,
 
 static gint
 sync_stream_close (CamelStream *stream,
+                   GCancellable *cancellable,
                    GError **error)
 {
 	EMSyncStream *emss = EM_SYNC_STREAM (stream);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 9220502..cf00c73 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -560,8 +560,8 @@ em_utils_write_messages_to_stream (CamelFolder *folder, GPtrArray *uids, CamelSt
 		CamelMimeMessage *message;
 		gchar *from;
 
-		/* FIXME camel_folder_get_message() may block. */
-		message = camel_folder_get_message (
+		/* FIXME camel_folder_get_message_sync() may block. */
+		message = camel_folder_get_message_sync (
 			folder, uids->pdata[i], NULL, NULL);
 		if (message == NULL) {
 			res = -1;
@@ -571,10 +571,10 @@ em_utils_write_messages_to_stream (CamelFolder *folder, GPtrArray *uids, CamelSt
 		/* we need to flush after each stream write since we are writing to the same stream */
 		from = camel_mime_message_build_mbox_from (message);
 
-		if (camel_stream_write_string (stream, from, NULL) == -1
-		    || camel_stream_flush (stream, NULL) == -1
-		    || camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, (CamelStream *)filtered_stream, NULL) == -1
-		    || camel_stream_flush ((CamelStream *)filtered_stream, NULL) == -1)
+		if (camel_stream_write_string (stream, from, NULL, NULL) == -1
+		    || camel_stream_flush (stream, NULL, NULL) == -1
+		    || camel_data_wrapper_write_to_stream_sync ((CamelDataWrapper *)message, (CamelStream *)filtered_stream, NULL, NULL) == -1
+		    || camel_stream_flush ((CamelStream *)filtered_stream, NULL, NULL) == -1)
 			res = -1;
 
 		g_free (from);
@@ -606,13 +606,14 @@ em_utils_read_messages_from_stream (CamelFolder *folder, CamelStream *stream)
 
 		/* NB: de-from filter, once written */
 		msg = camel_mime_message_new ();
-		if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) {
+		if (!camel_mime_part_construct_from_parser_sync (
+			(CamelMimePart *)msg, mp, NULL, NULL)) {
 			g_object_unref (msg);
 			break;
 		}
 
-		/* FIXME camel_folder_append_message() may block. */
-		success = camel_folder_append_message (
+		/* FIXME camel_folder_append_message_sync() may block. */
+		success = camel_folder_append_message_sync (
 			folder, msg, NULL, NULL, NULL, NULL);
 		g_object_unref (msg);
 
@@ -716,9 +717,10 @@ em_utils_selection_get_message (GtkSelectionData *selection_data,
 	stream = (CamelStream *)
 		camel_stream_mem_new_with_buffer ((gchar *)data, length);
 	msg = camel_mime_message_new ();
-	if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream, NULL) == 0)
-		/* FIXME camel_folder_append_message() may block. */
-		camel_folder_append_message (
+	if (camel_data_wrapper_construct_from_stream_sync (
+		(CamelDataWrapper *)msg, stream, NULL, NULL))
+		/* FIXME camel_folder_append_message_sync() may block. */
+		camel_folder_append_message_sync (
 			folder, msg, NULL, NULL, NULL, NULL);
 	g_object_unref (msg);
 	g_object_unref (stream);
@@ -812,9 +814,9 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data,
 	folder = mail_tool_uri_to_folder (
 		(gchar *) data, 0, cancellable, error);
 	if (folder) {
-		/* FIXME camel_folder_transfer_messages_to() may block. */
-		camel_folder_transfer_messages_to (
-			folder, uids, dest, NULL, move, cancellable, error);
+		/* FIXME camel_folder_transfer_messages_to_sync() may block. */
+		camel_folder_transfer_messages_to_sync (
+			folder, uids, dest, move, NULL, cancellable, error);
 		g_object_unref (folder);
 	}
 
@@ -1264,15 +1266,15 @@ em_utils_message_to_html (CamelMimeMessage *message,
                           guint32 *validity_found)
 {
 	EMFormatQuote *emfq;
-	CamelStreamMem *mem;
+	CamelStream *mem;
 	GByteArray *buf;
 	gchar *text;
 
 	buf = g_byte_array_new ();
-	mem = (CamelStreamMem *) camel_stream_mem_new ();
-	camel_stream_mem_set_byte_array (mem, buf);
+	mem = camel_stream_mem_new ();
+	camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (mem), buf);
 
-	emfq = em_format_quote_new (credits, (CamelStream *)mem, flags);
+	emfq = em_format_quote_new (credits, mem, flags);
 	((EMFormat *) emfq)->composer = TRUE;
 
 	if (!source) {
@@ -1295,9 +1297,9 @@ em_utils_message_to_html (CamelMimeMessage *message,
 	g_object_unref (emfq);
 
 	if (append && *append)
-		camel_stream_write ((CamelStream*)mem, append, strlen (append), NULL);
+		camel_stream_write_string (mem, append, NULL, NULL);
 
-	camel_stream_write((CamelStream *)mem, "", 1, NULL);
+	camel_stream_write(mem, "", 1, NULL, NULL);
 	g_object_unref (mem);
 
 	text = (gchar *)buf->data;
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index 51d8796..a929b6b 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -332,8 +332,8 @@ mbox_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im)
 		gchar *from;
 
 		msg = camel_mime_message_new ();
-		if (camel_mime_part_construct_from_parser (
-			(CamelMimePart *)msg, mp, NULL) == -1) {
+		if (!camel_mime_part_construct_from_parser_sync (
+			(CamelMimePart *)msg, mp, NULL, NULL)) {
 			g_object_unref (msg);
 			break;
 		}
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index 3dac787..b70b6b0 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -130,8 +130,6 @@ import_mbox_exec (struct _import_mbox_msg *m)
 		return;
 
 	if (S_ISREG (st.st_mode)) {
-		CamelOperation *oldcancel = NULL;
-
 		fd = g_open (m->path, O_RDONLY|O_BINARY, 0);
 		if (fd == -1) {
 			g_warning("cannot find source file to import '%s': %s", m->path, g_strerror(errno));
@@ -144,11 +142,8 @@ import_mbox_exec (struct _import_mbox_msg *m)
 			goto fail2;
 		}
 
-		if (m->cancel)
-			oldcancel = camel_operation_register (m->cancel);
-
-		camel_operation_start (
-			NULL, _("Importing '%s'"),
+		camel_operation_push_message (
+			m->base.cancellable, _("Importing '%s'"),
 			camel_folder_get_full_name (folder));
 		camel_folder_freeze (folder);
 		while (camel_mime_parser_step (mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) {
@@ -159,10 +154,11 @@ import_mbox_exec (struct _import_mbox_msg *m)
 
 			if (st.st_size > 0)
 				pc = (gint)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size));
-			camel_operation_progress (NULL, pc);
+			camel_operation_progress (m->base.cancellable, pc);
 
 			msg = camel_mime_message_new ();
-			if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) {
+			if (!camel_mime_part_construct_from_parser_sync (
+				(CamelMimePart *)msg, mp, NULL, NULL)) {
 				/* set exception? */
 				g_object_unref (msg);
 				break;
@@ -181,7 +177,7 @@ import_mbox_exec (struct _import_mbox_msg *m)
 				flags |= decode_status (tmp);
 
 			camel_message_info_set_flags (info, flags, ~0);
-			camel_folder_append_message (
+			camel_folder_append_message_sync (
 				folder, msg, info, NULL,
 				m->base.cancellable, &m->base.error);
 			camel_message_info_free (info);
@@ -193,18 +189,16 @@ import_mbox_exec (struct _import_mbox_msg *m)
 			camel_mime_parser_step (mp, NULL, NULL);
 		}
 		/* FIXME Not passing a GCancellable or GError here. */
-		camel_folder_sync (folder, FALSE, NULL, NULL);
+		camel_folder_synchronize_sync (folder, FALSE, NULL, NULL);
 		camel_folder_thaw (folder);
-		camel_operation_end (NULL);
+		camel_operation_pop_message (m->base.cancellable);
 		/* TODO: these api's are a bit weird, registering the old is the same as deregistering */
-		if (m->cancel)
-			camel_operation_register (oldcancel);
 	fail2:
 		g_object_unref (mp);
 	}
 fail1:
 	/* FIXME Not passing a GCancellable or GError here. */
-	camel_folder_sync (folder, FALSE, NULL, NULL);
+	camel_folder_synchronize_sync (folder, FALSE, NULL, NULL);
 	g_object_unref (folder);
 }
 
@@ -292,7 +286,7 @@ import_folders_rec (struct _import_folders_data *m, const gchar *filepath, const
 	data_dir = mail_session_get_data_dir ();
 
 	utf8_filename = g_filename_to_utf8 (filepath, -1, NULL, NULL, NULL);
-	camel_operation_start(NULL, _("Scanning %s"), utf8_filename);
+	camel_operation_push_message (NULL, _("Scanning %s"), utf8_filename);
 	g_free (utf8_filename);
 
 	while ( (d=g_dir_read_name (dir))) {
@@ -350,7 +344,7 @@ import_folders_rec (struct _import_folders_data *m, const gchar *filepath, const
 	}
 	g_dir_close (dir);
 
-	camel_operation_end (NULL);
+	camel_operation_pop_message (NULL);
 }
 
 /**
@@ -372,17 +366,10 @@ void
 mail_importer_import_folders_sync (const gchar *filepath, MailImporterSpecial special_folders[], gint flags, CamelOperation *cancel)
 {
 	struct _import_folders_data m;
-	CamelOperation *oldcancel = NULL;
 
 	m.special_folders = special_folders;
 	m.elmfmt = (flags & MAIL_IMPORTER_MOZFMT) == 0;
 	m.cancel = cancel;
 
-	if (cancel)
-		oldcancel = camel_operation_register (cancel);
-
 	import_folders_rec (&m, filepath, NULL);
-
-	if (cancel)
-		camel_operation_register (oldcancel);
 }
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 00818a1..78cd647 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -195,8 +195,8 @@ real_flush_updates (gpointer o, gpointer event_data, gpointer data)
 			 * ensure their changes will be tracked correctly. */
 			CamelFolder *folder;
 
-			/* FIXME camel_store_get_folder() may block. */
-			folder = camel_store_get_folder (
+			/* FIXME camel_store_get_folder_sync() may block. */
+			folder = camel_store_get_folder_sync (
 				up->store, up->full_name, 0, NULL, NULL);
 
 			if (folder) {
@@ -802,12 +802,12 @@ ping_store_exec (struct _ping_store_msg *m)
 			CAMEL_DISCO_STORE (m->store)) !=CAMEL_DISCO_STORE_OFFLINE)
 			online = TRUE;
 		else if (CAMEL_IS_OFFLINE_STORE (m->store) &&
-			CAMEL_OFFLINE_STORE (m->store)->state !=
-			CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
+			camel_offline_store_get_online (
+			CAMEL_OFFLINE_STORE (m->store)))
 			online = TRUE;
 	}
 	if (online)
-		camel_store_noop (
+		camel_store_noop_sync (
 			m->store, m->base.cancellable, &m->base.error);
 }
 
@@ -1140,8 +1140,8 @@ mail_folder_cache_note_store (MailFolderCache *self,
 		}
 	} else if (CAMEL_IS_OFFLINE_STORE (store)) {
 		if (camel_session_get_online (session) &&
-			CAMEL_OFFLINE_STORE (store)->state ==
-			CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
+			!camel_offline_store_get_online (
+			CAMEL_OFFLINE_STORE (store))) {
 			/* Note: we use the 'id' here, even though its not the right id, its still ok */
 			ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud);
 		} else {
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 694a8f5..87f6b25 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -298,16 +298,24 @@ void
 mail_msg_cancel (guint msgid)
 {
 	MailMsg *msg;
+	GCancellable *cancellable = NULL;
 
 	g_mutex_lock (mail_msg_lock);
 
 	msg = g_hash_table_lookup (
 		mail_msg_active_table, GINT_TO_POINTER (msgid));
 
-	if (msg != NULL && msg->cancellable != NULL)
-		camel_operation_cancel (CAMEL_OPERATION (msg->cancellable));
+	/* Hold a reference to the GCancellable so it doesn't finalize
+	 * itself on us between unlocking the mutex and cancelling. */
+	if (msg != NULL && !g_cancellable_is_cancelled (msg->cancellable))
+		cancellable = g_object_ref (msg->cancellable);
 
 	g_mutex_unlock (mail_msg_lock);
+
+	if (cancellable != NULL) {
+		camel_operation_cancel (CAMEL_OPERATION (cancellable));
+		g_object_unref (cancellable);
+	}
 }
 
 /* waits for a message to be finished processing (freed)
@@ -474,7 +482,7 @@ mail_msg_proxy (MailMsg *msg)
 {
 	if (msg->info->desc != NULL) {
 		gchar *text = msg->info->desc (msg);
-		camel_operation_start (msg->cancellable, "%s", text);
+		camel_operation_push_message (msg->cancellable, "%s", text);
 		g_free (text);
 	}
 
@@ -488,7 +496,7 @@ mail_msg_proxy (MailMsg *msg)
 		msg->info->exec (msg);
 
 	if (msg->info->desc != NULL)
-		camel_operation_end (msg->cancellable);
+		camel_operation_pop_message (msg->cancellable);
 
 	g_async_queue_push (msg_reply_queue, msg);
 
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 5699199..89b83ec 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -59,7 +59,6 @@ struct _filter_mail_msg {
 	CamelFolder *source_folder; /* where they come from */
 	GPtrArray *source_uids;	/* uids to copy, or NULL == copy all */
 	CamelUIDCache *cache;  /* UID cache if we are to cache the uids, NULL otherwise */
-	CamelOperation *cancel;
 	CamelFilterDriver *driver;
 	gint delete;		/* delete messages after filtering them? */
 	CamelFolder *destination; /* default destination for any messages, NULL for none */
@@ -93,16 +92,10 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m)
 	CamelFolder *folder;
 	GPtrArray *uids, *folder_uids = NULL;
 
-	if (m->cancel)
-		camel_operation_register (m->cancel);
-
 	folder = m->source_folder;
 
-	if (folder == NULL || camel_folder_get_message_count (folder) == 0) {
-		if (m->cancel)
-			camel_operation_unregister ();
+	if (folder == NULL || camel_folder_get_message_count (folder) == 0)
 		return;
-	}
 
 	if (m->destination) {
 		camel_folder_freeze (m->destination);
@@ -126,7 +119,7 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m)
 
 	/* sync our source folder */
 	if (!m->cache)
-		camel_folder_sync (
+		camel_folder_synchronize_sync (
 			folder, FALSE, m->base.cancellable, &m->base.error);
 	camel_folder_thaw (folder);
 
@@ -137,9 +130,6 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m)
 	   see also fetch_mail_fetch () below */
 	g_object_unref (m->driver);
 	m->driver = NULL;
-
-	if (m->cancel)
-		camel_operation_unregister ();
 }
 
 static void
@@ -156,9 +146,6 @@ em_filter_folder_element_free (struct _filter_mail_msg *m)
 	if (m->source_uids)
 		em_utils_uids_free (m->source_uids);
 
-	if (m->cancel)
-		g_object_unref (m->cancel);
-
 	if (m->destination)
 		g_object_unref (m->destination);
 
@@ -178,8 +165,7 @@ static MailMsgInfo em_filter_folder_element_info = {
 
 void
 mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
-		    const gchar *type, gboolean notify,
-		    CamelOperation *cancel)
+		    const gchar *type, gboolean notify)
 {
 	struct _filter_mail_msg *m;
 
@@ -189,8 +175,6 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
 	m->source_uids = uids;
 	m->cache = NULL;
 	m->delete = FALSE;
-	if (cancel)
-		m->cancel = g_object_ref (cancel);
 
 	m->driver = camel_session_get_filter_driver (session, type, NULL);
 
@@ -207,13 +191,13 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
 void
 mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids)
 {
-	mail_filter_folder (folder, uids, E_FILTER_SOURCE_DEMAND, FALSE, NULL);
+	mail_filter_folder (folder, uids, E_FILTER_SOURCE_DEMAND, FALSE);
 }
 
 void
 mail_filter_junk (CamelFolder *folder, GPtrArray *uids)
 {
-	mail_filter_folder (folder, uids, E_FILTER_SOURCE_JUNKTEST, FALSE, NULL);
+	mail_filter_folder (folder, uids, E_FILTER_SOURCE_JUNKTEST, FALSE);
 }
 
 /* ********************************************************************** */
@@ -251,9 +235,6 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
 	struct _filter_mail_msg *fm = (struct _filter_mail_msg *)m;
 	gint i;
 
-	if (m->cancellable)
-		camel_operation_register (CAMEL_OPERATION (m->cancellable));
-
 	fm->destination = e_mail_local_get_folder (E_MAIL_FOLDER_LOCAL_INBOX);
 	if (fm->destination == NULL)
 		goto fail;
@@ -315,8 +296,8 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
 					em_filter_folder_element_exec (fm);
 
 					/* need to uncancel so writes/etc. don't fail */
-					if (g_error_matches (fm->base.error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-						camel_operation_uncancel (NULL);
+					if (g_cancellable_is_cancelled (m->cancellable))
+						g_cancellable_reset (m->cancellable);
 
 					/* save the cache of uids that we've just downloaded */
 					camel_uid_cache_save (cache);
@@ -333,7 +314,8 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
 				if ((fm->delete || cache_uids) && fm->base.error == NULL) {
 					/* expunge messages (downloaded so far) */
 					/* FIXME Not passing a GCancellable or GError here. */
-					camel_folder_sync (folder, fm->delete, NULL, NULL);
+					camel_folder_synchronize_sync (
+						folder, fm->delete, NULL, NULL);
 				}
 
 				camel_uid_cache_destroy (cache);
@@ -350,9 +332,6 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
 		}
 	}
 fail:
-	if (m->cancellable)
-		camel_operation_unregister ();
-
 	/* we unref this here as it may have more work to do (syncing
 	   folders and whatnot) before we are really done */
 	/* should this be cancellable too? (i.e. above unregister above) */
@@ -488,7 +467,8 @@ mail_send_message (struct _send_queue_msg *m,
 	gint i;
 	GError *local_error = NULL;
 
-	message = camel_folder_get_message (queue, uid, cancellable, error);
+	message = camel_folder_get_message_sync (
+		queue, uid, cancellable, error);
 	if (!message)
 		return;
 
@@ -559,7 +539,7 @@ mail_send_message (struct _send_queue_msg *m,
 		if (xport == NULL)
 			goto exit;
 
-		if (!camel_transport_send_to (
+		if (!camel_transport_send_to_sync (
 			xport, message, from, recipients, cancellable, error))
 			goto exit;
 	}
@@ -581,7 +561,7 @@ mail_send_message (struct _send_queue_msg *m,
 		folder = mail_tool_uri_to_folder (uri, 0, NULL, NULL);
 		if (folder) {
 			/* FIXME Not passing a GCancellable or GError here. */
-			camel_folder_append_message (
+			camel_folder_append_message_sync (
 				folder, message, info, NULL, NULL, NULL);
 			g_object_unref (folder);
 			folder = NULL;
@@ -631,7 +611,7 @@ mail_send_message (struct _send_queue_msg *m,
 			g_object_ref (folder);
 		}
 
-		if (!camel_folder_append_message (
+		if (!camel_folder_append_message_sync (
 			folder, message, info,
 			NULL, cancellable, &local_error)) {
 
@@ -657,7 +637,7 @@ mail_send_message (struct _send_queue_msg *m,
 				folder = sent_folder;
 
 				g_clear_error (&local_error);
-				camel_folder_append_message (
+				camel_folder_append_message_sync (
 					folder, message, info,
 					NULL, cancellable, &local_error);
 			}
@@ -682,7 +662,7 @@ mail_send_message (struct _send_queue_msg *m,
 		/* Sync it to disk, since if it crashes in between,
 		 * we keep sending it again on next start. */
 		/* FIXME Not passing a GCancellable or GError here. */
-		camel_folder_sync (queue, FALSE, NULL, NULL);
+		camel_folder_synchronize_sync (queue, FALSE, NULL, NULL);
 	}
 
 	if (err->len) {
@@ -698,7 +678,7 @@ exit:
 
 	/* FIXME Not passing a GCancellable or GError here. */
 	if (folder) {
-		camel_folder_sync (folder, FALSE, NULL, NULL);
+		camel_folder_synchronize_sync (folder, FALSE, NULL, NULL);
 		g_object_unref (folder);
 	}
 	if (info)
@@ -785,13 +765,7 @@ send_queue_exec (struct _send_queue_msg *m)
 		return;
 	}
 
-	if (m->cancellable)
-		camel_operation_register (CAMEL_OPERATION (m->cancellable));
-	else
-		camel_operation_register (CAMEL_OPERATION (m->base.cancellable));
-
-	if (!m->cancellable)
-		camel_operation_start (NULL, _("Sending message"));
+	camel_operation_push_message (m->cancellable, _("Sending message"));
 
 	/* NB: This code somewhat abuses the 'exception' stuff.  Apart from
 	 *     fatal problems, it is also used as a mechanism to accumualte
@@ -807,7 +781,7 @@ send_queue_exec (struct _send_queue_msg *m)
 
 		if (!m->cancellable)
 			camel_operation_progress (
-				NULL, (i+1) * 100 / send_uids->len);
+				m->cancellable, (i+1) * 100 / send_uids->len);
 
 		mail_send_message (
 			m, m->queue, send_uids->pdata[i], m->destination,
@@ -865,17 +839,13 @@ send_queue_exec (struct _send_queue_msg *m)
 
 	/* FIXME Not passing a GCancellable or GError here. */
 	if (j <= 0 && m->base.error == NULL)
-		camel_folder_sync (m->queue, TRUE, NULL, NULL);
+		camel_folder_synchronize_sync (m->queue, TRUE, NULL, NULL);
 
 	/* FIXME Not passing a GCancellable or GError here. */
 	if (sent_folder)
-		camel_folder_sync (sent_folder, FALSE, NULL, NULL);
-
-	if (!m->cancellable)
-		camel_operation_end (NULL);
-
-	camel_operation_unregister ();
+		camel_folder_synchronize_sync (sent_folder, FALSE, NULL, NULL);
 
+	camel_operation_pop_message (m->cancellable);
 }
 
 static void
@@ -971,7 +941,7 @@ append_mail_exec (struct _append_msg *m)
 	camel_mime_message_set_date (
 		m->message, CAMEL_MESSAGE_DATE_CURRENT, 0);
 
-	camel_folder_append_message (
+	camel_folder_append_message_sync (
 		m->folder, m->message,
 		m->info, &m->appended_uid,
 		m->base.cancellable, &m->base.error);
@@ -1072,8 +1042,8 @@ transfer_messages_exec (struct _transfer_msg *m)
 	camel_folder_freeze (m->source);
 	camel_folder_freeze (dest);
 
-	camel_folder_transfer_messages_to (
-		m->source, m->uids, dest, NULL, m->delete,
+	camel_folder_transfer_messages_to_sync (
+		m->source, m->uids, dest, m->delete, NULL,
 		m->base.cancellable, &m->base.error);
 
 	/* make sure all deleted messages are marked as seen */
@@ -1091,7 +1061,7 @@ transfer_messages_exec (struct _transfer_msg *m)
 	camel_folder_thaw (dest);
 
 	/* FIXME Not passing a GCancellable or GError here. */
-	camel_folder_sync (dest, FALSE, NULL, NULL);
+	camel_folder_synchronize_sync (dest, FALSE, NULL, NULL);
 	g_object_unref (dest);
 }
 
@@ -1173,7 +1143,7 @@ get_folderinfo_exec (struct _get_folderinfo_msg *m)
 {
 	guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
 
-	m->info = camel_store_get_folder_info (
+	m->info = camel_store_get_folder_info_sync (
 		m->store, NULL, flags,
 		m->base.cancellable, &m->base.error);
 }
@@ -1548,7 +1518,7 @@ remove_folder_rec (CamelStore *store,
 
 		d(printf ("deleting folder '%s'\n", fi->full_name));
 
-		folder = camel_store_get_folder (
+		folder = camel_store_get_folder_sync (
 			store, fi->full_name, 0, cancellable, error);
 		if (folder == NULL)
 			return FALSE;
@@ -1566,7 +1536,7 @@ remove_folder_rec (CamelStore *store,
 			camel_folder_free_uids (folder, uids);
 
 			/* FIXME Not passing a GCancellable or GError here. */
-			camel_folder_sync (folder, TRUE, NULL, NULL);
+			camel_folder_synchronize_sync (folder, TRUE, NULL, NULL);
 			camel_folder_thaw (folder);
 		}
 
@@ -1574,11 +1544,11 @@ remove_folder_rec (CamelStore *store,
 		 * from this folder.
 		 * FIXME Not passing a GCancellable or GError here. */
 		if (camel_store_supports_subscriptions (store))
-			camel_store_unsubscribe_folder (
+			camel_store_unsubscribe_folder_sync (
 				store, fi->full_name, NULL, NULL);
 
 		/* Then delete the folder from the store */
-		if (!camel_store_delete_folder (
+		if (!camel_store_delete_folder_sync (
 			store, fi->full_name, cancellable, error))
 			return FALSE;
 
@@ -1600,7 +1570,7 @@ remove_folder_exec (struct _remove_folder_msg *m)
 	full_name = camel_folder_get_full_name (m->folder);
 	parent_store = camel_folder_get_parent_store (m->folder);
 
-	fi = camel_store_get_folder_info (
+	fi = camel_store_get_folder_info_sync (
 		parent_store, full_name,
 		CAMEL_STORE_FOLDER_INFO_RECURSIVE |
 		CAMEL_STORE_FOLDER_INFO_FAST |
@@ -1672,7 +1642,7 @@ sync_folder_desc (struct _sync_folder_msg *m)
 static void
 sync_folder_exec (struct _sync_folder_msg *m)
 {
-	camel_folder_sync (
+	camel_folder_synchronize_sync (
 		m->folder, FALSE, m->base.cancellable, &m->base.error);
 }
 
@@ -1740,7 +1710,7 @@ sync_store_desc (struct _sync_store_msg *m)
 static void
 sync_store_exec (struct _sync_store_msg *m)
 {
-	camel_store_sync (
+	camel_store_synchronize_sync (
 		m->store, m->expunge,
 		m->base.cancellable, &m->base.error);
 }
@@ -1792,7 +1762,7 @@ refresh_folder_desc (struct _sync_folder_msg *m)
 static void
 refresh_folder_exec (struct _sync_folder_msg *m)
 {
-	camel_folder_refresh_info (
+	camel_folder_refresh_info_sync (
 		m->folder, m->base.cancellable, &m->base.error);
 }
 
@@ -1830,7 +1800,7 @@ expunge_folder_desc (struct _sync_folder_msg *m)
 static void
 expunge_folder_exec (struct _sync_folder_msg *m)
 {
-	camel_folder_expunge (
+	camel_folder_expunge_sync (
 		m->folder, m->base.cancellable, &m->base.error);
 }
 
@@ -1894,7 +1864,7 @@ empty_trash_exec (struct _empty_trash_msg *m)
 	}
 
 	if (trash) {
-		camel_folder_expunge (
+		camel_folder_expunge_sync (
 			trash, m->base.cancellable, &m->base.error);
 		g_object_unref (trash);
 	}
@@ -1962,7 +1932,7 @@ get_message_exec (struct _get_message_msg *m)
 	if (g_cancellable_is_cancelled (m->base.cancellable))
 		m->message = NULL;
 	else
-		m->message = camel_folder_get_message (
+		m->message = camel_folder_get_message_sync (
 			m->folder, m->uid,
 			m->base.cancellable, &m->base.error);
 }
@@ -2094,7 +2064,7 @@ get_messages_exec (struct _get_messages_msg *m)
 	for (i=0; i<m->uids->len; i++) {
 		gint pc = ((i+1) * 100) / m->uids->len;
 
-		message = camel_folder_get_message (
+		message = camel_folder_get_message_sync (
 			m->folder, m->uids->pdata[i],
 			m->base.cancellable, &m->base.error);
 		camel_operation_progress (
@@ -2237,7 +2207,7 @@ save_messages_exec (struct _save_messages_msg *m)
 		CamelMimeMessage *message;
 		gint pc = ((i+1) * 100) / m->uids->len;
 
-		message = camel_folder_get_message (
+		message = camel_folder_get_message_sync (
 			m->folder, m->uids->pdata[i],
 			m->base.cancellable, &m->base.error);
 		camel_operation_progress (
@@ -2250,16 +2220,22 @@ save_messages_exec (struct _save_messages_msg *m)
 		/* we need to flush after each stream write since we are writing to the same fd */
 		from = camel_mime_message_build_mbox_from (message);
 		if (camel_stream_write_string (
-			stream, from, &m->base.error) == -1
-		    || camel_stream_flush (stream, &m->base.error) == -1
-		    || camel_data_wrapper_write_to_stream (
+			stream, from,
+			m->base.cancellable, &m->base.error) == -1
+		    || camel_stream_flush (
+			stream, m->base.cancellable, &m->base.error) == -1
+		    || camel_data_wrapper_write_to_stream_sync (
 			(CamelDataWrapper *) message,
-			(CamelStream *)filtered_stream, &m->base.error) == -1
+			(CamelStream *)filtered_stream,
+			m->base.cancellable, &m->base.error) == -1
 		    || camel_stream_flush (
-			(CamelStream *)filtered_stream, &m->base.error) == -1
+			(CamelStream *)filtered_stream,
+			m->base.cancellable, &m->base.error) == -1
 		    || camel_stream_write_string (
-			stream, "\n", &m->base.error) == -1
-		    || camel_stream_flush (stream, &m->base.error) == -1) {
+			stream, "\n",
+			m->base.cancellable, &m->base.error) == -1
+		    || camel_stream_flush (stream,
+			m->base.cancellable, &m->base.error) == -1) {
 			g_prefix_error (
 				&m->base.error,
 				_("Error saving messages to: %s:\n"),
@@ -2377,9 +2353,9 @@ save_part_exec (struct _save_part_msg *m)
 
 	content = camel_medium_get_content (CAMEL_MEDIUM (m->part));
 
-	if (camel_data_wrapper_decode_to_stream (
-		content, stream, &m->base.error) == -1
-	    || camel_stream_flush (stream, &m->base.error) == -1)
+	if (camel_data_wrapper_decode_to_stream_sync (
+		content, stream, m->base.cancellable, &m->base.error) == -1
+	    || camel_stream_flush (stream, m->base.cancellable, &m->base.error) == -1)
 		g_prefix_error (&m->base.error, _("Could not write data: "));
 
 	g_object_unref (stream);
@@ -2451,14 +2427,14 @@ prep_offline_exec (struct _prep_offline_msg *m)
 				CAMEL_DISCO_FOLDER (folder),
 				"(match-all)", m->cancel, &m->base.error);
 		} else if (CAMEL_IS_OFFLINE_FOLDER (folder)) {
-			camel_offline_folder_downsync (
+			camel_offline_folder_downsync_sync (
 				CAMEL_OFFLINE_FOLDER (folder),
 				"(match-all)", m->cancel, &m->base.error);
 		}
 		/* prepare_for_offline should do this? */
 		/* of course it should all be atomic, but ... */
 		/* FIXME Not passing a GCancellable here. */
-		camel_folder_sync (folder, FALSE, NULL, NULL);
+		camel_folder_synchronize_sync (folder, FALSE, NULL, NULL);
 		g_object_unref (folder);
 	}
 }
@@ -2547,26 +2523,16 @@ set_offline_exec (struct _set_offline_msg *m)
 			return;
 		}
 	} else if (CAMEL_IS_OFFLINE_STORE (m->store)) {
-		if (!m->offline) {
-			camel_offline_store_set_network_state (
-				CAMEL_OFFLINE_STORE (m->store),
-				CAMEL_OFFLINE_STORE_NETWORK_AVAIL,
-				m->base.cancellable,
-				&m->base.error);
-			return;
-		} else {
-			camel_offline_store_set_network_state (
-				CAMEL_OFFLINE_STORE (m->store),
-				CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL,
-				m->base.cancellable,
-				&m->base.error);
-			return;
-		}
+		camel_offline_store_set_online_sync (
+			CAMEL_OFFLINE_STORE (m->store),
+			!m->offline, m->base.cancellable,
+			&m->base.error);
+		return;
 	}
 
 	if (m->offline)
-		camel_service_disconnect (CAMEL_SERVICE (m->store),
-					  TRUE, &m->base.error);
+		camel_service_disconnect_sync (
+			CAMEL_SERVICE (m->store), TRUE, &m->base.error);
 }
 
 static void
@@ -2639,7 +2605,7 @@ prepare_offline_exec (struct _set_offline_msg *m)
 			CAMEL_DISCO_STORE (m->store),
 			m->base.cancellable, &m->base.error);
 	} else if (CAMEL_IS_OFFLINE_STORE (m->store)) {
-		camel_offline_store_prepare_for_offline (
+		camel_offline_store_prepare_for_offline_sync (
 			CAMEL_OFFLINE_STORE (m->store),
 			m->base.cancellable, &m->base.error);
 	}
@@ -2722,12 +2688,10 @@ check_service_exec (struct _check_msg *m)
 	CamelService *service;
 
 	service = camel_session_get_service (session, m->url, m->type, &m->base.error);
-	if (!service) {
-		camel_operation_unregister ();
+	if (!service)
 		return;
-	}
 
-	m->authtypes = camel_service_query_auth_types (
+	m->authtypes = camel_service_query_auth_types_sync (
 		service, m->base.cancellable, &m->base.error);
 	g_object_unref (service);
 }
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index 06b8388..a0af5ff 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -150,8 +150,7 @@ void		mail_fetch_mail			(const gchar *source,
 void		mail_filter_folder		(CamelFolder *source_folder,
 						 GPtrArray *uids,
 						 const gchar *type,
-						 gboolean notify,
-						 CamelOperation *cancel);
+						 gboolean notify);
 
 /* convenience functions for above */
 void mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 186fc90..3dcba97 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -911,8 +911,9 @@ refresh_folders_exec (struct _refresh_folders_msg *m)
 			m->base.cancellable, &local_error);
 		if (folder) {
 			/* FIXME Not passing a GCancellable or GError here. */
-			camel_folder_sync (folder, FALSE, NULL, NULL);
-			camel_folder_refresh_info (folder, NULL, NULL);
+			camel_folder_synchronize_sync (
+				folder, FALSE, NULL, NULL);
+			camel_folder_refresh_info_sync (folder, NULL, NULL);
 			g_object_unref (folder);
 		} else if (local_error != NULL) {
 			g_warning ("Failed to refresh folders: %s", local_error->message);
diff --git a/mail/mail-session.c b/mail/mail-session.c
index dbe886d..31b11ea 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -636,8 +636,8 @@ static gpointer ms_thread_msg_new (CamelSession *session, CamelSessionThreadOps
 		MailMsg *m = mail_msg_new (&ms_thread_info_dummy);
 
 		msg->data = m;
-		g_object_unref (msg->op);
-		msg->op = g_object_ref (m->cancellable);
+		g_object_unref (msg->cancellable);
+		msg->cancellable = g_object_ref (m->cancellable);
 	}
 
 	return msg;
@@ -737,9 +737,9 @@ ms_forward_to (CamelSession *session,
 
 	/* make copy of the message, because we are going to modify it */
 	mem = camel_stream_mem_new ();
-	camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, mem, NULL);
+	camel_data_wrapper_write_to_stream_sync ((CamelDataWrapper *)message, mem, NULL, NULL);
 	camel_seekable_stream_seek (CAMEL_SEEKABLE_STREAM (mem), 0, CAMEL_STREAM_SET, NULL);
-	camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)forward, mem, NULL);
+	camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *)forward, mem, NULL, NULL);
 	g_object_unref (mem);
 
 	/* clear previous recipients */
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 66ffdd2..3804321 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -55,7 +55,7 @@ mail_tool_get_inbox (const gchar *url,
 	if (!store)
 		return NULL;
 
-	folder = camel_store_get_inbox (store, cancellable, error);
+	folder = camel_store_get_inbox_folder_sync (store, cancellable, error);
 	g_object_unref (store);
 
 	return folder;
@@ -96,7 +96,8 @@ mail_tool_get_trash (const gchar *url,
 	if (connect ||
 		(CAMEL_SERVICE (store)->status == CAMEL_SERVICE_CONNECTED ||
 		is_local_provider (store)))
-		trash = camel_store_get_trash (store, cancellable, error);
+		trash = camel_store_get_trash_folder_sync (
+			store, cancellable, error);
 	else
 		trash = NULL;
 
@@ -351,13 +352,13 @@ mail_tool_uri_to_folder (const gchar *uri,
 
 		if (offset) {
 			if (offset == 7)
-				folder = camel_store_get_trash (
+				folder = camel_store_get_trash_folder_sync (
 					store, cancellable, error);
 			else if (offset == 6)
-				folder = camel_store_get_junk (
+				folder = camel_store_get_junk_folder_sync (
 					store, cancellable, error);
 		} else
-			folder = camel_store_get_folder (
+			folder = camel_store_get_folder_sync (
 				store, name, flags, cancellable, error);
 		g_object_unref (store);
 	}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 221151c..cb47af8 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -263,8 +263,7 @@ vfolder_adduri_exec (struct _adduri_msg *m)
 		while (l && !vfolder_shutdown) {
 			if (m->remove)
 				camel_vee_folder_remove_folder (
-					CAMEL_VEE_FOLDER (l->data),
-					folder, m->base.cancellable);
+					CAMEL_VEE_FOLDER (l->data), folder);
 			else
 				camel_vee_folder_add_folder ((CamelVeeFolder *)l->data, folder);
 			l = l->next;
@@ -834,7 +833,7 @@ rule_changed (EFilterRule *rule, CamelFolder *folder)
 
 		oldname = g_strdup (full_name);
 		/* FIXME Not passing a GCancellable or GError. */
-		camel_store_rename_folder (
+		camel_store_rename_folder_sync (
 			vfolder_store, oldname, rule->name, NULL, NULL);
 		g_free (oldname);
 	}
@@ -869,7 +868,7 @@ context_rule_added (ERuleContext *ctx,
 
 	/* this always runs quickly */
 	/* FIXME Not passing a GCancellable or GError. */
-	folder = camel_store_get_folder (
+	folder = camel_store_get_folder_sync (
 		vfolder_store, rule->name, 0, NULL, NULL);
 	if (folder) {
 		g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder);
@@ -900,7 +899,8 @@ context_rule_removed (ERuleContext *ctx,
 	G_UNLOCK (vfolder);
 
 	/* FIXME Not passing a GCancellable  or GError. */
-	camel_store_delete_folder (vfolder_store, rule->name, NULL, NULL);
+	camel_store_delete_folder_sync (
+		vfolder_store, rule->name, NULL, NULL);
 	/* this must be unref'd after its deleted */
 	if (folder)
 		g_object_unref ((CamelFolder *) folder);
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index 26717d7..8fd2080 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -80,7 +80,7 @@ attachment_handler_get_component (EAttachment *attachment)
 	stream = camel_stream_mem_new ();
 	camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), buffer);
 	wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
-	camel_data_wrapper_decode_to_stream (wrapper, stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (wrapper, stream, NULL, NULL);
 	g_object_unref (stream);
 
 	component = e_cal_util_parse_ics_string ((gchar *) buffer->data);
diff --git a/modules/composer-autosave/e-autosave-utils.c b/modules/composer-autosave/e-autosave-utils.c
index ec0e322..8dc9285 100644
--- a/modules/composer-autosave/e-autosave-utils.c
+++ b/modules/composer-autosave/e-autosave-utils.c
@@ -140,8 +140,8 @@ load_snapshot_loaded_cb (GFile *snapshot_file,
 	 * and feeding the parser a direct file stream would block. */
 	message = camel_mime_message_new ();
 	camel_stream = camel_stream_mem_new_with_buffer (contents, length);
-	camel_data_wrapper_construct_from_stream (
-		CAMEL_DATA_WRAPPER (message), camel_stream, &error);
+	camel_data_wrapper_construct_from_stream_sync (
+		CAMEL_DATA_WRAPPER (message), camel_stream, NULL, &error);
 	g_object_unref (camel_stream);
 	g_free (contents);
 
@@ -161,7 +161,7 @@ load_snapshot_loaded_cb (GFile *snapshot_file,
 	 * the same file. */
 	shell = E_SHELL (object);
 	g_object_ref (snapshot_file);
-	composer = e_msg_composer_new_with_message (shell, message);
+	composer = e_msg_composer_new_with_message (shell, message, NULL);
 	g_object_set_data_full (
 		G_OBJECT (composer),
 		SNAPSHOT_FILE_KEY, snapshot_file,
@@ -228,7 +228,8 @@ save_snapshot_replace_cb (GFile *snapshot_file,
 
 	/* Extract a MIME message from the composer. */
 	composer = E_MSG_COMPOSER (object);
-	message = e_msg_composer_get_message_draft (composer, &error);
+	message = e_msg_composer_get_message_draft (
+		composer, context->cancellable, &error);
 
 	g_object_unref (object);
 
@@ -251,8 +252,8 @@ save_snapshot_replace_cb (GFile *snapshot_file,
 	camel_stream = camel_stream_mem_new ();
 	camel_stream_mem_set_byte_array (
 		CAMEL_STREAM_MEM (camel_stream), buffer);
-	camel_data_wrapper_decode_to_stream (
-		CAMEL_DATA_WRAPPER (message), camel_stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (
+		CAMEL_DATA_WRAPPER (message), camel_stream, NULL, NULL);
 	g_object_unref (camel_stream);
 	g_object_unref (message);
 
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c
index 99d16e9..55ffc80 100644
--- a/modules/mail/e-mail-attachment-handler.c
+++ b/modules/mail/e-mail-attachment-handler.c
@@ -193,13 +193,14 @@ mail_attachment_handler_message_rfc822 (EAttachmentView *view,
 	length = gtk_selection_data_get_length (selection_data);
 
 	stream = camel_stream_mem_new ();
-	camel_stream_write (stream, data, length, NULL);
+	camel_stream_write (stream, data, length, NULL, NULL);
 	camel_stream_reset (stream, NULL);
 
 	message = camel_mime_message_new ();
 	wrapper = CAMEL_DATA_WRAPPER (message);
 
-	if (camel_data_wrapper_construct_from_stream (wrapper, stream, NULL) == -1)
+	if (!camel_data_wrapper_construct_from_stream_sync (
+		wrapper, stream, NULL, NULL))
 		goto exit;
 
 	store = e_attachment_view_get_store (view);
@@ -296,7 +297,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
 	/* Handle one message. */
 	if (uids->len == 1) {
 		/* FIXME Not passing a GCancellable here. */
-		message = camel_folder_get_message (
+		message = camel_folder_get_message_sync (
 			folder, uids->pdata[0], NULL, &local_error);
 		if (message == NULL)
 			goto exit;
@@ -321,7 +322,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
 
 	for (ii = 0; ii < uids->len; ii++) {
 		/* FIXME Not passing a GCancellable here. */
-		message = camel_folder_get_message (
+		message = camel_folder_get_message_sync (
 			folder, uids->pdata[ii], NULL, &local_error);
 		if (message == NULL) {
 			g_object_unref (multipart);
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index f660344..b95153e 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -59,8 +59,6 @@ search_results_exec (SearchResultsMsg *msg)
 {
 	GList *copied_list;
 
-	camel_operation_register (msg->cancel);
-
 	copied_list = g_list_copy (msg->folder_list);
 	g_list_foreach (copied_list, (GFunc) g_object_ref, NULL);
 
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c
index 994e25b..3aebff9 100644
--- a/plugins/audio-inline/audio-inline.c
+++ b/plugins/audio-inline/audio-inline.c
@@ -210,8 +210,9 @@ org_gnome_audio_inline_play_clicked (GtkWidget *button, EMFormatHTMLPObject *pob
 
 		stream = camel_stream_fs_new_with_name (po->filename, O_RDWR | O_CREAT | O_TRUNC, 0600, NULL);
 		data = camel_medium_get_content (CAMEL_MEDIUM (po->part));
-		camel_data_wrapper_decode_to_stream (data, stream, NULL);
-		camel_stream_flush (stream, NULL);
+		camel_data_wrapper_decode_to_stream_sync (
+			data, stream, NULL, NULL);
+		camel_stream_flush (stream, NULL, NULL);
 		g_object_unref (stream);
 
 		d(printf ("audio inline formatter: init gst playbin\n"));
diff --git a/plugins/bogo-junk-plugin/bf-junk-filter.c b/plugins/bogo-junk-plugin/bf-junk-filter.c
index c335f6d..ddaf200 100644
--- a/plugins/bogo-junk-plugin/bf-junk-filter.c
+++ b/plugins/bogo-junk-plugin/bf-junk-filter.c
@@ -71,7 +71,12 @@ gpointer em_junk_bf_validate_binary (EPlugin *ep, EMJunkTarget *target);
 void em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target);
 void em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target);
 void em_junk_bf_commit_reports (EPlugin *ep, EMJunkTarget *target);
-static gint pipe_to_bogofilter (CamelMimeMessage *msg, const gchar **argv, GError **error);
+
+static gint
+pipe_to_bogofilter (CamelMimeMessage *msg,
+                    const gchar **argv,
+                    GCancellable *cancellable,
+                    GError **error);
 
 /* eplugin stuff */
 gint e_plugin_lib_enable (EPlugin *ep, gint enable);
@@ -97,7 +102,8 @@ init_db (void)
 	camel_mime_parser_scan_from (parser, FALSE);
 	g_object_unref (stream);
 
-	camel_mime_part_construct_from_parser ((CamelMimePart *) msg, parser, NULL);
+	camel_mime_part_construct_from_parser_sync (
+		(CamelMimePart *) msg, parser, NULL, NULL);
 	g_object_unref (parser);
 
 	d(fprintf (stderr, "Initing the bogofilter DB with Welcome message\n"));
@@ -106,13 +112,16 @@ init_db (void)
 		argv[2] = "--unicode=yes";
 	}
 
-	pipe_to_bogofilter (msg, argv, NULL);
+	pipe_to_bogofilter (msg, argv, NULL, NULL);
 	g_object_unref (msg);
 
 }
 
 static gint
-pipe_to_bogofilter (CamelMimeMessage *msg, const gchar **argv, GError **error)
+pipe_to_bogofilter (CamelMimeMessage *msg,
+                    const gchar **argv,
+                    GCancellable *cancellable,
+                    GError **error)
 {
 	GPid child_pid;
 	gint bf_in;
@@ -164,10 +173,10 @@ retry:
 	}
 
 	stream = camel_stream_fs_new_with_fd (bf_in);
-	camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (msg), stream, NULL);
-	camel_stream_flush (stream, NULL);
-	camel_stream_close (stream, NULL);
+	camel_data_wrapper_write_to_stream_sync (
+		CAMEL_DATA_WRAPPER (msg), stream, cancellable, NULL);
+	camel_stream_flush (stream, cancellable, NULL);
+	camel_stream_close (stream, cancellable, NULL);
 	g_object_unref (stream);
 
 #ifndef G_OS_WIN32
@@ -265,7 +274,7 @@ em_junk_bf_check_junk (EPlugin *ep, EMJunkTarget *target)
 		argv[1] = "--unicode=yes";
 	}
 
-	rv = pipe_to_bogofilter (msg, argv, &target->error);
+	rv = pipe_to_bogofilter (msg, argv, NULL, &target->error);
 
 	d(fprintf (stderr, "em_junk_bf_check_junk rv = %d\n", rv));
 
@@ -293,7 +302,7 @@ em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target)
 		argv[2] = "--unicode=yes";
 	}
 
-	pipe_to_bogofilter (msg, argv, &target->error);
+	pipe_to_bogofilter (msg, argv, NULL, &target->error);
 }
 
 void
@@ -317,7 +326,7 @@ em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target)
 		argv[2] = "--unicode=yes";
 	}
 
-	pipe_to_bogofilter (msg, argv, &target->error);
+	pipe_to_bogofilter (msg, argv, NULL, &target->error);
 }
 
 void
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index fd38257..72b4e04 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -104,7 +104,7 @@ typedef struct {
 	gchar *status_what;
 	gint status_pc;
 	gint status_timeout_id;
-	CamelOperation *status;
+	GCancellable *cancellable;
 
 	guint32 *indices;
 	guint32 index_count;
@@ -551,7 +551,7 @@ dbx_import_file (DbxImporter *m)
 	filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL);
 	m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */
 
-	camel_operation_start (NULL, _("Importing '%s'"), filename);
+	camel_operation_push_message (NULL, _("Importing '%s'"), filename);
 	folder = mail_tool_uri_to_folder (
 		m->parent_uri, CAMEL_STORE_FOLDER_CREATE,
 		m->base.cancellable, &m->base.error);
@@ -592,7 +592,7 @@ dbx_import_file (DbxImporter *m)
 		gboolean success;
 
 		camel_operation_progress (NULL, 100 * i / m->index_count);
-		camel_operation_progress (m->status, 100 * i / m->index_count);
+		camel_operation_progress (m->cancellable, 100 * i / m->index_count);
 
 		if (!dbx_read_email (m, m->indices[i], tmpfile, &dbx_flags)) {
 			d(printf("Cannot read email index %d at %x\n",
@@ -615,7 +615,8 @@ dbx_import_file (DbxImporter *m)
 		camel_mime_parser_init_with_fd (mp, tmpfile);
 
 		msg = camel_mime_message_new ();
-		if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) {
+		if (!camel_mime_part_construct_from_parser_sync (
+			(CamelMimePart *)msg, mp, NULL, NULL)) {
 			/* set exception? */
 			g_object_unref (msg);
 			g_object_unref (mp);
@@ -624,7 +625,7 @@ dbx_import_file (DbxImporter *m)
 
 		info = camel_message_info_new (NULL);
 		camel_message_info_set_flags (info, flags, ~0);
-		success = camel_folder_append_message (
+		success = camel_folder_append_message_sync (
 			folder, msg, info, NULL,
 			m->base.cancellable, &m->base.error);
 		camel_message_info_free (info);
@@ -641,7 +642,7 @@ dbx_import_file (DbxImporter *m)
 	if (m->indices)
 		g_free (m->indices);
 	/* FIXME Not passing GCancellable or GError here. */
-	camel_folder_sync (folder, FALSE, NULL, NULL);
+	camel_folder_synchronize_sync (folder, FALSE, NULL, NULL);
 	camel_folder_thaw (folder);
 	g_object_unref (folder);
 	if (missing && m->base.error == NULL) {
@@ -651,19 +652,13 @@ dbx_import_file (DbxImporter *m)
 			"bodies were not present in the DBX file",
 			m->index_count - missing, missing);
 	}
-	camel_operation_end (NULL);
+	camel_operation_pop_message (NULL);
 }
 
 static void
 dbx_import_import (DbxImporter *m)
 {
-	CamelOperation *oldcancel = NULL;
-
-	oldcancel = camel_operation_register (m->status);
-
 	dbx_import_file (m);
-
-	camel_operation_register (oldcancel);
 }
 
 static void
@@ -675,8 +670,6 @@ dbx_import_imported (DbxImporter *m)
 static void
 dbx_import_free (DbxImporter *m)
 {
-	g_object_unref (m->status);
-
 	g_free (m->status_what);
 	g_mutex_free (m->status_lock);
 
@@ -750,10 +743,10 @@ org_gnome_evolution_readdbx_import (EImport *ei, EImportTarget *target, EImportI
 	m->status_timeout_id = g_timeout_add (100, dbx_status_timeout, m);
 	/*m->status_timeout_id = NULL;*/
 	m->status_lock = g_mutex_new ();
-	m->status = camel_operation_new ();
+	m->cancellable = (GCancellable *) camel_operation_new ();
 
 	g_signal_connect (
-		m->status, "status",
+		m->cancellable, "status",
 		G_CALLBACK (dbx_status), m);
 
 	id = m->base.seq;
@@ -767,7 +760,7 @@ org_gnome_evolution_readdbx_cancel (EImport *ei, EImportTarget *target, EImportI
 	DbxImporter *m = g_datalist_get_data (&target->data, "dbx-msg");
 
 	if (m) {
-		camel_operation_cancel (m->status);
+		g_cancellable_cancel (m->cancellable);
 	}
 }
 
diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c
index b753653..92d5ae6 100644
--- a/plugins/groupwise-features/install-shared.c
+++ b/plugins/groupwise-features/install-shared.c
@@ -104,7 +104,8 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
 			if (e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, (gchar *)item_id, NULL) == E_GW_CONNECTION_STATUS_OK) {
 
 				/* FIXME Not passing a GCancellable or GError here. */
-				folder = camel_store_get_folder (store, "Mailbox", 0, NULL, NULL);
+				folder = camel_store_get_folder_sync (
+					store, "Mailbox", 0, NULL, NULL);
 				/*changes = camel_folder_change_info_new ();
 				camel_folder_change_info_remove_uid (changes, (gchar *) item_id);
 				camel_folder_summary_remove_uid (folder->summary, item_id);*/
@@ -210,8 +211,8 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target)
 
 		byte_array = g_byte_array_new ();
 		stream = camel_stream_mem_new_with_byte_array (byte_array);
-		camel_data_wrapper_write_to_stream (dw, stream, NULL);
-		camel_stream_write (stream, "", 1, NULL);
+		camel_data_wrapper_write_to_stream_sync (dw, stream, NULL, NULL);
+		camel_stream_write (stream, "", 1, NULL, NULL);
 
 		from_addr = camel_mime_message_get_from ((CamelMimeMessage *)target->message);
 		if (from_addr && camel_internet_address_get (from_addr, 0, &name, &email)) {
diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c
index 5a01a6c..beb1c94 100644
--- a/plugins/groupwise-features/proxy.c
+++ b/plugins/groupwise-features/proxy.c
@@ -664,7 +664,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
 		priv->builder_tab = gtk_builder_new ();
 		e_load_ui_builder_definition (priv->builder_tab, "proxy-listing.ui");
 
-		if (account->enabled && (store->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL)) {
+		if (account->enabled && camel_offline_store_get_online (store)) {
 			priv->tab_dialog = GTK_WIDGET (e_builder_get_widget (priv->builder_tab, "proxy_vbox"));
 			priv->tree = GTK_TREE_VIEW (e_builder_get_widget (priv->builder_tab, "proxy_access_list"));
 			priv->store =  gtk_tree_store_new (2,
diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c
index 9a345f1..e4d8dc3 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/share-folder-common.c
@@ -142,12 +142,12 @@ create_folder_exec (struct _EMCreateFolder *m)
 {
 	d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name));
 
-	if ((m->fi = camel_store_create_folder (
+	if ((m->fi = camel_store_create_folder_sync (
 		m->store, m->parent, m->name,
 		m->base.cancellable, &m->base.error))) {
 
 		if (camel_store_supports_subscriptions (m->store))
-			camel_store_subscribe_folder (
+			camel_store_subscribe_folder_sync (
 				m->store, m->full_name,
 				m->base.cancellable, &m->base.error);
 	}
diff --git a/plugins/groupwise-features/status-track.c b/plugins/groupwise-features/status-track.c
index 61c1ac2..f964c64 100644
--- a/plugins/groupwise-features/status-track.c
+++ b/plugins/groupwise-features/status-track.c
@@ -74,7 +74,7 @@ get_selected_message (EShellView *shell_view,
 		*selected_uid = g_strdup (g_ptr_array_index (uids, 0));
 
 		/* FIXME Not passing a GCancellable or GError here. */
-		msg = camel_folder_get_message (
+		msg = camel_folder_get_message_sync (
 			*folder, *selected_uid, NULL, NULL);
 	}
 
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index 41b4a89..994726d 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -361,7 +361,8 @@ org_gnome_image_inline_decode (ImageInlinePObject *image_object)
 	/* Stream takes ownership of the byte array. */
 	stream = camel_stream_mem_new_with_byte_array (array);
 	data_wrapper = camel_medium_get_content (medium);
-	camel_data_wrapper_decode_to_stream (data_wrapper, stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (
+		data_wrapper, stream, NULL, NULL);
 
 	/* Don't trust the content type in the MIME part.  It could
 	 * be lying or it could be "application/octet-stream".  Let
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 15fdf6f..db2b5d0 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2574,7 +2574,7 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target)
 
 	byte_array = g_byte_array_new ();
 	stream = camel_stream_mem_new_with_byte_array (byte_array);
-	camel_data_wrapper_decode_to_stream (content, stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (content, stream, NULL, NULL);
 
 	if (byte_array->len == 0)
 		puri->vcalendar = NULL;
@@ -2761,6 +2761,6 @@ itip_attachment_frame (EMFormat *emf,
 		emf, stream, info->puri.part,
 		info->handle, cancellable, FALSE);
 
-	camel_stream_close (stream, NULL);
+	camel_stream_close (stream, cancellable, NULL);
 }
 
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 88d9d09..38c49c8 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -203,7 +203,7 @@ set_description (ECalComponent *comp, CamelMimeMessage *message)
 
 	byte_array = g_byte_array_new ();
 	stream = camel_stream_mem_new_with_byte_array (byte_array);
-	camel_data_wrapper_decode_to_stream (content, stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (content, stream, NULL, NULL);
 	str = g_strndup ((gchar *) byte_array->data, byte_array->len);
 	g_object_unref (stream);
 
@@ -781,7 +781,7 @@ do_mail_to_event (AsyncData *data)
 
 			/* retrieve the message from the CamelFolder */
 			/* FIXME Not passing a GCancellable or GError. */
-			message = camel_folder_get_message (
+			message = camel_folder_get_message_sync (
 				folder, g_ptr_array_index (uids, i),
 				NULL, NULL);
 			if (!message) {
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 10d0eae..ffbbbcc 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -360,7 +360,7 @@ mar_all_sub_folders (CamelStore *store,
 				return FALSE;
 		}
 
-		folder = camel_store_get_folder (
+		folder = camel_store_get_folder_sync (
 			store, fi->full_name, 0, cancellable, error);
 		if (folder == NULL)
 			return FALSE;
@@ -392,7 +392,7 @@ mar_got_folder (gchar *folder_uri,
 	parent_store = camel_folder_get_parent_store (folder);
 
 	/* FIXME Not passing a GCancellable or GError here. */
-	folder_info = camel_store_get_folder_info (
+	folder_info = camel_store_get_folder_info_sync (
 		parent_store, full_name,
 		CAMEL_STORE_FOLDER_INFO_RECURSIVE |
 		CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index f82a217..9fce56d 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -175,7 +175,7 @@ org_gnome_prefer_plain_multipart_alternative (gpointer ep, EMFormatHookTarget *t
 		}
 		return;
 	} else if (!CAMEL_IS_MULTIPART (mp)) {
-		em_format_format_source (t->format, t->stream, t->part);
+		em_format_format_source (t->format, t->stream, t->part, NULL);
 		return;
 	}
 
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 7bd0138..e320445 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -115,11 +115,11 @@ struct _PstImporter {
 	gchar *status_what;
 	gint status_pc;
 	gint status_timeout_id;
-	CamelOperation *status;
+	GCancellable *status;
 
 	pst_file pst;
 
-	CamelOperation *cancel;
+	GCancellable *cancellable;
 	CamelFolder *folder;
 	gchar *parent_uri;
 	gchar *folder_name;
@@ -381,10 +381,6 @@ open_ecal (ECalSourceType type, const gchar *name)
 static void
 pst_import_import (PstImporter *m)
 {
-	CamelOperation *oldcancel = NULL;
-
-	oldcancel = camel_operation_register (m->status);
-
 	if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-addr"))) {
 		/* Hack - grab the first address book we can find
 		   TODO - add a selection mechanism in get_widget */
@@ -437,7 +433,6 @@ pst_import_import (PstImporter *m)
 		g_object_unref (m->journal);
 	}
 */
-	camel_operation_register (oldcancel);
 }
 
 static void
@@ -451,7 +446,7 @@ pst_import_file (PstImporter *m)
 	filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL);
 	m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */
 
-	camel_operation_start (NULL, _("Importing '%s'"), filename);
+	camel_operation_push_message (NULL, _("Importing '%s'"), filename);
 
 	if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) {
 		mail_tool_uri_to_folder (
@@ -463,7 +458,7 @@ pst_import_file (PstImporter *m)
 
 	if (ret < 0) {
 		g_free (filename);
-		camel_operation_end (NULL);
+		camel_operation_pop_message (NULL);
 		return;
 	}
 
@@ -488,7 +483,7 @@ pst_import_file (PstImporter *m)
 
 	camel_operation_progress (NULL, 4);
 
-	camel_operation_end (NULL);
+	camel_operation_pop_message (NULL);
 
 	pst_freeItem (item);
 
@@ -559,7 +554,8 @@ pst_process_item (PstImporter *m, pst_desc_tree *d_ptr)
 
 	if (item->folder != NULL) {
 		pst_process_folder (m, item);
-		camel_operation_start (NULL, _("Importing '%s'"), item->file_as.str);
+		camel_operation_push_message (
+			NULL, _("Importing '%s'"), item->file_as.str);
 	} else {
 		if (m->folder_count && (m->current_item < m->folder_count)) {
 			camel_operation_progress (NULL, (m->current_item * 100) / m->folder_count);
@@ -605,7 +601,7 @@ pst_process_item (PstImporter *m, pst_desc_tree *d_ptr)
 	pst_freeItem (item);
 
 	if (d_ptr->next == NULL) {
-		camel_operation_end (NULL);
+		camel_operation_pop_message (NULL);
 	}
 }
 
@@ -829,7 +825,7 @@ pst_process_email (PstImporter *m, pst_item *item)
 		/*g_message ("  Email headers... %s...", item->email->header);*/
 
 		stream = camel_stream_mem_new_with_buffer (item->email->header.str, strlen (item->email->header.str));
-		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream, NULL) == -1)
+		if (!camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *)msg, stream, NULL, NULL))
 			g_warning ("Error reading headers, skipped");
 
 	} else {
@@ -924,13 +920,13 @@ pst_process_email (PstImporter *m, pst_item *item)
 		camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT, ~0);
 
 	/* FIXME Not passing a GCancellable or GError here. */
-	success = camel_folder_append_message (
+	success = camel_folder_append_message_sync (
 		m->folder, msg, info, NULL, NULL, NULL);
 	camel_message_info_free (info);
 	g_object_unref (msg);
 
 	/* FIXME Not passing a GCancellable or GError here. */
-	camel_folder_sync (m->folder, FALSE, NULL, NULL);
+	camel_folder_synchronize_sync (m->folder, FALSE, NULL, NULL);
 	camel_folder_thaw (m->folder);
 
 	if (!success) {
@@ -1249,8 +1245,8 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta
 
 		content = camel_medium_get_content (CAMEL_MEDIUM (part));
 
-		if (camel_data_wrapper_decode_to_stream (content, stream, NULL) == -1
-			|| camel_stream_flush (stream, NULL) == -1)
+		if (camel_data_wrapper_decode_to_stream_sync (content, stream, NULL, NULL) == -1
+			|| camel_stream_flush (stream, NULL, NULL) == -1)
 		{
 			g_warning ("Could not write attachment to %s: %s", path, g_strerror (errno));
 			g_object_unref (stream);
@@ -1628,7 +1624,7 @@ pst_import (EImport *ei, EImportTarget *target)
 	m->status_timeout_id = g_timeout_add (100, pst_status_timeout, m);
 	/*m->status_timeout_id = NULL;*/
 	m->status_lock = g_mutex_new ();
-	m->status = camel_operation_new ();
+	m->status = (GCancellable *) camel_operation_new ();
 
 	g_signal_connect (
 		m->status, "status",
@@ -1662,7 +1658,7 @@ org_credativ_evolution_readpst_cancel (EImport *ei, EImportTarget *target, EImpo
 	PstImporter *m = g_datalist_get_data (&target->data, "pst-msg");
 
 	if (m) {
-		camel_operation_cancel (m->status);
+		g_cancellable_cancel (m->status);
 	}
 }
 
diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c
index 277350e..260fe93 100644
--- a/plugins/sa-junk-plugin/em-junk-filter.c
+++ b/plugins/sa-junk-plugin/em-junk-filter.c
@@ -98,7 +98,14 @@ gchar *em_junk_sa_spamc_gconf_binary = NULL;
 gchar *em_junk_sa_spamd_gconf_binary = NULL;
 
 static gint
-pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gint rv_err, gint wait_for_termination, GByteArray *output_buffer, GError **error)
+pipe_to_sa_full (CamelMimeMessage *msg,
+                 const gchar *in,
+                 const gchar **argv,
+                 gint rv_err,
+                 gint wait_for_termination,
+                 GByteArray *output_buffer,
+                 GCancellable *cancellable,
+                 GError **error)
 {
 	gint result, status, errnosav, fds[2], out_fds[2];
 	CamelStream *stream;
@@ -186,25 +193,27 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin
 	if (msg) {
 		stream = camel_stream_fs_new_with_fd (fds[1]);
 
-		camel_data_wrapper_write_to_stream (
-			CAMEL_DATA_WRAPPER (msg), stream, NULL);
-		camel_stream_flush (stream, NULL);
-		camel_stream_close (stream, NULL);
+		camel_data_wrapper_write_to_stream_sync (
+			CAMEL_DATA_WRAPPER (msg), stream, cancellable, NULL);
+		camel_stream_flush (stream, cancellable, NULL);
+		camel_stream_close (stream, cancellable, NULL);
 		g_object_unref (stream);
 	} else if (in) {
-		camel_write (fds[1], in, strlen (in), NULL);
+		camel_write (fds[1], in, strlen (in), cancellable, NULL);
 		close (fds[1]);
 	}
 
 	if (output_buffer) {
-		CamelStreamMem *memstream;
+		CamelStream *memstream;
 
 		stream = camel_stream_fs_new_with_fd (out_fds[0]);
 
-		memstream = (CamelStreamMem *) camel_stream_mem_new ();
-		camel_stream_mem_set_byte_array (memstream, output_buffer);
+		memstream = camel_stream_mem_new ();
+		camel_stream_mem_set_byte_array (
+			CAMEL_STREAM_MEM (memstream), output_buffer);
 
-		camel_stream_write_to_stream (stream, (CamelStream *) memstream, NULL);
+		camel_stream_write_to_stream (
+			stream, memstream, cancellable, NULL);
 		g_object_unref (stream);
 		g_byte_array_append (output_buffer, (guchar *)"", 1);
 
@@ -248,9 +257,13 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin
 }
 
 static gint
-pipe_to_sa (CamelMimeMessage *msg, const gchar *in, const gchar **argv, GError **error)
+pipe_to_sa (CamelMimeMessage *msg,
+            const gchar *in,
+            const gchar **argv,
+            GCancellable *cancellable,
+            GError **error)
 {
-	return pipe_to_sa_full (msg, in, argv, -1, 1, NULL, error);
+	return pipe_to_sa_full (msg, in, argv, -1, 1, NULL, cancellable, error);
 }
 
 static gchar *
@@ -283,7 +296,7 @@ em_junk_sa_test_spamd_running (const gchar *binary, gboolean system)
 
 	argv[i] = NULL;
 
-	rv = pipe_to_sa (NULL, "From test 127 0 0 1", argv, NULL) == 0;
+	rv = pipe_to_sa (NULL, "From test 127 0 0 1", argv, NULL, NULL) == 0;
 
 	d(fprintf (stderr, "result: %d (%s)\n", rv, rv ? "success" : "failed"));
 
@@ -307,7 +320,7 @@ em_junk_sa_test_allow_tell (void)
 		NULL
 	};
 
-	no_allow_tell = pipe_to_sa (NULL, "\n" , argv, NULL);
+	no_allow_tell = pipe_to_sa (NULL, "\n" , argv, NULL, NULL);
 	em_junk_sa_allow_tell_tested = TRUE;
 }
 
@@ -320,7 +333,7 @@ em_junk_sa_test_spamassassin (void)
 		NULL,
 	};
 
-	if (pipe_to_sa (NULL, NULL, argv, NULL) != 0)
+	if (pipe_to_sa (NULL, NULL, argv, NULL, NULL) != 0)
 		em_junk_sa_available = FALSE;
 	else
 		em_junk_sa_available = TRUE;
@@ -358,7 +371,7 @@ em_junk_sa_run_spamd (const gchar *binary)
 
 	d(fprintf (stderr, "trying to run %s with socket path %s\n", binary, em_junk_sa_get_socket_path ()));
 
-	if (!pipe_to_sa_full (NULL, NULL, argv, -1, 0, NULL, NULL)) {
+	if (!pipe_to_sa_full (NULL, NULL, argv, -1, 0, NULL, NULL, NULL)) {
 		struct timespec time_req;
 		struct stat stat_buf;
 
@@ -448,7 +461,7 @@ em_junk_sa_test_spamd (void)
 		   argv [i++] = "ps ax|grep -v grep|grep -E 'spamd.*(\\-L|\\-\\-local)'|grep -E -v '\\ \\-p\\ |\\ \\-\\-port\\ '";
 		   argv[i] = NULL;
 
-		   if (pipe_to_sa (NULL, NULL, argv, NULL) != 0) {
+		   if (pipe_to_sa (NULL, NULL, argv, NULL, NULL) != 0) {
 			   try_system_spamd = FALSE;
 			   d(fprintf (stderr, "there's no system spamd with -L/--local parameter running\n"));
 		   }
@@ -612,7 +625,7 @@ em_junk_sa_check_junk (EPlugin *ep, EMJunkTarget *target)
 
 	argv[i] = NULL;
 
-	rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, &target->error) != 0;
+	rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, NULL, &target->error) != 0;
 
 	if (!rv && out && out->data && !strcmp ((const gchar *)out->data, "0/0\n")) {
 		/* an error occurred */
@@ -624,7 +637,7 @@ em_junk_sa_check_junk (EPlugin *ep, EMJunkTarget *target)
 			argv[socket_i] = to_free = g_strdup (em_junk_sa_get_socket_path ());
 			G_UNLOCK (socket_path);
 
-			rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, &target->error) != 0;
+			rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, NULL, &target->error) != 0;
 		} else if (!em_junk_sa_use_spamc)
 			/* in case respawning were too fast we fallback to spamassassin */
 			rv = em_junk_sa_check_junk (ep, target);
@@ -655,7 +668,7 @@ get_spamassassin_version ()
 	if (!em_junk_sa_checked_spamassassin_version) {
 		out = g_byte_array_new ();
 
-		if (pipe_to_sa_full (NULL, NULL, argv, -1, 1, out, NULL) != 0) {
+		if (pipe_to_sa_full (NULL, NULL, argv, -1, 1, out, NULL, NULL) != 0) {
 			if (out)
 				g_byte_array_free (out, TRUE);
 			return em_junk_sa_spamassassin_version;
@@ -716,7 +729,7 @@ em_junk_sa_report_junk (EPlugin *ep, EMJunkTarget *target)
 		G_LOCK (report);
 		pipe_to_sa (msg, NULL,
 			    (no_allow_tell ? argv : argv2),
-			    &target->error);
+			    NULL, &target->error);
 		G_UNLOCK (report);
 	}
 }
@@ -756,7 +769,7 @@ em_junk_sa_report_non_junk (EPlugin *ep, EMJunkTarget *target)
 		G_LOCK (report);
 		pipe_to_sa (msg, NULL,
 			    (no_allow_tell ? argv : argv2),
-			    &target->error);
+			    NULL, &target->error);
 		G_UNLOCK (report);
 	}
 }
@@ -784,7 +797,7 @@ em_junk_sa_commit_reports (EPlugin *ep)
 			argv[2] = "--local";
 
 		G_LOCK (report);
-		pipe_to_sa (NULL, NULL, argv, NULL);
+		pipe_to_sa (NULL, NULL, argv, NULL, NULL);
 		G_UNLOCK (report);
 	}
 }
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 83dd985..7f62240 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -488,10 +488,11 @@ create_new_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *mes
 	/* make the exact copy of the template message, with all
 	   its attachments and message structure */
 	mem = camel_stream_mem_new ();
-	camel_data_wrapper_write_to_stream (
-		CAMEL_DATA_WRAPPER (template), mem, NULL);
+	camel_data_wrapper_write_to_stream_sync (
+		CAMEL_DATA_WRAPPER (template), mem, NULL, NULL);
 	camel_stream_reset (mem, NULL);
-	camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (new), mem, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		CAMEL_DATA_WRAPPER (new), mem, NULL, NULL);
 	g_object_unref (mem);
 
 	/* Add the headers from the message we are replying to, so CC and that
@@ -566,7 +567,7 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 		guint ii;
 
 		/* FIXME Not passing a GCancellable or GError here. */
-		folder = camel_store_get_folder (
+		folder = camel_store_get_folder_sync (
 			store, folder_info->full_name, 0, NULL, NULL);
 		folder_name = camel_folder_get_name (folder);
 
@@ -614,7 +615,7 @@ build_template_menus_recurse (GtkUIManager *ui_manager,
 				continue;
 
 			/* FIXME Not passing a GCancellable or GError here. */
-			template = camel_folder_get_message (
+			template = camel_folder_get_message_sync (
 				folder, uid, NULL, NULL);
 			g_object_ref (template);
 
@@ -679,7 +680,7 @@ action_template_cb (GtkAction *action,
 	/* Get the templates folder and all UIDs of the messages there. */
 	folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES);
 
-	msg = e_msg_composer_get_message_draft (composer, &error);
+	msg = e_msg_composer_get_message_draft (composer, NULL, &error);
 
 	/* Ignore cancellations. */
 	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -768,7 +769,7 @@ update_actions_cb (EShellView *shell_view)
 	full_name = camel_folder_get_full_name (templates_folder);
 
 	/* FIXME Not passing a GCancellable or GError here. */
-	folder_info = camel_store_get_folder_info (
+	folder_info = camel_store_get_folder_info_sync (
 		store, full_name,
 		CAMEL_STORE_FOLDER_INFO_RECURSIVE |
 		CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c
index 648c48a..9828b60 100644
--- a/plugins/tnef-attachments/tnef-plugin.c
+++ b/plugins/tnef-attachments/tnef-plugin.c
@@ -92,8 +92,8 @@ org_gnome_format_tnef (gpointer ep, EMFormatHookTarget *t)
 	content = camel_medium_get_content ((CamelMedium *)t->part);
 	if (content == NULL)
 		goto fail;
-	if (camel_data_wrapper_decode_to_stream (content, out, NULL) == -1
-	    || camel_stream_close (out, NULL) == -1) {
+	if (camel_data_wrapper_decode_to_stream_sync (content, out, NULL, NULL) == -1
+	    || camel_stream_close (out, NULL, NULL) == -1) {
 		g_object_unref (out);
 		goto fail;
 	}
@@ -138,7 +138,8 @@ org_gnome_format_tnef (gpointer ep, EMFormatHookTarget *t)
 
 		stream = camel_stream_fs_new_with_name (path, O_RDONLY, 0, NULL);
 		content = camel_data_wrapper_new ();
-		camel_data_wrapper_construct_from_stream (content, stream, NULL);
+		camel_data_wrapper_construct_from_stream_sync (
+			content, stream, NULL, NULL);
 		g_object_unref (stream);
 
 		part = camel_mime_part_new ();
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index bf27e64..5891344 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -105,7 +105,8 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object,
 	/* Stream takes ownership of the byte array. */
 	stream = camel_stream_mem_new_with_byte_array (array);
 	data_wrapper = camel_medium_get_content (medium);
-	camel_data_wrapper_decode_to_stream (data_wrapper, stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (
+		data_wrapper, stream, NULL, NULL);
 
 	/* because the result is not NULL-terminated */
 	g_byte_array_append (array, padding, 2);
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 468e164..0a3bfab 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -1055,8 +1055,8 @@ e_attachment_add_to_multipart (EAttachment *attachment,
 		camel_stream_filter_add (
 			CAMEL_STREAM_FILTER (filtered_stream),
 			CAMEL_MIME_FILTER (filter));
-		camel_data_wrapper_decode_to_stream (
-			wrapper, filtered_stream, NULL);
+		camel_data_wrapper_decode_to_stream_sync (
+			wrapper, filtered_stream, NULL, NULL);
 		g_object_unref (filtered_stream);
 		g_object_unref (stream);
 
@@ -1539,9 +1539,10 @@ attachment_load_finish (LoadContext *load_context)
 	size = g_memory_output_stream_get_data_size (output_stream);
 
 	stream = camel_stream_mem_new_with_buffer (data, size);
-	camel_data_wrapper_construct_from_stream (wrapper, stream, NULL);
+	camel_data_wrapper_construct_from_stream_sync (
+		wrapper, stream, NULL, NULL);
 	camel_data_wrapper_set_mime_type (wrapper, mime_type);
-	camel_stream_close (stream, NULL);
+	camel_stream_close (stream, NULL, NULL);
 	g_object_unref (stream);
 
 	mime_part = camel_mime_part_new ();
@@ -2477,7 +2478,7 @@ attachment_save_got_output_stream (SaveContext *save_context)
 	stream = camel_stream_mem_new ();
 	camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), buffer);
 	wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
-	camel_data_wrapper_decode_to_stream (wrapper, stream, NULL);
+	camel_data_wrapper_decode_to_stream_sync (wrapper, stream, NULL, NULL);
 	g_object_unref (stream);
 
 	/* Load the buffer into a GMemoryInputStream.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]