aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/dialogs/comp-editor.c2
-rw-r--r--composer/e-composer-autosave.c2
-rw-r--r--composer/e-composer-private.c2
-rw-r--r--composer/e-msg-composer.c74
-rw-r--r--e-util/e-signature-utils.c4
-rw-r--r--em-format/em-format-quote.c22
-rw-r--r--em-format/em-format.c125
-rw-r--r--mail/e-mail-local.c18
-rw-r--r--mail/e-mail-migrate.c43
-rw-r--r--mail/e-mail-reader.c21
-rw-r--r--mail/e-mail-store.c12
-rw-r--r--mail/em-composer-utils.c14
-rw-r--r--mail/em-composer-utils.h2
-rw-r--r--mail/em-folder-tree-model.c12
-rw-r--r--mail/em-folder-tree.c70
-rw-r--r--mail/em-folder-utils.c85
-rw-r--r--mail/em-format-html-display.c25
-rw-r--r--mail/em-format-html.c72
-rw-r--r--mail/em-html-stream.c30
-rw-r--r--mail/em-inline-filter.c4
-rw-r--r--mail/em-subscribe-editor.c25
-rw-r--r--mail/em-sync-stream.c65
-rw-r--r--mail/em-sync-stream.h9
-rw-r--r--mail/em-utils.c66
-rw-r--r--mail/em-utils.h2
-rw-r--r--mail/importers/elm-importer.c2
-rw-r--r--mail/importers/evolution-mbox-importer.c4
-rw-r--r--mail/importers/mail-importer.c16
-rw-r--r--mail/importers/mail-importer.h2
-rw-r--r--mail/importers/pine-importer.c2
-rw-r--r--mail/mail-folder-cache.c2
-rw-r--r--mail/mail-mt.c17
-rw-r--r--mail/mail-mt.h2
-rw-r--r--mail/mail-ops.c356
-rw-r--r--mail/mail-ops.h4
-rw-r--r--mail/mail-send-recv.c34
-rw-r--r--mail/mail-session.c84
-rw-r--r--mail/mail-tools.c62
-rw-r--r--mail/mail-tools.h8
-rw-r--r--mail/mail-vfolder.c19
-rw-r--r--mail/message-list.c39
-rw-r--r--modules/calendar/e-cal-attachment-handler.c2
-rw-r--r--modules/mail/e-mail-attachment-handler.c21
-rw-r--r--modules/mail/e-mail-shell-view.c14
-rw-r--r--plugins/audio-inline/audio-inline.c6
-rw-r--r--plugins/bogo-junk-plugin/bf-junk-filter.c13
-rw-r--r--plugins/dbx-import/dbx-importer.c124
-rw-r--r--plugins/groupwise-features/install-shared.c16
-rw-r--r--plugins/groupwise-features/proxy.c11
-rw-r--r--plugins/groupwise-features/share-folder-common.c28
-rw-r--r--plugins/image-inline/image-inline.c2
-rw-r--r--plugins/imap-features/imap-headers.c6
-rw-r--r--plugins/itip-formatter/itip-formatter.c4
-rw-r--r--plugins/mail-to-task/mail-to-task.c2
-rw-r--r--plugins/mark-all-read/mark-all-read.c29
-rw-r--r--plugins/pst-import/pst-importer.c22
-rw-r--r--plugins/sa-junk-plugin/em-junk-filter.c11
-rw-r--r--plugins/templates/templates.c7
-rw-r--r--plugins/tnef-attachments/tnef-plugin.c10
-rw-r--r--plugins/vcard-inline/vcard-inline.c2
-rw-r--r--po/POTFILES.in2
-rw-r--r--widgets/misc/e-account-combo-box.c5
-rw-r--r--widgets/misc/e-attachment.c8
63 files changed, 979 insertions, 825 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 5440d29c43..dcb8dde7b1 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -2972,7 +2972,7 @@ 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);
+ camel_data_wrapper_decode_to_stream (wrapper, stream, NULL);
buffer = g_memdup (byte_array->data, byte_array->len);
camel_mime_part_set_content_id (mime_part, NULL);
diff --git a/composer/e-composer-autosave.c b/composer/e-composer-autosave.c
index 470157cd9f..8863cf8d2a 100644
--- a/composer/e-composer-autosave.c
+++ b/composer/e-composer-autosave.c
@@ -417,7 +417,7 @@ autosave_snapshot_cb (GFile *file,
camel_stream_mem_set_byte_array (
CAMEL_STREAM_MEM (camel_stream), buffer);
camel_data_wrapper_decode_to_stream (
- CAMEL_DATA_WRAPPER (message), camel_stream);
+ CAMEL_DATA_WRAPPER (message), camel_stream, NULL);
g_object_unref (message);
g_object_unref (camel_stream);
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index df29267805..2e6dad64ac 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -110,7 +110,7 @@ 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);
+ camel_data_wrapper_decode_to_stream (wrapper, camel_stream, 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 fb147d2d78..998461a96a 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -159,7 +159,7 @@ emcu_part_to_html (CamelMimePart *part, gssize *len, EMFormat *source)
em_format_part((EMFormat *) emfq, (CamelStream *)mem, part);
g_object_unref(emfq);
- camel_stream_write((CamelStream *) mem, "", 1);
+ camel_stream_write((CamelStream *) mem, "", 1, NULL);
g_object_unref (mem);
text = (gchar *)buf->data;
@@ -618,7 +618,6 @@ build_message (EMsgComposer *composer,
CamelSession *session;
CamelStream *stream;
CamelMimePart *part;
- CamelException ex;
GByteArray *data;
EAccount *account;
gchar *charset;
@@ -627,6 +626,7 @@ build_message (EMsgComposer *composer,
gboolean smime_sign;
gboolean smime_encrypt;
gint i;
+ GError *local_error = NULL;
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
@@ -746,7 +746,7 @@ build_message (EMsgComposer *composer,
/* construct the content object */
plain = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (plain, stream);
+ camel_data_wrapper_construct_from_stream (plain, stream, NULL);
g_object_unref (stream);
if (plain_encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE) {
@@ -803,7 +803,7 @@ build_message (EMsgComposer *composer,
g_object_unref (mf);
}
- camel_data_wrapper_construct_from_stream (html, stream);
+ camel_data_wrapper_construct_from_stream (html, stream, NULL);
g_object_unref (stream);
camel_data_wrapper_set_mime_type (html, "text/html; charset=utf-8");
@@ -892,8 +892,6 @@ build_message (EMsgComposer *composer,
current = CAMEL_DATA_WRAPPER (multipart);
}
- camel_exception_init (&ex);
-
action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
pgp_sign = gtk_toggle_action_get_active (action);
@@ -961,10 +959,10 @@ build_message (EMsgComposer *composer,
camel_cipher_sign (
cipher, pgp_userid, account_hash_algo_to_camel_hash (
account ? e_account_get_string (account, E_ACCOUNT_PGP_HASH_ALGORITHM) : NULL),
- part, npart, &ex);
+ part, npart, &local_error);
g_object_unref (cipher);
- if (camel_exception_is_set (&ex)) {
+ if (local_error != NULL) {
g_object_unref (npart);
goto exception;
}
@@ -988,13 +986,13 @@ build_message (EMsgComposer *composer,
account->pgp_always_trust);
camel_cipher_encrypt (
cipher, pgp_userid, recipients,
- part, npart, &ex);
+ part, npart, &local_error);
g_object_unref (cipher);
if (account && account->pgp_encrypt_to_self && pgp_userid)
g_ptr_array_set_size (recipients, recipients->len - 1);
- if (camel_exception_is_set (&ex)) {
+ if (local_error != NULL) {
g_object_unref (npart);
goto exception;
}
@@ -1025,8 +1023,9 @@ build_message (EMsgComposer *composer,
if (smime_sign && (account == NULL ||
account->smime_sign_key == NULL ||
account->smime_sign_key[0] == 0)) {
- camel_exception_set (
- &ex, CAMEL_EXCEPTION_SYSTEM,
+ g_set_error (
+ &local_error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Cannot sign outgoing message: "
"No signing certificate set for "
"this account"));
@@ -1036,8 +1035,9 @@ build_message (EMsgComposer *composer,
if (smime_encrypt && (account == NULL ||
account->smime_sign_key == NULL ||
account->smime_sign_key[0] == 0)) {
- camel_exception_set (
- &ex, CAMEL_EXCEPTION_SYSTEM,
+ g_set_error (
+ &local_error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Cannot encrypt outgoing message: "
"No encryption certificate set for "
"this account"));
@@ -1070,10 +1070,10 @@ build_message (EMsgComposer *composer,
(account != NULL) ?
e_account_get_string (account,
E_ACCOUNT_SMIME_HASH_ALGORITHM) : NULL),
- part, npart, &ex);
+ part, npart, &local_error);
g_object_unref (cipher);
- if (camel_exception_is_set (&ex)) {
+ if (local_error != NULL) {
g_object_unref (npart);
goto exception;
}
@@ -1095,10 +1095,12 @@ build_message (EMsgComposer *composer,
(CamelSMIMEContext *) cipher, TRUE,
account->smime_encrypt_key);
- camel_cipher_encrypt (cipher, NULL, recipients, part, (CamelMimePart *)new, &ex);
+ camel_cipher_encrypt (
+ cipher, NULL, recipients, part,
+ (CamelMimePart *) new, &local_error);
g_object_unref (cipher);
- if (camel_exception_is_set (&ex))
+ if (local_error != NULL)
goto exception;
if (account->smime_encrypt_to_self)
@@ -1141,19 +1143,20 @@ skip_content:
return new;
- exception:
+exception:
if (part != CAMEL_MIME_PART (new))
g_object_unref (part);
g_object_unref (new);
- if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) {
- e_alert_run_dialog_for_args ((GtkWindow *)composer, "mail-composer:no-build-message",
- camel_exception_get_description (&ex), NULL);
- }
+ if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ e_alert_run_dialog_for_args (
+ (GtkWindow *) composer,
+ "mail-composer:no-build-message",
+ local_error->message, NULL);
- camel_exception_clear (&ex);
+ g_error_free (local_error);
if (recipients) {
for (i=0; i<recipients->len; i++)
@@ -1478,12 +1481,14 @@ autosave_load_draft (const gchar *filename)
g_return_val_if_fail (filename != NULL, NULL);
- if (!(stream = camel_stream_fs_new_with_name (filename, O_RDONLY, 0)))
+ stream = camel_stream_fs_new_with_name (
+ filename, O_RDONLY, 0, NULL);
+ if (stream == NULL)
return NULL;
msg = camel_mime_message_new ();
camel_data_wrapper_construct_from_stream (
- CAMEL_DATA_WRAPPER (msg), stream);
+ CAMEL_DATA_WRAPPER (msg), stream, NULL);
g_object_unref (stream);
composer = e_msg_composer_new_with_message (msg);
@@ -2602,7 +2607,6 @@ handle_multipart_encrypted (EMsgComposer *composer,
CamelDataWrapper *content;
CamelMimePart *mime_part;
CamelSession *session;
- CamelException ex;
CamelCipherValidity *valid;
GtkToggleAction *action = NULL;
const gchar *protocol;
@@ -2620,15 +2624,15 @@ handle_multipart_encrypted (EMsgComposer *composer,
if (action)
gtk_toggle_action_set_active (action, TRUE);
- camel_exception_init (&ex);
session = e_msg_composer_get_session (composer);
cipher = camel_gpg_context_new (session);
mime_part = camel_mime_part_new ();
- valid = camel_cipher_decrypt (cipher, multipart, mime_part, &ex);
+ valid = camel_cipher_decrypt (cipher, multipart, mime_part, NULL);
g_object_unref (cipher);
- camel_exception_clear (&ex);
+
if (valid == NULL)
return;
+
camel_cipher_validity_free (valid);
content_type = camel_mime_part_get_content_type (mime_part);
@@ -3687,12 +3691,13 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
if (!g_file_test (dec_file_name, G_FILE_TEST_IS_REGULAR))
return NULL;
- stream = camel_stream_fs_new_with_name (dec_file_name, O_RDONLY, 0);
+ stream = camel_stream_fs_new_with_name (
+ dec_file_name, O_RDONLY, 0, NULL);
if (!stream)
return NULL;
wrapper = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (wrapper, stream);
+ camel_data_wrapper_construct_from_stream (wrapper, stream, NULL);
g_object_unref (CAMEL_OBJECT (stream));
mime_type = e_util_guess_mime_type (dec_file_name, TRUE);
@@ -4166,13 +4171,14 @@ e_msg_composer_load_from_file (const gchar *filename)
g_return_val_if_fail (filename != NULL, NULL);
- stream = camel_stream_fs_new_with_name (filename, O_RDONLY, 0);
+ stream = camel_stream_fs_new_with_name (
+ filename, O_RDONLY, 0, NULL);
if (stream == NULL)
return NULL;
msg = camel_mime_message_new ();
camel_data_wrapper_construct_from_stream (
- CAMEL_DATA_WRAPPER (msg), stream);
+ CAMEL_DATA_WRAPPER (msg), stream, NULL);
g_object_unref (stream);
composer = e_msg_composer_new_with_message (msg);
diff --git a/e-util/e-signature-utils.c b/e-util/e-signature-utils.c
index 6a8258cb88..cf55c73864 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);
+ camel_stream_write_to_stream (input_stream, output_stream, NULL);
g_object_unref (output_stream);
g_object_unref (input_stream);
@@ -290,7 +290,7 @@ 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);
+ camel_stream_write_to_stream (input_stream, output_stream, 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 6ba72f4d29..aa666b22f1 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -155,7 +155,7 @@ emfq_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMim
EM_FORMAT_CLASS (parent_class)->format_clone (emf, folder, uid, msg, src);
gconf = gconf_client_get_default ();
- camel_stream_reset(emfq->stream);
+ camel_stream_reset(emfq->stream, NULL);
if (gconf_client_get_bool(gconf, "/apps/evolution/mail/composer/top_signature", NULL))
emfq_format_empty_line(emf, emfq->stream, (CamelMimePart *)msg, NULL);
g_object_unref (gconf);
@@ -166,7 +166,7 @@ emfq_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMim
if (handle)
handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle, FALSE);
- camel_stream_flush(emfq->stream);
+ camel_stream_flush(emfq->stream, NULL);
g_signal_emit_by_name(emf, "complete");
}
@@ -428,7 +428,7 @@ emfq_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con
em_format_part (emf, stream, part);
if (emfq->flags & EM_FORMAT_QUOTE_CITE)
- camel_stream_write_string(stream, "</blockquote><!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">-->");
+ camel_stream_write_string(stream, "</blockquote><!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">-->", NULL);
}
static void
@@ -456,16 +456,16 @@ emfq_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
gchar *text, *html;
camel_stream_write_string(stream,
- "<table border=1 cellspacing=0 cellpadding=0><tr><td><font size=-1>\n");
+ "<table border=1 cellspacing=0 cellpadding=0><tr><td><font size=-1>\n", NULL);
/* output some info about it */
text = em_format_describe_part(part, mime_type);
html = camel_text_to_html(text, ((EMFormatQuote *)emf)->text_html_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_write_string(stream, html);
+ camel_stream_write_string(stream, html, NULL);
g_free(html);
g_free(text);
- camel_stream_write_string(stream, "</font></td></tr></table>");
+ camel_stream_write_string(stream, "</font></td></tr></table>", NULL);
handle->handler(emf, stream, part, handle, FALSE);
}
@@ -508,7 +508,7 @@ emfq_text_plain(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, E
g_object_unref (html_filter);
em_format_format_text((EMFormat *)emfq, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
- camel_stream_flush((CamelStream *)filtered_stream);
+ camel_stream_flush((CamelStream *)filtered_stream, NULL);
g_object_unref (filtered_stream);
}
@@ -521,9 +521,9 @@ emfq_text_enriched(EMFormatQuote *emfq, 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");
+ camel_stream_write_string(stream, "\n<!-- text/richtext -->\n", NULL);
} else {
- camel_stream_write_string(stream, "\n<!-- text/enriched -->\n");
+ camel_stream_write_string(stream, "\n<!-- text/enriched -->\n", NULL);
}
enriched = camel_mime_filter_enriched_new(flags);
@@ -532,7 +532,7 @@ emfq_text_enriched(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part
CAMEL_STREAM_FILTER (filtered_stream), enriched);
g_object_unref (enriched);
- camel_stream_write_string(stream, "<br><hr><br>");
+ camel_stream_write_string(stream, "<br><hr><br>", NULL);
em_format_format_text((EMFormat *)emfq, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
g_object_unref (filtered_stream);
}
@@ -540,7 +540,7 @@ emfq_text_enriched(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part
static void
emfq_text_html(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
{
- camel_stream_write_string(stream, "\n<!-- text/html -->\n");
+ camel_stream_write_string(stream, "\n<!-- text/html -->\n", NULL);
em_format_format_text(emf, stream, (CamelDataWrapper *)part);
}
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 9c8e181642..64918df656 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1189,7 +1189,7 @@ em_format_format_content(EMFormat *emf, CamelStream *stream, CamelMimePart *part
if (camel_content_type_is (dw->mime_type, "text", "*"))
em_format_format_text(emf, stream, (CamelDataWrapper *)part);
else
- camel_data_wrapper_decode_to_stream(dw, stream);
+ camel_data_wrapper_decode_to_stream(dw, stream, NULL);
}
/**
@@ -1233,8 +1233,9 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
CAMEL_STREAM_FILTER (filter_stream),
CAMEL_MIME_FILTER (windows));
- camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filter_stream);
- camel_stream_flush((CamelStream *)filter_stream);
+ camel_data_wrapper_decode_to_stream (
+ dw, (CamelStream *)filter_stream, NULL);
+ camel_stream_flush((CamelStream *)filter_stream, NULL);
g_object_unref (filter_stream);
charset = camel_mime_filter_windows_real_charset (windows);
@@ -1262,14 +1263,18 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
}
g_object_unref (gconf);
- size = camel_data_wrapper_decode_to_stream(emf->mode == EM_FORMAT_SOURCE ? (CamelDataWrapper *)dw: camel_medium_get_content ((CamelMedium *)dw), (CamelStream *)filter_stream);
- camel_stream_flush((CamelStream *)filter_stream);
+ size = camel_data_wrapper_decode_to_stream (
+ emf->mode == EM_FORMAT_SOURCE ?
+ (CamelDataWrapper *) dw :
+ camel_medium_get_content ((CamelMedium *)dw),
+ (CamelStream *)filter_stream, NULL);
+ camel_stream_flush((CamelStream *)filter_stream, NULL);
g_object_unref (filter_stream);
- camel_stream_reset (mem_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);
- camel_stream_flush((CamelStream *)stream);
+ camel_stream_write_to_stream(mem_stream, (CamelStream *)stream, NULL);
+ camel_stream_flush((CamelStream *)stream, NULL);
} else {
((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->format_optional(emf, stream, (CamelMimePart *)dw, mem_stream);
}
@@ -1337,10 +1342,10 @@ emf_application_xpkcs7mime (EMFormat *emf,
gboolean is_fallback)
{
CamelCipherContext *context;
- CamelException *ex;
CamelMimePart *opart;
CamelCipherValidity *valid;
struct _EMFormatCache *emfc;
+ GError *local_error = NULL;
/* should this perhaps run off a key of ".secured" ? */
emfc = g_hash_table_lookup(emf->inline_table, emf->part_id->str);
@@ -1349,16 +1354,17 @@ emf_application_xpkcs7mime (EMFormat *emf,
return;
}
- ex = camel_exception_new();
-
context = camel_smime_context_new(emf->session);
emf->validity_found |= EM_FORMAT_VALIDITY_FOUND_ENCRYPTED | EM_FORMAT_VALIDITY_FOUND_SMIME;
opart = camel_mime_part_new();
- valid = camel_cipher_decrypt(context, part, opart, ex);
+ valid = camel_cipher_decrypt(context, part, opart, &local_error);
if (valid == NULL) {
- em_format_format_error(emf, stream, "%s", ex->desc?ex->desc:_("Could not parse S/MIME message: Unknown error"));
+ em_format_format_error (
+ emf, stream, "%s",
+ local_error->message ? local_error->message :
+ _("Could not parse S/MIME message: Unknown error"));
em_format_part_as(emf, stream, part, NULL);
} else {
if (emfc == NULL)
@@ -1373,7 +1379,6 @@ emf_application_xpkcs7mime (EMFormat *emf,
g_object_unref (opart);
g_object_unref (context);
- camel_exception_free(ex);
}
#endif
@@ -1496,12 +1501,12 @@ emf_multipart_encrypted (EMFormat *emf,
gboolean is_fallback)
{
CamelCipherContext *context;
- CamelException *ex;
const gchar *protocol;
CamelMimePart *opart;
CamelCipherValidity *valid;
CamelMultipartEncrypted *mpe;
struct _EMFormatCache *emfc;
+ GError *local_error = NULL;
/* should this perhaps run off a key of ".secured" ? */
emfc = g_hash_table_lookup(emf->inline_table, emf->part_id->str);
@@ -1527,14 +1532,17 @@ emf_multipart_encrypted (EMFormat *emf,
emf->validity_found |= EM_FORMAT_VALIDITY_FOUND_ENCRYPTED | EM_FORMAT_VALIDITY_FOUND_PGP;
- ex = camel_exception_new();
context = camel_gpg_context_new(emf->session);
opart = camel_mime_part_new();
- valid = camel_cipher_decrypt(context, part, opart, ex);
+ valid = camel_cipher_decrypt(context, part, opart, &local_error);
if (valid == NULL) {
- em_format_format_error(emf, stream, ex->desc?_("Could not parse PGP/MIME message"):_("Could not parse PGP/MIME message: Unknown error"));
- if (ex->desc)
- em_format_format_error(emf, stream, "%s", ex->desc);
+ em_format_format_error (
+ emf, stream, local_error->message ?
+ _("Could not parse PGP/MIME message") :
+ _("Could not parse PGP/MIME message: Unknown error"));
+ if (local_error->message != NULL)
+ em_format_format_error (
+ emf, stream, "%s", local_error->message);
em_format_part_as(emf, stream, part, "multipart/mixed");
} else {
if (emfc == NULL)
@@ -1550,14 +1558,13 @@ emf_multipart_encrypted (EMFormat *emf,
/* TODO: Make sure when we finalize this part, it is zero'd out */
g_object_unref (opart);
g_object_unref (context);
- camel_exception_free(ex);
}
static void
emf_write_related(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
{
em_format_format_content(emf, stream, puri->part);
- camel_stream_close(stream);
+ camel_stream_close(stream, NULL);
}
/* RFC 2387 */
@@ -1634,7 +1641,7 @@ emf_multipart_related (EMFormat *emf,
g_string_append_printf(emf->part_id, ".related.%d", displayid);
em_format_part(emf, stream, display_part);
g_string_truncate(emf->part_id, partidlen);
- camel_stream_flush(stream);
+ camel_stream_flush(stream, NULL);
link = g_queue_peek_head_link (emf->pending_uri_level->data);
@@ -1709,14 +1716,18 @@ emf_multipart_signed (EMFormat *emf,
em_format_format_error(emf, stream, _("Unsupported signature format"));
em_format_part_as(emf, stream, part, "multipart/mixed");
} else {
- CamelException *ex = camel_exception_new();
CamelCipherValidity *valid;
+ GError *local_error = NULL;
- valid = camel_cipher_verify(cipher, part, ex);
+ valid = camel_cipher_verify(cipher, part, &local_error);
if (valid == NULL) {
- em_format_format_error(emf, stream, ex->desc?_("Error verifying signature"):_("Unknown error verifying signature"));
- if (ex->desc)
- em_format_format_error(emf, stream, "%s", ex->desc);
+ em_format_format_error (
+ emf, stream, local_error->message ?
+ _("Error verifying signature") :
+ _("Unknown error verifying signature"));
+ if (local_error->message != NULL)
+ em_format_format_error (
+ emf, stream, "%s", local_error->message);
em_format_part_as(emf, stream, part, "multipart/mixed");
} else {
if (emfc == NULL)
@@ -1729,7 +1740,7 @@ emf_multipart_signed (EMFormat *emf,
em_format_format_secure(emf, stream, cpart, valid);
}
- camel_exception_free(ex);
+ g_error_free (local_error);
g_object_unref (cipher);
}
}
@@ -1769,10 +1780,11 @@ emf_application_mbox (EMFormat *emf,
mem_stream = camel_stream_mem_new ();
camel_data_wrapper_decode_to_stream (
- camel_medium_get_content (CAMEL_MEDIUM (mime_part)), mem_stream);
+ camel_medium_get_content (CAMEL_MEDIUM (mime_part)),
+ mem_stream, NULL);
camel_seekable_stream_seek (
- CAMEL_SEEKABLE_STREAM (mem_stream), 0, CAMEL_STREAM_SET);
- camel_mime_parser_init_with_stream (parser, mem_stream);
+ CAMEL_SEEKABLE_STREAM (mem_stream), 0, CAMEL_STREAM_SET, NULL);
+ camel_mime_parser_init_with_stream (parser, mem_stream, NULL);
g_object_unref (mem_stream);
/* Extract messages from the mbox. */
@@ -1783,7 +1795,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) == -1) {
+ if (camel_mime_part_construct_from_parser (mime_part, parser, NULL) == -1) {
g_object_unref (message);
break;
}
@@ -1849,8 +1861,8 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
CamelDataWrapper *dw;
CamelMimePart *opart;
CamelStream *ostream;
- CamelException *ex;
gchar *type;
+ GError *local_error = NULL;
if (!ipart) {
em_format_format_error(emf, stream, _("Unknown error verifying signature"));
@@ -1859,17 +1871,20 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
emf->validity_found |= EM_FORMAT_VALIDITY_FOUND_SIGNED | EM_FORMAT_VALIDITY_FOUND_PGP;
- ex = camel_exception_new();
cipher = camel_gpg_context_new(emf->session);
/* Verify the signature of the message */
- valid = camel_cipher_verify(cipher, ipart, ex);
+ valid = camel_cipher_verify(cipher, ipart, &local_error);
if (!valid) {
- em_format_format_error(emf, stream, ex->desc?_("Error verifying signature"):_("Unknown error verifying signature"));
- if (ex->desc)
- em_format_format_error(emf, stream, "%s", ex->desc);
+ em_format_format_error (
+ emf, stream, local_error->message ?
+ _("Error verifying signature") :
+ _("Unknown error verifying signature"));
+ if (local_error->message)
+ em_format_format_error (
+ emf, stream, "%s", local_error->message);
em_format_format_source(emf, stream, ipart);
/* I think this will loop: em_format_part_as(emf, stream, part, "text/plain"); */
- camel_exception_free(ex);
+ g_error_free (local_error);
g_object_unref (cipher);
return;
}
@@ -1887,8 +1902,9 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
/* 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);
- camel_stream_flush((CamelStream *)filtered_stream);
+ camel_data_wrapper_decode_to_stream (
+ dw, (CamelStream *)filtered_stream, NULL);
+ camel_stream_flush((CamelStream *)filtered_stream, NULL);
g_object_unref (filtered_stream);
/* Create a new text/plain MIME part containing the signed content preserving the original part's Content-Type params */
@@ -1905,7 +1921,7 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
camel_content_type_unref (content_type);
dw = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (dw, ostream);
+ camel_data_wrapper_construct_from_stream (dw, ostream, NULL);
camel_data_wrapper_set_mime_type (dw, type);
g_free (type);
@@ -1922,7 +1938,6 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
g_object_unref (opart);
g_object_unref (ostream);
g_object_unref (cipher);
- camel_exception_free(ex);
}
static void
@@ -1930,25 +1945,30 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
{
CamelCipherContext *cipher;
CamelCipherValidity *valid;
- CamelException *ex;
CamelMimePart *opart;
CamelDataWrapper *dw;
gchar *mime_type;
+ GError *local_error = NULL;
emf->validity_found |= EM_FORMAT_VALIDITY_FOUND_ENCRYPTED | EM_FORMAT_VALIDITY_FOUND_PGP;
cipher = camel_gpg_context_new(emf->session);
- ex = camel_exception_new();
opart = camel_mime_part_new();
/* Decrypt the message */
- valid = camel_cipher_decrypt (cipher, ipart, opart, ex);
+ valid = camel_cipher_decrypt (cipher, ipart, opart, &local_error);
if (!valid) {
- em_format_format_error(emf, stream, ex->desc?_("Could not parse PGP message"):_("Could not parse PGP message: Unknown error"));
- if (ex->desc)
- em_format_format_error(emf, stream, "%s", ex->desc);
+ em_format_format_error (
+ emf, stream, _("Could not parse PGP message: "));
+ if (local_error->message != NULL)
+ em_format_format_error (
+ emf, stream, "%s", local_error->message);
+ else
+ em_format_format_error (
+ emf, stream, _("Unknown error"));
em_format_format_source(emf, stream, ipart);
/* I think this will loop: em_format_part_as(emf, stream, part, "text/plain"); */
- camel_exception_free(ex);
+
+ g_error_free (local_error);
g_object_unref (cipher);
g_object_unref (opart);
return;
@@ -1974,7 +1994,6 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
/* Clean Up */
g_object_unref (opart);
g_object_unref (cipher);
- camel_exception_free (ex);
}
static EMFormatHandler type_builtin_table[] = {
@@ -2043,7 +2062,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) > 0) {
+ if (camel_data_wrapper_decode_to_stream (dw, stream, NULL) > 0) {
gchar *content_type;
content_type = g_content_type_guess (
diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c
index 002865cd33..7b825c4240 100644
--- a/mail/e-mail-local.c
+++ b/mail/e-mail-local.c
@@ -48,17 +48,15 @@ void
e_mail_local_init (const gchar *data_dir)
{
static gboolean initialized = FALSE;
- CamelException ex;
CamelService *service;
CamelURL *url;
gchar *temp;
gint ii;
+ GError *local_error = NULL;
g_return_if_fail (!initialized);
g_return_if_fail (data_dir != NULL);
- camel_exception_init (&ex);
-
url = camel_url_new ("mbox:", NULL);
temp = g_build_filename (data_dir, "local", NULL);
camel_url_set_path (url, temp);
@@ -66,10 +64,10 @@ e_mail_local_init (const gchar *data_dir)
temp = camel_url_to_string (url, 0);
service = camel_session_get_service (
- session, temp, CAMEL_PROVIDER_STORE, &ex);
+ session, temp, CAMEL_PROVIDER_STORE, &local_error);
g_free (temp);
- if (camel_exception_is_set (&ex))
+ if (local_error != NULL)
goto fail;
/* Populate the rest of the default_local_folders array. */
@@ -86,9 +84,7 @@ e_mail_local_init (const gchar *data_dir)
default_local_folders[ii].folder_uri = folder_uri;
default_local_folders[ii].folder = camel_store_get_folder (
CAMEL_STORE (service), display_name,
- CAMEL_STORE_FOLDER_CREATE, &ex);
-
- camel_exception_clear (&ex);
+ CAMEL_STORE_FOLDER_CREATE, NULL);
}
camel_url_free (url);
@@ -99,9 +95,11 @@ e_mail_local_init (const gchar *data_dir)
return;
fail:
- g_warning ("Could not initialize local store/folder: %s", ex.desc);
+ g_warning (
+ "Could not initialize local store/folder: %s",
+ local_error->message);
- camel_exception_clear (&ex);
+ g_error_free (local_error);
camel_url_free (url);
}
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index 7f59d16a48..202bbaaca5 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -533,7 +533,13 @@ update_states_in_main_thread (const struct _migrate_state_info * info)
}
static void
-migrate_folders(CamelStore *store, gboolean is_local, CamelFolderInfo *fi, const gchar *acc, CamelException *ex, gboolean *done, gint *nth_folder, gint total_folders)
+migrate_folders (CamelStore *store,
+ gboolean is_local,
+ CamelFolderInfo *fi,
+ const gchar *acc,
+ gboolean *done,
+ gint *nth_folder,
+ gint total_folders)
{
CamelFolder *folder;
@@ -550,13 +556,13 @@ migrate_folders(CamelStore *store, gboolean is_local, CamelFolderInfo *fi, const
g_idle_add ((GSourceFunc) update_states_in_main_thread, info);
if (is_local)
- folder = camel_store_get_folder (store, fi->full_name, CAMEL_STORE_IS_MIGRATING, ex);
+ folder = camel_store_get_folder (store, fi->full_name, CAMEL_STORE_IS_MIGRATING, NULL);
else
- folder = camel_store_get_folder (store, fi->full_name, 0, ex);
+ folder = camel_store_get_folder (store, fi->full_name, 0, NULL);
if (folder != NULL)
camel_folder_summary_migrate_infos (folder->summary);
- migrate_folders(store, is_local, fi->child, acc, ex, done, nth_folder, total_folders);
+ migrate_folders(store, is_local, fi->child, acc, done, nth_folder, total_folders);
fi = fi->next;
}
@@ -601,12 +607,11 @@ setup_local_store (EShellBackend *shell_backend,
#ifndef G_OS_WIN32
struct migrate_folders_to_db_structure {
- gchar *account_name;
- CamelException ex;
- CamelStore *store;
- CamelFolderInfo *info;
- gboolean done;
- gboolean is_local_store;
+ gchar *account_name;
+ CamelStore *store;
+ CamelFolderInfo *info;
+ gboolean done;
+ gboolean is_local_store;
};
static void
@@ -614,9 +619,10 @@ migrate_folders_to_db_thread (struct migrate_folders_to_db_structure *migrate_db
{
gint num_of_folders = 0, nth_folder = 0;
count_folders (migrate_dbs->info, &num_of_folders);
- migrate_folders (migrate_dbs->store, migrate_dbs->is_local_store, migrate_dbs->info,
- migrate_dbs->account_name, &(migrate_dbs->ex), &(migrate_dbs->done),
- &nth_folder, num_of_folders);
+ migrate_folders (
+ migrate_dbs->store, migrate_dbs->is_local_store,
+ migrate_dbs->info, migrate_dbs->account_name,
+ &(migrate_dbs->done), &nth_folder, num_of_folders);
}
static void
@@ -655,7 +661,6 @@ migrate_to_db (EShellBackend *shell_backend)
migrate_dbs.is_local_store = TRUE;
else
migrate_dbs.is_local_store = FALSE;
- camel_exception_init (&migrate_dbs.ex);
migrate_dbs.account_name = _("On This Computer");
migrate_dbs.info = info;
migrate_dbs.store = store;
@@ -681,17 +686,13 @@ migrate_to_db (EShellBackend *shell_backend)
&& service->url[0]
&& strncmp(service->url, "mbox:", 5) != 0) {
- CamelException ex;
-
- camel_exception_init (&ex);
e_mail_store_add_by_uri (service->url, name);
- store = (CamelStore *) camel_session_get_service (CAMEL_SESSION (session), service->url, CAMEL_PROVIDER_STORE, &ex);
- info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &ex);
+ store = (CamelStore *) camel_session_get_service (CAMEL_SESSION (session), service->url, CAMEL_PROVIDER_STORE, NULL);
+ info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL);
if (info) {
struct migrate_folders_to_db_structure migrate_dbs;
- migrate_dbs.ex = ex;
migrate_dbs.account_name = account->name;
migrate_dbs.info = info;
migrate_dbs.store = store;
@@ -702,8 +703,6 @@ migrate_to_db (EShellBackend *shell_backend)
g_main_context_iteration (NULL, TRUE);
} else
printf("%s:%s: failed to get folder infos \n", G_STRLOC, G_STRFUNC);
- camel_exception_clear(&ex);
-
}
i++;
e_iterator_next (iter);
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index abfbf3b0ab..795dfcd40f 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -1789,7 +1789,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
const gchar *message_uid,
CamelMimeMessage *message,
gpointer user_data,
- CamelException *ex)
+ GError **error)
{
EMailReader *reader = user_data;
EMailReaderPrivate *priv;
@@ -1874,24 +1874,19 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
timeout_interval, (GSourceFunc)
mail_reader_message_read_cb, reader);
- } else if (camel_exception_is_set (ex)) {
+ } else if (error != NULL && *error != NULL) {
gchar *string;
- if (ex->id != CAMEL_EXCEPTION_OPERATION_IN_PROGRESS) {
- /* Display the error inline and clear the exception. */
- string = g_strdup_printf (
- "<h2>%s</h2><p>%s</p>",
- _("Unable to retrieve message"),
- ex->desc);
- } else {
- string = g_strdup_printf (
- _("Retrieving message '%s'"), cursor_uid);
- }
+ /* Display the error inline and clear the exception. */
+ string = g_strdup_printf (
+ "<h2>%s</h2><p>%s</p>",
+ _("Unable to retrieve message"),
+ (*error)->message);
e_web_view_load_string (web_view, string);
g_free (string);
- camel_exception_clear (ex);
+ g_clear_error (error);
}
/* We referenced this in the call to mail_get_messagex(). */
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index 3418404e06..6fd0c7ea82 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -303,17 +303,15 @@ e_mail_store_add_by_uri (const gchar *uri,
{
CamelService *service;
CamelProvider *provider;
- CamelException ex;
+ GError *local_error = NULL;
g_return_val_if_fail (uri != NULL, NULL);
g_return_val_if_fail (display_name != NULL, NULL);
- camel_exception_init (&ex);
-
/* Load the service, but don't connect. Check its provider,
* and if this belongs in the folder tree model, add it. */
- provider = camel_provider_get (uri, &ex);
+ provider = camel_provider_get (uri, &local_error);
if (provider == NULL)
goto fail;
@@ -321,7 +319,7 @@ e_mail_store_add_by_uri (const gchar *uri,
return NULL;
service = camel_session_get_service (
- session, uri, CAMEL_PROVIDER_STORE, &ex);
+ session, uri, CAMEL_PROVIDER_STORE, &local_error);
if (service == NULL)
goto fail;
@@ -335,8 +333,8 @@ fail:
/* FIXME: Show an error dialog. */
g_warning (
"Couldn't get service: %s: %s", uri,
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
+ local_error->message);
+ g_error_free (local_error);
return NULL;
}
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 4a41217f3d..9cc0001de9 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -913,15 +913,15 @@ 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);
+ camel_data_wrapper_decode_to_stream (content, stream, NULL);
str = g_strndup ((gchar *) byte_array->data, byte_array->len);
g_object_unref (stream);
if (replace_variables (clues, message, &str)) {
stream = camel_stream_mem_new_with_buffer (str, strlen (str));
- camel_stream_reset (stream);
- camel_data_wrapper_construct_from_stream (content, stream);
+ camel_stream_reset (stream, NULL);
+ camel_data_wrapper_construct_from_stream (content, stream, NULL);
g_object_unref (stream);
}
@@ -1417,13 +1417,13 @@ em_utils_redirect_message_by_uid (CamelFolder *folder, const gchar *uid)
}
static void
-emu_handle_receipt_message(CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, CamelException *ex)
+emu_handle_receipt_message(CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, GError **error)
{
if (msg)
em_utils_handle_receipt(folder, uid, msg);
/* we dont care really if we can't get the message */
- camel_exception_clear(ex);
+ g_clear_error (error);
}
/* Message disposition notifications, rfc 2298 */
@@ -1541,7 +1541,7 @@ 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);
+ camel_data_wrapper_construct_from_stream (receipt_text, stream, NULL);
g_object_unref (stream);
part = camel_mime_part_new ();
@@ -1569,7 +1569,7 @@ 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);
+ camel_data_wrapper_construct_from_stream (receipt_data, stream, NULL);
g_object_unref (stream);
g_free (ua);
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index 1eb0d1bd30..1a8c48038b 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -47,7 +47,7 @@ void em_utils_forward_messages (CamelFolder *folder, GPtrArray *uids, const gcha
void em_utils_redirect_message (CamelMimeMessage *message);
void em_utils_redirect_message_by_uid (CamelFolder *folder, const gchar *uid);
-void em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, const gchar *address, CamelException *ex);
+void em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, const gchar *address, GError **error);
void em_utils_handle_receipt (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg);
void em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message);
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 37552bb555..f91bc852b5 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -206,7 +206,6 @@ account_changed_cb (EAccountList *accounts,
EMFolderTreeModelStoreInfo *si;
CamelProvider *provider;
CamelStore *store;
- CamelException ex;
gchar *uri;
si = g_hash_table_lookup (model->priv->account_index, account);
@@ -219,22 +218,17 @@ account_changed_cb (EAccountList *accounts,
if (!account->enabled ||!(uri = account->source->url))
return;
- camel_exception_init (&ex);
- if (!(provider = camel_provider_get(uri, &ex))) {
- camel_exception_clear (&ex);
+ if (!(provider = camel_provider_get(uri, NULL)))
return;
- }
/* make sure the new store belongs in the tree */
if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
return;
store = (CamelStore *) camel_session_get_service (
- session, uri, CAMEL_PROVIDER_STORE, &ex);
- if (store == NULL) {
- camel_exception_clear (&ex);
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return;
- }
em_folder_tree_model_add_store (model, store, account->name);
g_object_unref (store);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index e0bace6fae..e9c39d5a0c 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -191,7 +191,8 @@ 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->store, m->top, flags, &m->base.ex);
+ m->fi = camel_store_get_folder_info (
+ m->store, m->top, flags, &m->base.error);
}
static void
@@ -226,7 +227,7 @@ folder_tree_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
gtk_tree_model_get_iter (model, &root, path);
/* if we had an error, then we need to re-set the load subdirs state and collapse the node */
- if (!m->fi && camel_exception_is_set(&m->base.ex)) {
+ if (!m->fi && m->base.error != NULL) {
gtk_tree_store_set(
GTK_TREE_STORE (model), &root,
COL_BOOL_LOAD_SUBDIRS, TRUE, -1);
@@ -440,11 +441,9 @@ folder_tree_expand_node (const gchar *key,
model = gtk_tree_view_get_model (tree_view);
if ((account = e_get_account_by_uid (uid)) && account->enabled) {
- CamelException ex;
-
- camel_exception_init (&ex);
- store = (CamelStore *) camel_session_get_service (session, account->source->url, CAMEL_PROVIDER_STORE, &ex);
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, account->source->url,
+ CAMEL_PROVIDER_STORE, NULL);
if (store == NULL)
return;
@@ -552,7 +551,6 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree,
const gchar *new_name)
{
CamelFolderInfo *folder_info;
- CamelException ex;
CamelStore *store;
GtkTreeView *tree_view;
GtkTreeModel *model;
@@ -564,13 +562,12 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree,
gchar **strv;
gpointer parent;
guint index;
+ GError *local_error = NULL;
/* XXX Consider splitting this into separate async functions:
* em_folder_tree_rename_folder_async()
* em_folder_tree_rename_folder_finish() */
- camel_exception_init (&ex);
-
parent = gtk_widget_get_toplevel (GTK_WIDGET (folder_tree));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
@@ -608,7 +605,7 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree,
/* Check for duplicate folder name. */
folder_info = camel_store_get_folder_info (
- store, new_full_name, CAMEL_STORE_FOLDER_INFO_FAST, &ex);
+ store, new_full_name, CAMEL_STORE_FOLDER_INFO_FAST, NULL);
if (folder_info != NULL) {
e_alert_run_dialog_for_args (
parent, "mail:no-rename-folder-exists",
@@ -618,16 +615,17 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree,
}
/* XXX This needs to be asynchronous. */
- camel_store_rename_folder (store, old_full_name, new_full_name, &ex);
- if (camel_exception_is_set (&ex)) {
+ if (!camel_store_rename_folder (
+ store, old_full_name, new_full_name, &local_error)) {
e_alert_run_dialog_for_args (
parent, "mail:no-rename-folder",
- old_full_name, new_full_name, ex.desc, NULL);
+ old_full_name, new_full_name,
+ local_error->message, NULL);
+ g_clear_error (&local_error);
goto exit;
}
exit:
- camel_exception_clear (&ex);
g_free (old_name);
g_free (old_full_name);
@@ -1471,7 +1469,6 @@ tree_drag_data_delete (GtkWidget *widget,
GtkTreePath *src_path;
gboolean is_store;
CamelStore *store;
- CamelException ex;
GtkTreeIter iter;
if (!priv->drag_row || (src_path = gtk_tree_row_reference_get_path (priv->drag_row)))
@@ -1491,10 +1488,8 @@ tree_drag_data_delete (GtkWidget *widget,
if (is_store)
goto fail;
- camel_exception_init(&ex);
- camel_store_delete_folder(store, full_name, &ex);
- if (camel_exception_is_set(&ex))
- camel_exception_clear(&ex);
+ camel_store_delete_folder(store, full_name, NULL);
+
fail:
gtk_tree_path_free(src_path);
g_free (full_name);
@@ -1514,7 +1509,6 @@ tree_drag_data_get (GtkWidget *widget,
GtkTreePath *src_path;
CamelFolder *folder;
CamelStore *store;
- CamelException ex;
GtkTreeIter iter;
if (!priv->drag_row || !(src_path = gtk_tree_row_reference_get_path(priv->drag_row)))
@@ -1535,8 +1529,6 @@ tree_drag_data_get (GtkWidget *widget,
if (full_name == NULL)
goto fail;
- camel_exception_init(&ex);
-
switch (info) {
case DND_DRAG_TYPE_FOLDER:
/* dragging to a new location in the folder tree */
@@ -1544,7 +1536,7 @@ tree_drag_data_get (GtkWidget *widget,
break;
case DND_DRAG_TYPE_TEXT_URI_LIST:
/* dragging to nautilus or something, probably */
- if ((folder = camel_store_get_folder(store, full_name, 0, &ex))) {
+ if ((folder = camel_store_get_folder(store, full_name, 0, NULL))) {
GPtrArray *uids = camel_folder_get_uids(folder);
em_utils_selection_set_urilist(selection, folder, uids);
@@ -1556,8 +1548,6 @@ tree_drag_data_get (GtkWidget *widget,
abort();
}
- if (camel_exception_is_set(&ex))
- camel_exception_clear(&ex);
fail:
gtk_tree_path_free(src_path);
g_free (full_name);
@@ -1597,7 +1587,7 @@ folder_tree_drop_folder(struct _DragDataReceivedAsync *m)
d(printf(" * Drop folder '%s' onto '%s'\n", data, m->full_name));
- if (!(folder = mail_tool_uri_to_folder((gchar *)data, 0, &m->base.ex)))
+ if (!(folder = mail_tool_uri_to_folder((gchar *)data, 0, &m->base.error)))
return;
full_name = camel_folder_get_full_name (folder);
@@ -1648,14 +1638,15 @@ folder_tree_drop_async__exec (struct _DragDataReceivedAsync *m)
/* copy or move (aka rename) a folder */
folder_tree_drop_folder(m);
} else if (m->full_name == NULL) {
- camel_exception_set (&m->base.ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot drop message(s) into toplevel store"));
- } else if ((folder = camel_store_get_folder (m->store, m->full_name, 0, &m->base.ex))) {
+ 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 (m->store, m->full_name, 0, &m->base.error))) {
switch (m->info) {
case DND_DROP_TYPE_UID_LIST:
/* import a list of uids from another evo folder */
- em_utils_selection_get_uidlist(m->selection, folder, m->move, &m->base.ex);
- m->moved = m->move && !camel_exception_is_set(&m->base.ex);
+ em_utils_selection_get_uidlist(m->selection, folder, m->move, &m->base.error);
+ m->moved = m->move && (m->base.error == NULL);
break;
case DND_DROP_TYPE_MESSAGE_RFC822:
/* import a message/rfc822 stream */
@@ -2348,11 +2339,9 @@ em_folder_tree_set_selected_list (EMFolderTree *folder_tree, GList *list, gboole
for (;list;list = list->next) {
struct _selected_uri *u = g_malloc0(sizeof(*u));
CamelURL *url;
- CamelException ex = { 0 };
u->uri = g_strdup(list->data);
- u->store = (CamelStore *)camel_session_get_service (session, u->uri, CAMEL_PROVIDER_STORE, &ex);
- camel_exception_clear(&ex);
+ u->store = (CamelStore *)camel_session_get_service (session, u->uri, CAMEL_PROVIDER_STORE, NULL);
url = camel_url_new(u->uri, NULL);
if (u->store == NULL || url == NULL) {
@@ -2704,14 +2693,11 @@ em_folder_tree_get_selected_folder (EMFolderTree *folder_tree)
GtkTreeModel *model;
GtkTreeIter iter;
gchar *full_name = NULL;
- CamelException ex;
CamelStore *store = NULL;
CamelFolder *folder = NULL;
g_return_val_if_fail (EM_IS_FOLDER_TREE (folder_tree), NULL);
- camel_exception_init (&ex);
-
tree_view = GTK_TREE_VIEW (folder_tree);
selection = gtk_tree_view_get_selection (tree_view);
@@ -2720,9 +2706,8 @@ em_folder_tree_get_selected_folder (EMFolderTree *folder_tree)
COL_STRING_FULL_NAME, &full_name, -1);
if (store && full_name)
- folder = camel_store_get_folder (store, full_name, CAMEL_STORE_FOLDER_INFO_FAST, &ex);
-
- camel_exception_clear (&ex);
+ folder = camel_store_get_folder (
+ store, full_name, CAMEL_STORE_FOLDER_INFO_FAST, NULL);
return folder;
}
@@ -2735,14 +2720,11 @@ em_folder_tree_get_selected_folder_info (EMFolderTree *folder_tree)
GtkTreeModel *model;
GtkTreeIter iter;
gchar *full_name = NULL, *name = NULL, *uri = NULL;
- CamelException ex;
CamelStore *store = NULL;
CamelFolderInfo *fi = NULL;
g_return_val_if_fail (EM_IS_FOLDER_TREE (folder_tree), NULL);
- camel_exception_init (&ex);
-
tree_view = GTK_TREE_VIEW (folder_tree);
selection = gtk_tree_view_get_selection (tree_view);
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index ab810bfa30..c7fee4b27c 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -104,7 +104,9 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
const gchar *tmp;
gint fromlen;
- if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &m->base.ex)))
+ fi = camel_store_get_folder_info (
+ m->fromstore, m->frombase, flags, &m->base.error);
+ if (fi == NULL)
return;
pending = g_list_append (pending, fi);
@@ -144,8 +146,10 @@ 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 (m->fromstore, info->full_name, toname->str, &m->base.ex);
- if (camel_exception_is_set (&m->base.ex))
+ camel_store_rename_folder (
+ m->fromstore, info->full_name,
+ toname->str, &m->base.error);
+ if (m->base.error != NULL)
goto exception;
/* this folder no longer exists, unsubscribe it */
@@ -154,19 +158,28 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
deleted = 1;
} else {
- if (!(fromfolder = camel_store_get_folder (m->fromstore, info->full_name, 0, &m->base.ex)))
+ fromfolder = camel_store_get_folder (
+ m->fromstore, info->full_name,
+ 0, &m->base.error);
+ if (fromfolder == NULL)
goto exception;
- if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &m->base.ex))) {
+ tofolder = camel_store_get_folder (
+ m->tostore, toname->str,
+ CAMEL_STORE_FOLDER_CREATE,
+ &m->base.error);
+ if (tofolder == NULL) {
g_object_unref (fromfolder);
goto exception;
}
uids = camel_folder_get_uids (fromfolder);
- camel_folder_transfer_messages_to (fromfolder, uids, tofolder, NULL, m->delete, &m->base.ex);
+ camel_folder_transfer_messages_to (
+ fromfolder, uids, tofolder,
+ NULL, m->delete, &m->base.error);
camel_folder_free_uids (fromfolder, uids);
- if (m->delete && !camel_exception_is_set (&m->base.ex))
+ if (m->delete && m->base.error == NULL)
camel_folder_sync(fromfolder, TRUE, NULL);
g_object_unref (fromfolder);
@@ -174,7 +187,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
}
}
- if (camel_exception_is_set (&m->base.ex))
+ if (m->base.error != NULL)
goto exception;
else if (m->delete && !deleted)
deleting = g_list_prepend (deleting, info);
@@ -265,21 +278,25 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
CamelStore *fromstore = NULL, *tostore = NULL;
CamelStore *local_store;
const gchar *tobase = NULL;
- CamelException ex;
CamelURL *url;
+ GError *local_error = NULL;
if (uri == NULL) {
g_free (cfd);
return;
}
- camel_exception_init (&ex);
-
local_store = e_mail_local_get_store ();
- if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) {
- e_alert_run_dialog_for_args (e_shell_get_active_window (NULL),
- cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
+ fromstore = camel_session_get_store (
+ session, cfd->fi->uri, &local_error);
+ if (fromstore == NULL) {
+ e_alert_run_dialog_for_args (
+ e_shell_get_active_window (NULL),
+ cfd->delete ? "mail:no-move-folder-notexist" :
+ "mail:no-copy-folder-notexist",
+ cfd->fi->full_name, uri,
+ local_error->message, NULL);
goto fail;
}
@@ -293,9 +310,14 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
goto fail;
}
- if (!(tostore = camel_session_get_store (session, uri, &ex))) {
- e_alert_run_dialog_for_args (e_shell_get_active_window (NULL),
- cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-copy-folder-to-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
+ tostore = camel_session_get_store (session, uri, &local_error);
+ if (tostore == NULL) {
+ e_alert_run_dialog_for_args (
+ e_shell_get_active_window (NULL),
+ cfd->delete ? "mail:no-move-folder-to-notexist" :
+ "mail:no-copy-folder-to-notexist",
+ cfd->fi->full_name, uri,
+ local_error->message, NULL);
goto fail;
}
@@ -315,7 +337,9 @@ fail:
g_object_unref (fromstore);
if (tostore)
g_object_unref (tostore);
- camel_exception_clear (&ex);
+
+ g_clear_error (&local_error);
+
g_free (cfd);
}
@@ -395,20 +419,20 @@ em_folder_utils_copy_folder (GtkWindow *parent,
}
static void
-emfu_delete_done (CamelFolder *folder, gboolean removed, CamelException *ex, gpointer data)
+emfu_delete_done (CamelFolder *folder, gboolean removed, GError **error, gpointer data)
{
GtkWidget *dialog = data;
- if (ex && camel_exception_is_set (ex)) {
+ if (error != NULL && *error != NULL) {
GtkWidget *w;
w = e_alert_dialog_new_for_args (
e_shell_get_active_window (NULL),
"mail:no-delete-folder",
camel_folder_get_full_name (folder),
- camel_exception_get_description (ex), NULL);
+ (*error)->message, NULL);
em_utils_show_error_silent (w);
- camel_exception_clear (ex);
+ g_clear_error (error);
}
if (dialog)
@@ -514,9 +538,9 @@ 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 (m->store, m->parent, m->name, &m->base.ex))) {
+ if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.error))) {
if (camel_store_supports_subscriptions (m->store))
- camel_store_subscribe_folder (m->store, m->full_name, &m->base.ex);
+ camel_store_subscribe_folder (m->store, m->full_name, &m->base.error);
}
}
@@ -601,7 +625,6 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
EMFolderTreeModelStoreInfo *si;
GtkTreeModel *model;
const gchar *uri, *path;
- CamelException ex;
CamelStore *store;
struct _EMCreateFolderTempData *emcftd;
@@ -617,11 +640,10 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
g_print ("DEBUG: %s (%s)\n", path, uri);
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return;
- }
model = gtk_tree_view_get_model (GTK_TREE_VIEW (emfs->emft));
si = em_folder_tree_model_lookup_store_info (
@@ -654,7 +676,6 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
}
g_object_unref (store);
- camel_exception_clear (&ex);
}
/* FIXME: these functions must be documented */
@@ -702,7 +723,7 @@ emfu_unsubscribe_folder__exec (struct _folder_unsub_t *msg)
gint url_flags;
store = camel_session_get_store (
- session, msg->folder_uri, &msg->base.ex);
+ session, msg->folder_uri, &msg->base.error);
if (store == NULL)
return;
@@ -715,7 +736,7 @@ emfu_unsubscribe_folder__exec (struct _folder_unsub_t *msg)
path = url->path + 1;
if (path != NULL)
- camel_store_unsubscribe_folder (store, path, &msg->base.ex);
+ camel_store_unsubscribe_folder (store, path, &msg->base.error);
camel_url_free (url);
}
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index db13260157..d49d797de4 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -426,14 +426,14 @@ 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>");
+ "<tr><td></td></tr></table></td>", 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>");
+ "<tr><td></td></tr></table></td><td><font size=-1>", NULL);
/* output some info about it */
/* FIXME: should we look up mime_type from object again? */
@@ -441,13 +441,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);
+ camel_stream_write_string (stream, html, NULL);
g_free (html);
g_free (text);
camel_stream_write_string (
stream, "</font></td></tr><tr></table>\n"
- EM_FORMAT_HTML_VPAD);
+ EM_FORMAT_HTML_VPAD, NULL);
if (handle && info->shown)
handle->handler (emf, stream, part, handle, FALSE);
@@ -491,7 +491,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>");
+ "<h3><font size=-1 color=red>", NULL);
html = camel_text_to_html (
_("Evolution cannot render this email as it is too "
@@ -499,19 +499,18 @@ 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);
+ camel_stream_write_string (stream, html, NULL);
camel_stream_write_string (
- stream, "</font></h3></td></tr></table>\n");
+ stream, "</font></h3></td></tr></table>\n", NULL);
camel_stream_write_string (
- stream, "<table cellspacing=0 cellpadding=0><tr>");
+ stream, "<table cellspacing=0 cellpadding=0><tr>", 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);
+ camel_stream_write_string (stream, EM_FORMAT_HTML_VPAD, NULL);
g_free (classid);
}
@@ -681,8 +680,8 @@ efhd_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
/* TODO: identical to efh_write_image */
d(printf("writing image '%s'\n", puri->cid));
- camel_data_wrapper_decode_to_stream(dw, stream);
- camel_stream_close(stream);
+ camel_data_wrapper_decode_to_stream(dw, stream, NULL);
+ camel_stream_close(stream, NULL);
}
static void
@@ -869,7 +868,7 @@ efhd_attachment_frame (EMFormat *emf,
info->handle->handler (
emf, stream, info->puri.part, info->handle, FALSE);
- camel_stream_close (stream);
+ camel_stream_close (stream, NULL);
}
static void
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 5454394e49..c63ed28085 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -204,7 +204,7 @@ efh_format_exec (struct _format_msg *m)
(CamelMimePart *) m->message, handle, FALSE);
}
- camel_stream_flush((CamelStream *)m->estream);
+ camel_stream_flush((CamelStream *)m->estream, NULL);
puri_level = format->pending_uri_level;
base = format->base;
@@ -244,8 +244,10 @@ efh_format_exec (struct _format_msg *m)
/* Closing this base stream can queue more jobs, so we need
to check the list again after we've finished */
d(printf("out of jobs, closing root stream\n"));
- camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
- camel_stream_close((CamelStream *)m->estream);
+ camel_stream_write_string (
+ (CamelStream *) m->estream,
+ "</body>\n</html>\n", NULL);
+ camel_stream_close((CamelStream *)m->estream, NULL);
g_object_unref (m->estream);
m->estream = NULL;
}
@@ -274,7 +276,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);
+ camel_stream_close((CamelStream *)m->estream, NULL);
g_object_unref (m->estream);
}
if (m->folder)
@@ -695,11 +697,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>");
+ camel_stream_write_string (stream, "<table><tr><td><tt>", NULL);
em_format_format_text (emf, (CamelStream *) filtered_stream, dw);
g_object_unref (filtered_stream);
- camel_stream_write_string(stream, "</tt></td></tr></table>");
+ camel_stream_write_string(stream, "</tt></td></tr></table>", NULL);
}
static void
@@ -720,18 +722,20 @@ efh_format_attachment (EMFormat *emf,
"<table width=10 cellspacing=0 cellpadding=0>"
"<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");
+ "<tr><td></td></tr></table></td><td><font size=-1>\n",
+ 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);
+ camel_stream_write_string (stream, html, NULL);
g_free (html);
g_free (text);
- camel_stream_write_string (stream, "</font></td></tr><tr></table>");
+ camel_stream_write_string (
+ stream, "</font></td></tr><tr></table>", NULL);
if (handle && em_format_is_inline (emf, emf->part_id->str, part, handle))
handle->handler (emf, stream, part, handle, FALSE);
@@ -1215,12 +1219,12 @@ em_format_html_file_part(EMFormatHTML *efh, const gchar *mime_type, const gchar
CamelDataWrapper *dw;
gchar *basename;
- stream = camel_stream_fs_new_with_name(filename, O_RDONLY, 0);
+ stream = camel_stream_fs_new_with_name(filename, O_RDONLY, 0, NULL);
if (stream == NULL)
return NULL;
dw = camel_data_wrapper_new();
- camel_data_wrapper_construct_from_stream(dw, stream);
+ camel_data_wrapper_construct_from_stream(dw, stream, NULL);
g_object_unref (stream);
if (mime_type)
camel_data_wrapper_set_mime_type(dw, mime_type);
@@ -1436,7 +1440,7 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled)
break;
}
/* FIXME: progress reporting in percentage, can we get the length always? do we care? */
- n = camel_stream_read(instream, buffer, sizeof (buffer));
+ n = camel_stream_read(instream, buffer, sizeof (buffer), NULL);
if (n > 0) {
nread += n;
/* If we didn't get a valid Content-Length header, do not try to calculate percentage */
@@ -1445,18 +1449,18 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled)
camel_operation_progress(NULL, pc_complete);
}
d(printf(" read %d bytes\n", n));
- if (costream && camel_stream_write (costream, buffer, n) == -1) {
+ if (costream && camel_stream_write (costream, buffer, n, NULL) == -1) {
n = -1;
break;
}
- camel_stream_write(job->stream, buffer, n);
+ camel_stream_write(job->stream, buffer, n, NULL);
}
} while (n>0);
/* indicates success */
if (n == 0)
- camel_stream_close(job->stream);
+ camel_stream_close(job->stream, NULL);
if (costream) {
/* do not store broken files in a cache */
@@ -1709,8 +1713,9 @@ 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);
- camel_stream_close((CamelStream *)filtered_stream);
+ camel_data_wrapper_decode_to_stream (
+ dw, (CamelStream *)filtered_stream, NULL);
+ camel_stream_close((CamelStream *)filtered_stream, NULL);
g_object_unref (filtered_stream);
mp = em_inline_filter_get_multipart(inline_filter);
@@ -1753,11 +1758,12 @@ efh_text_plain (EMFormatHTML *efh,
e_color_to_value (
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_TEXT]));
- camel_stream_write_string(stream, "<tt>\n" EFH_MESSAGE_START);
+ 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);
- camel_stream_write_string(stream, "</tt>\n");
- camel_stream_write_string(stream, "</div>\n");
+ camel_stream_flush((CamelStream *)filtered_stream, NULL);
+ camel_stream_write_string (stream, "</tt>\n", NULL);
+ camel_stream_write_string (stream, "</div>\n", NULL);
} else {
g_string_append_printf(((EMFormat *)efh)->part_id, ".inline.%d", i);
em_format_part((EMFormat *)efh, stream, newpart);
@@ -1777,9 +1783,11 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E
if (!strcmp(info->mime_type, "text/richtext")) {
flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT;
- camel_stream_write_string( stream, "\n<!-- text/richtext -->\n");
+ camel_stream_write_string (
+ stream, "\n<!-- text/richtext -->\n", NULL);
} else {
- camel_stream_write_string( stream, "\n<!-- text/enriched -->\n");
+ camel_stream_write_string (
+ stream, "\n<!-- text/enriched -->\n", NULL);
}
enriched = camel_mime_filter_enriched_new(flags);
@@ -1803,7 +1811,7 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E
em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
g_object_unref (filtered_stream);
- camel_stream_write_string(stream, "</div>");
+ camel_stream_write_string (stream, "</div>", NULL);
}
static void
@@ -1997,19 +2005,19 @@ efh_message_deliverystatus(EMFormatHTML *efh, CamelStream *stream, CamelMimePart
CAMEL_STREAM_FILTER (filtered_stream), html_filter);
g_object_unref (html_filter);
- camel_stream_write_string(stream, "<tt>\n" EFH_MESSAGE_START);
+ 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);
- camel_stream_write_string(stream, "</tt>\n");
+ camel_stream_flush((CamelStream *)filtered_stream, NULL);
+ camel_stream_write_string (stream, "</tt>\n", NULL);
- camel_stream_write_string(stream, "</div>");
+ camel_stream_write_string (stream, "</div>", NULL);
}
static void
emfh_write_related(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
{
em_format_format_content(emf, stream, puri->part);
- camel_stream_close(stream);
+ camel_stream_close(stream, NULL);
}
static void
@@ -2120,7 +2128,7 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
g_string_append_printf(emf->part_id, "related.%d", displayid);
em_format_part(emf, stream, display_part);
g_string_truncate(emf->part_id, partidlen);
- camel_stream_flush(stream);
+ camel_stream_flush(stream, NULL);
/* queue a job to check for un-referenced parts to add as attachments */
job = em_format_html_job_new((EMFormatHTML *)emf, emfh_multipart_related_check, NULL);
@@ -2137,8 +2145,8 @@ efh_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
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);
- camel_stream_close(stream);
+ camel_data_wrapper_decode_to_stream(dw, stream, NULL);
+ camel_stream_close(stream, NULL);
}
static void
diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c
index d86e2a3cb4..f74ba8d98b 100644
--- a/mail/em-html-stream.c
+++ b/mail/em-html-stream.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <gtk/gtk.h>
+#include <glib/gi18n-lib.h>
#include "em-html-stream.h"
#define d(x)
@@ -63,19 +64,24 @@ html_stream_dispose (GObject *object)
if (emhs->html_stream) {
/* set 'in finalise' flag */
- camel_stream_close (CAMEL_STREAM (emhs));
+ camel_stream_close (CAMEL_STREAM (emhs), NULL);
}
}
static gssize
html_stream_sync_write (CamelStream *stream,
const gchar *buffer,
- gsize n)
+ gsize n,
+ GError **error)
{
EMHTMLStream *emhs = EM_HTML_STREAM (stream);
- if (emhs->html == NULL)
+ if (emhs->html == NULL) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("No HTML stream available"));
return -1;
+ }
if (emhs->html_stream == NULL)
emhs->html_stream = gtk_html_begin_full (
@@ -87,12 +93,17 @@ html_stream_sync_write (CamelStream *stream,
}
static gint
-html_stream_sync_flush (CamelStream *stream)
+html_stream_sync_flush (CamelStream *stream,
+ GError **error)
{
EMHTMLStream *emhs = (EMHTMLStream *)stream;
- if (emhs->html_stream == NULL)
+ if (emhs->html_stream == NULL) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("No HTML stream available"));
return -1;
+ }
gtk_html_flush (emhs->html);
@@ -100,12 +111,17 @@ html_stream_sync_flush (CamelStream *stream)
}
static gint
-html_stream_sync_close (CamelStream *stream)
+html_stream_sync_close (CamelStream *stream,
+ GError **error)
{
EMHTMLStream *emhs = (EMHTMLStream *)stream;
- if (emhs->html_stream == NULL)
+ if (emhs->html_stream == NULL) {
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("No HTML stream available"));
return -1;
+ }
gtk_html_stream_close (emhs->html_stream, GTK_HTML_STREAM_OK);
html_stream_cleanup (emhs);
diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c
index c142ca28b1..b780256e2b 100644
--- a/mail/em-inline-filter.c
+++ b/mail/em-inline-filter.c
@@ -92,12 +92,12 @@ 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);
+ camel_data_wrapper_construct_from_stream (dw, filter_stream, NULL);
g_object_unref (enc_filter);
g_object_unref (filter_stream);
} else {
- camel_data_wrapper_construct_from_stream (dw, mem);
+ camel_data_wrapper_construct_from_stream (dw, mem, NULL);
}
g_object_unref (mem);
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index 8152974f32..ceeb770128 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -266,9 +266,13 @@ static void
sub_folder_exec (struct _zsubscribe_msg *m)
{
if (m->subscribe)
- camel_store_subscribe_folder (m->sub->store, m->node->info->full_name, &m->base.ex);
+ camel_store_subscribe_folder (
+ m->sub->store, m->node->info->full_name,
+ &m->base.error);
else
- camel_store_unsubscribe_folder (m->sub->store, m->node->info->full_name, &m->base.ex);
+ camel_store_unsubscribe_folder (
+ m->sub->store, m->node->info->full_name,
+ &m->base.error);
}
static void
@@ -285,7 +289,7 @@ sub_folder_done (struct _zsubscribe_msg *m)
if (m->sub->cancel)
return;
- if (!camel_exception_is_set(&m->base.ex)) {
+ if (m->base.error == NULL) {
if (m->subscribe)
m->node->info->flags |= CAMEL_FOLDER_SUBSCRIBED;
else
@@ -451,7 +455,12 @@ sub_folderinfo_exec (struct _emse_folderinfo_msg *m)
if (m->seq == m->sub->seq) {
camel_operation_register (m->base.cancel);
/* get the full folder tree for search ability */
- m->info = camel_store_get_folder_info (m->sub->store, NULL, CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL | CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST | CAMEL_STORE_FOLDER_INFO_RECURSIVE, &m->base.ex);
+ m->info = camel_store_get_folder_info (
+ m->sub->store, NULL,
+ CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL |
+ CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST |
+ CAMEL_STORE_FOLDER_INFO_RECURSIVE,
+ &m->base.error);
camel_operation_unregister (m->base.cancel);
}
}
@@ -463,10 +472,10 @@ sub_folderinfo_done (struct _emse_folderinfo_msg *m)
if (m->sub->cancel || m->seq != m->sub->seq)
return;
- if (camel_exception_is_set (&m->base.ex)) {
- g_warning ("Error getting folder info from store: %s",
- camel_exception_get_description (&m->base.ex));
- }
+ if (m->base.error != NULL)
+ g_warning (
+ "Error getting folder info from store: %s",
+ m->base.error->message);
if (m->info) {
if (m->node) {
diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c
index d0dd6e7853..238ccf0452 100644
--- a/mail/em-sync-stream.c
+++ b/mail/em-sync-stream.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <string.h>
+#include <glib/gi18n-lib.h>
#include <libedataserver/e-flag.h>
#include "mail-mt.h"
@@ -41,6 +42,7 @@ enum _write_msg_t {
struct _write_msg {
EMSyncStream *emss;
+ GError *error;
EFlag *done;
enum _write_msg_t op;
@@ -67,22 +69,23 @@ sync_stream_process_message (struct _write_msg *msg)
if (emss->buffer != NULL && emss->buffer->len > 0) {
EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (
CAMEL_STREAM (emss), emss->buffer->str,
- emss->buffer->len);
+ emss->buffer->len, &msg->error);
g_string_set_size (emss->buffer, 0);
}
switch (msg->op) {
case EMSS_WRITE:
EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (
- CAMEL_STREAM (emss), msg->string, msg->len);
+ CAMEL_STREAM (emss), msg->string,
+ msg->len, &msg->error);
break;
case EMSS_FLUSH:
EM_SYNC_STREAM_GET_CLASS (emss)->sync_flush (
- CAMEL_STREAM (emss));
+ CAMEL_STREAM (emss), &msg->error);
break;
case EMSS_CLOSE:
EM_SYNC_STREAM_GET_CLASS (emss)->sync_close (
- CAMEL_STREAM (emss));
+ CAMEL_STREAM (emss), &msg->error);
break;
}
@@ -93,12 +96,16 @@ sync_stream_process_message (struct _write_msg *msg)
}
static void
-sync_stream_sync_op (EMSyncStream *emss, enum _write_msg_t op,
- const gchar *string, gsize len)
+sync_stream_sync_op (EMSyncStream *emss,
+ enum _write_msg_t op,
+ const gchar *string,
+ gsize len,
+ GError **error)
{
struct _write_msg msg;
msg.done = e_flag_new ();
+ msg.error = NULL;
msg.emss = emss;
msg.op = op;
msg.string = string;
@@ -113,6 +120,9 @@ sync_stream_sync_op (EMSyncStream *emss, enum _write_msg_t op,
e_flag_wait (msg.done);
e_flag_free (msg.done);
+ if (msg.error != NULL)
+ g_propagate_error (error, msg.error);
+
g_object_unref (emss);
}
@@ -128,57 +138,74 @@ sync_stream_finalize (GObject *object)
}
static gssize
-sync_stream_write (CamelStream *stream, const gchar *string, gsize len)
+sync_stream_write (CamelStream *stream,
+ const gchar *string,
+ gsize len,
+ GError **error)
{
EMSyncStream *emss = EM_SYNC_STREAM (stream);
- if (emss->cancel)
+ if (emss->cancel) {
+ g_set_error (
+ error, G_IO_ERROR, G_IO_ERROR_CANCELLED,
+ _("Canceled"));
return -1;
+ }
if (mail_in_main_thread ()) {
- EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (stream, string, len);
+ EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (stream, string, len, error);
} else if (emss->buffer != NULL) {
if (len < (emss->buffer->allocated_len - emss->buffer->len))
g_string_append_len (emss->buffer, string, len);
else
- sync_stream_sync_op (emss, EMSS_WRITE, string, len);
+ sync_stream_sync_op (emss, EMSS_WRITE, string, len, error);
} else {
- sync_stream_sync_op(emss, EMSS_WRITE, string, len);
+ sync_stream_sync_op(emss, EMSS_WRITE, string, len, error);
}
return (gssize) len;
}
static gint
-sync_stream_flush (CamelStream *stream)
+sync_stream_flush (CamelStream *stream,
+ GError **error)
{
EMSyncStream *emss = EM_SYNC_STREAM (stream);
- if (emss->cancel)
+ if (emss->cancel) {
+ g_set_error (
+ error, G_IO_ERROR, G_IO_ERROR_CANCELLED,
+ _("Canceled"));
return -1;
+ }
if (mail_in_main_thread ())
- return EM_SYNC_STREAM_GET_CLASS (emss)->sync_flush (stream);
+ return EM_SYNC_STREAM_GET_CLASS (emss)->sync_flush (stream, error);
else
- sync_stream_sync_op (emss, EMSS_FLUSH, NULL, 0);
+ sync_stream_sync_op (emss, EMSS_FLUSH, NULL, 0, error);
return 0;
}
static gint
-sync_stream_close (CamelStream *stream)
+sync_stream_close (CamelStream *stream,
+ GError **error)
{
EMSyncStream *emss = EM_SYNC_STREAM (stream);
- if (emss->cancel)
+ if (emss->cancel) {
+ g_set_error (
+ error, G_IO_ERROR, G_IO_ERROR_CANCELLED,
+ _("Canceled"));
return -1;
+ }
emss->idle_id = 0;
if (mail_in_main_thread ())
- return EM_SYNC_STREAM_GET_CLASS (emss)->sync_close (stream);
+ return EM_SYNC_STREAM_GET_CLASS (emss)->sync_close (stream, error);
else
- sync_stream_sync_op (emss, EMSS_CLOSE, NULL, 0);
+ sync_stream_sync_op (emss, EMSS_CLOSE, NULL, 0, error);
return 0;
}
diff --git a/mail/em-sync-stream.h b/mail/em-sync-stream.h
index 593079021e..806d79d55a 100644
--- a/mail/em-sync-stream.h
+++ b/mail/em-sync-stream.h
@@ -69,9 +69,12 @@ struct _EMSyncStreamClass {
gssize (*sync_write) (CamelStream *stream,
const gchar *string,
- gsize len);
- gint (*sync_close) (CamelStream *stream);
- gint (*sync_flush) (CamelStream *stream);
+ gsize len,
+ GError **error);
+ gint (*sync_close) (CamelStream *stream,
+ GError **error);
+ gint (*sync_flush) (CamelStream *stream,
+ GError **error);
};
GType em_sync_stream_get_type (void);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 1e40087f18..aa147bf7e1 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -567,10 +567,10 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr
/* 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) == -1
- || camel_stream_flush(stream) == -1
- || camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, (CamelStream *)filtered_stream) == -1
- || camel_stream_flush((CamelStream *)filtered_stream) == -1)
+ 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)
res = -1;
g_free(from);
@@ -590,38 +590,36 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr
static gint
em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream)
{
- CamelException *ex = camel_exception_new();
CamelMimeParser *mp = camel_mime_parser_new();
- gint res = -1;
+ gboolean success = TRUE;
camel_mime_parser_scan_from(mp, TRUE);
- camel_mime_parser_init_with_stream(mp, stream);
+ camel_mime_parser_init_with_stream(mp, stream, NULL);
while (camel_mime_parser_step(mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) {
CamelMimeMessage *msg;
+ gboolean success;
/* NB: de-from filter, once written */
msg = camel_mime_message_new();
- if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) {
+ if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp, NULL) == -1) {
g_object_unref (msg);
break;
}
- camel_folder_append_message(folder, msg, NULL, NULL, ex);
+ success = camel_folder_append_message (
+ folder, msg, NULL, NULL, NULL);
g_object_unref (msg);
- if (camel_exception_is_set (ex))
+ if (!success)
break;
camel_mime_parser_step(mp, NULL, NULL);
}
g_object_unref (mp);
- if (!camel_exception_is_set(ex))
- res = 0;
- camel_exception_free(ex);
- return res;
+ return success ? 0 : -1;
}
/**
@@ -700,7 +698,6 @@ em_utils_selection_get_message (GtkSelectionData *selection_data,
CamelFolder *folder)
{
CamelStream *stream;
- CamelException *ex;
CamelMimeMessage *msg;
const guchar *data;
gint length;
@@ -711,15 +708,13 @@ em_utils_selection_get_message (GtkSelectionData *selection_data,
if (data == NULL || length == -1)
return;
- ex = camel_exception_new();
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) == 0)
- camel_folder_append_message(folder, msg, NULL, NULL, ex);
+ if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream, NULL) == 0)
+ camel_folder_append_message(folder, msg, NULL, NULL, NULL);
g_object_unref (msg);
g_object_unref (stream);
- camel_exception_free(ex);
}
/**
@@ -767,7 +762,7 @@ void
em_utils_selection_get_uidlist (GtkSelectionData *selection_data,
CamelFolder *dest,
gint move,
- CamelException *ex)
+ GError **error)
{
/* format: "uri\0uid1\0uid2\0uid3\0...\0uidn" */
gchar *inptr, *inend;
@@ -805,9 +800,9 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data,
return;
}
- folder = mail_tool_uri_to_folder((gchar *) data, 0, ex);
+ folder = mail_tool_uri_to_folder((gchar *) data, 0, error);
if (folder) {
- camel_folder_transfer_messages_to(folder, uids, dest, NULL, move, ex);
+ camel_folder_transfer_messages_to(folder, uids, dest, NULL, move, error);
g_object_unref (folder);
}
@@ -1280,9 +1275,9 @@ em_utils_message_to_html (CamelMimeMessage *message, const gchar *credits, guint
g_object_unref (emfq);
if (append && *append)
- camel_stream_write ((CamelStream*)mem, append, strlen (append));
+ camel_stream_write ((CamelStream*)mem, append, strlen (append), NULL);
- camel_stream_write((CamelStream *)mem, "", 1);
+ camel_stream_write((CamelStream *)mem, "", 1, NULL);
g_object_unref (mem);
text = (gchar *)buf->data;
@@ -1331,13 +1326,10 @@ em_utils_empty_trash (GtkWidget *parent)
EAccountList *accounts;
EAccount *account;
EIterator *iter;
- CamelException ex;
if (!em_utils_prompt_user((GtkWindow *) parent, "/apps/evolution/mail/prompts/empty_trash", "mail:ask-empty-trash", NULL))
return;
- camel_exception_init (&ex);
-
accounts = e_get_account_list ();
iter = e_list_get_iterator ((EList *) accounts);
while (e_iterator_is_valid (iter)) {
@@ -1345,16 +1337,13 @@ em_utils_empty_trash (GtkWidget *parent)
/* make sure this is a valid source */
if (account->enabled && account->source->url) {
- provider = camel_provider_get(account->source->url, &ex);
+ provider = camel_provider_get(account->source->url, NULL);
if (provider) {
/* make sure this store is a remote store */
if (provider->flags & CAMEL_PROVIDER_IS_STORAGE) {
mail_empty_trash (account, NULL, NULL);
}
}
-
- /* clear the exception for the next round */
- camel_exception_clear (&ex);
}
e_iterator_next (iter);
@@ -1406,22 +1395,18 @@ gchar *em_uri_from_camel(const gchar *curi)
const gchar *uid, *path;
gchar *euri, *tmp;
CamelProvider *provider;
- CamelException ex;
/* Easiest solution to code that shouldnt be calling us */
if (!strncmp(curi, "email:", 6))
return g_strdup(curi);
- camel_exception_init(&ex);
- provider = camel_provider_get(curi, &ex);
+ provider = camel_provider_get(curi, NULL);
if (provider == NULL) {
- camel_exception_clear(&ex);
d(printf("em uri from camel failed '%s'\n", curi));
return g_strdup(curi);
}
- curl = camel_url_new(curi, &ex);
- camel_exception_clear(&ex);
+ curl = camel_url_new(curi, NULL);
if (curl == NULL)
return g_strdup(curi);
@@ -1457,7 +1442,6 @@ gchar *em_uri_to_camel(const gchar *euri)
EAccountService *service;
CamelProvider *provider;
CamelURL *eurl, *curl;
- CamelException ex = CAMEL_EXCEPTION_INITIALISER;
gchar *uid, *curi;
if (strncmp(euri, "email:", 6) != 0) {
@@ -1518,11 +1502,9 @@ gchar *em_uri_to_camel(const gchar *euri)
}
service = account->source;
- if (!(provider = camel_provider_get (service->url, &ex))) {
- camel_exception_clear (&ex);
+ provider = camel_provider_get (service->url, NULL);
+ if (provider == NULL)
return g_strdup (euri);
- }
- camel_exception_clear (&ex);
curl = camel_url_new(service->url, NULL);
if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH)
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 1fde390d72..ac1f1a0928 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -57,7 +57,7 @@ void em_utils_selection_get_mailbox(GtkSelectionData *data, CamelFolder *folder)
void em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder);
/* FIXME: be nice if these also worked on CamelFolder's, no easy way to get uri from folder yet tho */
void em_utils_selection_set_uidlist(GtkSelectionData *data, const gchar *uri, GPtrArray *uids);
-void em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint move, CamelException *ex);
+void em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint move, GError **error);
void em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids);
void em_utils_selection_get_urilist(GtkSelectionData *data, CamelFolder *folder);
diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c
index 937bfa50de..87c94ff524 100644
--- a/mail/importers/elm-importer.c
+++ b/mail/importers/elm-importer.c
@@ -205,7 +205,7 @@ elm_import_done(struct _elm_import_msg *m)
{
printf("importing complete\n");
- if (!camel_exception_is_set(&m->base.ex)) {
+ if (m->base.error == NULL) {
GConfClient *gconf;
gconf = gconf_client_get_default();
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index dc419dc89e..8467f2c47f 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -204,7 +204,7 @@ mbox_status_timeout(gpointer data)
}
static void
-mbox_import_done(gpointer data, CamelException *ex)
+mbox_import_done(gpointer data, GError **error)
{
MboxImporter *importer = data;
@@ -330,7 +330,7 @@ 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) == -1) {
+ if (camel_mime_part_construct_from_parser ((CamelMimePart *)msg, mp, NULL) == -1) {
g_object_unref (msg);
break;
}
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index 35abd8365f..7c497108b1 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -54,7 +54,7 @@ struct _import_mbox_msg {
gchar *uri;
CamelOperation *cancel;
- void (*done)(gpointer data, CamelException *ex);
+ void (*done)(gpointer data, GError **error);
gpointer done_data;
};
@@ -122,7 +122,8 @@ import_mbox_exec (struct _import_mbox_msg *m)
if (m->uri == NULL || m->uri[0] == 0)
folder = e_mail_local_get_folder (E_MAIL_FOLDER_INBOX);
else
- folder = mail_tool_uri_to_folder(m->uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ folder = mail_tool_uri_to_folder (
+ m->uri, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
if (folder == NULL)
return;
@@ -160,7 +161,7 @@ import_mbox_exec (struct _import_mbox_msg *m)
camel_operation_progress(NULL, pc);
msg = camel_mime_message_new();
- if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) {
+ if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp, NULL) == -1) {
/* set exception? */
g_object_unref (msg);
break;
@@ -179,11 +180,12 @@ import_mbox_exec (struct _import_mbox_msg *m)
flags |= decode_status(tmp);
camel_message_info_set_flags(info, flags, ~0);
- camel_folder_append_message(folder, msg, info, NULL, &m->base.ex);
+ camel_folder_append_message (
+ folder, msg, info, NULL, &m->base.error);
camel_message_info_free(info);
g_object_unref (msg);
- if (camel_exception_is_set(&m->base.ex))
+ if (m->base.error != NULL)
break;
camel_mime_parser_step(mp, NULL, NULL);
@@ -206,7 +208,7 @@ static void
import_mbox_done (struct _import_mbox_msg *m)
{
if (m->done)
- m->done(m->done_data, &m->base.ex);
+ m->done(m->done_data, &m->base.error);
}
static void
@@ -227,7 +229,7 @@ static MailMsgInfo import_mbox_info = {
};
gint
-mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, CamelException *), gpointer data)
+mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data)
{
struct _import_mbox_msg *m;
gint id;
diff --git a/mail/importers/mail-importer.h b/mail/importers/mail-importer.h
index 15de575f8b..01a69c981d 100644
--- a/mail/importers/mail-importer.h
+++ b/mail/importers/mail-importer.h
@@ -46,7 +46,7 @@ EImportImporter *pine_importer_peek(void);
#define MSG_FLAG_MARKED 0x0004
#define MSG_FLAG_EXPUNGED 0x0008
-gint mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, CamelException *), gpointer data);
+gint mail_importer_import_mbox(const gchar *path, const gchar *folderuri, CamelOperation *cancel, void (*done)(gpointer data, GError **), gpointer data);
void mail_importer_import_mbox_sync(const gchar *path, const gchar *folderuri, CamelOperation *cancel);
struct _MailImporterSpecial {
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c
index e6cc75e63c..354d53d377 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -247,7 +247,7 @@ pine_import_done (struct _pine_import_msg *m)
{
printf("importing complete\n");
- if (!camel_exception_is_set(&m->base.ex)) {
+ if (m->base.error == NULL) {
GConfClient *gconf;
gconf = gconf_client_get_default();
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 7a8a20613d..d4c4e523f3 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -779,7 +779,7 @@ ping_store_exec (struct _ping_store_msg *m)
online = TRUE;
}
if (online)
- camel_store_noop (m->store, &m->base.ex);
+ camel_store_noop (m->store, &m->base.error);
}
static void
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 76a6ccc488..97144818d3 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -76,7 +76,6 @@ mail_msg_new (MailMsgInfo *info)
msg->ref_count = 1;
msg->seq = mail_msg_seq++;
msg->cancel = camel_operation_new(mail_operation_status, GINT_TO_POINTER(msg->seq));
- camel_exception_init(&msg->ex);
msg->priv = g_slice_new0 (MailMsgPrivate);
msg->priv->cancelable = TRUE;
@@ -146,7 +145,9 @@ mail_msg_free (MailMsg *mail_msg)
camel_operation_unref (mail_msg->cancel);
}
- camel_exception_clear (&mail_msg->ex);
+ if (mail_msg->error != NULL)
+ g_error_free (mail_msg->error);
+
g_slice_free (MailMsgPrivate, mail_msg->priv);
g_slice_free1 (mail_msg->info->size, mail_msg);
}
@@ -245,9 +246,9 @@ mail_msg_check_error (gpointer msg)
checkmem(m->priv);
#endif
- if (!camel_exception_is_set(&m->ex)
- || m->ex.id == CAMEL_EXCEPTION_USER_CANCEL
- || m->ex.id == CAMEL_EXCEPTION_FOLDER_INVALID_UID
+ if (m->error == NULL
+ || g_error_matches (m->error, G_IO_ERROR, G_IO_ERROR_CANCELLED)
+ || g_error_matches (m->error, CAMEL_FOLDER_ERROR, CAMEL_FOLDER_ERROR_INVALID_UID)
|| (m->cancel && camel_operation_cancel_check (m->cancel)))
return;
@@ -260,7 +261,7 @@ mail_msg_check_error (gpointer msg)
if (g_hash_table_lookup(active_errors, m->info)) {
g_message (
"Error occurred while existing dialogue active:\n%s",
- camel_exception_get_description(&m->ex));
+ m->error->message);
return;
}
@@ -270,12 +271,12 @@ mail_msg_check_error (gpointer msg)
&& (what = m->info->desc (m))) {
gd = (GtkDialog *) e_alert_dialog_new_for_args (
parent, "mail:async-error", what,
- camel_exception_get_description(&m->ex), NULL);
+ m->error->message, NULL);
g_free(what);
} else
gd = (GtkDialog *) e_alert_dialog_new_for_args (
parent, "mail:async-error-nodescribe",
- camel_exception_get_description(&m->ex), NULL);
+ m->error->message, NULL);
g_hash_table_insert(active_errors, m->info, gd);
g_signal_connect(gd, "response", G_CALLBACK(error_response), m->info);
diff --git a/mail/mail-mt.h b/mail/mail-mt.h
index 261b37699f..d8b4fc70d2 100644
--- a/mail/mail-mt.h
+++ b/mail/mail-mt.h
@@ -41,7 +41,7 @@ struct _MailMsg {
guint seq; /* seq number for synchronisation */
gint priority; /* priority (default = 0) */
CamelOperation *cancel; /* a cancellation/status handle */
- CamelException ex; /* an initialised camel exception, upto the caller to use this */
+ GError *error; /* up to the caller to use this */
MailMsgPrivate *priv;
};
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 52976148d6..ae2d12dfda 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -115,15 +115,17 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m)
else
folder_uids = uids = camel_folder_get_uids (folder);
- camel_filter_driver_filter_folder (m->driver, folder, m->cache, uids, m->delete, &m->base.ex);
- camel_filter_driver_flush (m->driver, &m->base.ex);
+ camel_filter_driver_filter_folder (
+ m->driver, folder, m->cache, uids,
+ m->delete, &m->base.error);
+ camel_filter_driver_flush (m->driver, &m->base.error);
if (folder_uids)
camel_folder_free_uids (folder, folder_uids);
/* sync our source folder */
if (!m->cache)
- camel_folder_sync (folder, FALSE, camel_exception_is_set (&m->base.ex) ? NULL : &m->base.ex);
+ camel_folder_sync (folder, FALSE, &m->base.error);
camel_folder_thaw (folder);
if (m->destination)
@@ -260,20 +262,26 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
/* FIXME: this should support keep_on_server too, which would then perform a spool
access thingy, right? problem is matching raw messages to uid's etc. */
if (!strncmp (m->source_uri, "mbox:", 5)) {
- gchar *path = mail_tool_do_movemail (m->source_uri, &fm->base.ex);
+ gchar *path = mail_tool_do_movemail (m->source_uri, &fm->base.error);
- if (path && !camel_exception_is_set (&fm->base.ex)) {
+ if (path && fm->base.error == NULL) {
camel_folder_freeze (fm->destination);
- camel_filter_driver_set_default_folder (fm->driver, fm->destination);
- camel_filter_driver_filter_mbox (fm->driver, path, m->source_uri, &fm->base.ex);
+ camel_filter_driver_set_default_folder (
+ fm->driver, fm->destination);
+ camel_filter_driver_filter_mbox (
+ fm->driver, path, m->source_uri,
+ &fm->base.error);
camel_folder_thaw (fm->destination);
- if (!camel_exception_is_set (&fm->base.ex))
+ if (fm->base.error == NULL)
g_unlink (path);
}
g_free (path);
} else {
- CamelFolder *folder = fm->source_folder = mail_tool_get_inbox (m->source_uri, &fm->base.ex);
+ CamelFolder *folder;
+
+ folder = fm->source_folder =
+ mail_tool_get_inbox (m->source_uri, &fm->base.error);
if (folder) {
/* this handles 'keep on server' stuff, if we have any new uid's to copy
@@ -304,14 +312,14 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
em_filter_folder_element_exec (fm);
/* need to uncancel so writes/etc. don't fail */
- if (fm->base.ex.id == CAMEL_EXCEPTION_USER_CANCEL)
+ if (g_error_matches (fm->base.error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
camel_operation_uncancel(NULL);
/* save the cache of uids that we've just downloaded */
camel_uid_cache_save (cache);
}
- if (fm->delete && !camel_exception_is_set (&fm->base.ex)) {
+ if (fm->delete && fm->base.error == NULL) {
/* not keep on server - just delete all the actual messages on the server */
for (i=0;i<folder_uids->len;i++) {
d(printf("force delete uid '%s'\n", (gchar *)folder_uids->pdata[i]));
@@ -319,7 +327,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
}
}
- if ((fm->delete || cache_uids) && !camel_exception_is_set (&fm->base.ex)) {
+ if ((fm->delete || cache_uids) && fm->base.error == NULL) {
/* expunge messages (downloaded so far) */
camel_folder_sync(folder, fm->delete, NULL);
}
@@ -448,7 +456,12 @@ static void report_status (struct _send_queue_msg *m, enum camel_filter_status_t
/* send 1 message to a specific transport */
static void
-mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *uid, const gchar *destination, CamelFilterDriver *driver, CamelException *ex)
+mail_send_message (struct _send_queue_msg *m,
+ CamelFolder *queue,
+ const gchar *uid,
+ const gchar *destination,
+ CamelFilterDriver *driver,
+ GError **error)
{
EAccount *account = NULL;
const CamelInternetAddress *iaddr;
@@ -463,8 +476,9 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
struct _camel_header_raw *xev, *header;
CamelMimeMessage *message;
gint i;
+ GError *local_error = NULL;
- message = camel_folder_get_message(queue, uid, ex);
+ message = camel_folder_get_message(queue, uid, error);
if (!message)
return;
@@ -529,12 +543,13 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
}
if (camel_address_length(recipients) > 0) {
- xport = camel_session_get_transport (session, transport_url ? transport_url : destination, ex);
- if (camel_exception_is_set(ex))
+ xport = camel_session_get_transport (
+ session, transport_url ? transport_url :
+ destination, error);
+ if (xport == NULL)
goto exit;
- camel_transport_send_to(xport, message, from, recipients, ex);
- if (camel_exception_is_set(ex))
+ if (!camel_transport_send_to (xport, message, from, recipients, error))
goto exit;
}
@@ -564,30 +579,36 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
mail_tool_restore_xevolution_headers (message, xev);
if (driver) {
- camel_filter_driver_filter_message (driver, message, info,
- NULL, NULL, NULL, "", ex);
+ camel_filter_driver_filter_message (
+ driver, message, info, NULL,
+ NULL, NULL, "", &local_error);
- if (camel_exception_is_set (ex)) {
- if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
+ if (local_error != NULL) {
+ if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
goto exit;
/* sending mail, filtering failed */
- g_string_append_printf (err, _("Failed to apply outgoing filters: %s"),
- camel_exception_get_description (ex));
+ g_string_append_printf (
+ err, _("Failed to apply outgoing filters: %s"),
+ local_error->message);
+
+ g_clear_error (&local_error);
}
}
- camel_exception_clear (ex);
-
if (xport == NULL
|| !( ((CamelService *)xport)->provider->flags & CAMEL_PROVIDER_DISABLE_SENT_FOLDER)) {
+ GError *local_error = NULL;
+
if (sent_folder_uri) {
- folder = mail_tool_uri_to_folder (sent_folder_uri, 0, ex);
- if (camel_exception_is_set(ex)) {
- g_string_append_printf (err, _("Failed to append to %s: %s\n"
- "Appending to local 'Sent' folder instead."),
- sent_folder_uri, camel_exception_get_description (ex));
- camel_exception_clear (ex);
+ folder = mail_tool_uri_to_folder (
+ sent_folder_uri, 0, &local_error);
+ if (folder == NULL) {
+ g_string_append_printf (
+ err, _("Failed to append to %s: %s\n"
+ "Appending to local 'Sent' folder instead."),
+ sent_folder_uri, local_error->message);
+ g_clear_error (&local_error);
}
}
@@ -596,11 +617,10 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
g_object_ref (folder);
}
- camel_folder_append_message (folder, message, info, NULL, ex);
- if (camel_exception_is_set (ex)) {
+ if (!camel_folder_append_message (folder, message, info, NULL, &local_error)) {
CamelFolder *sent_folder;
- if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
+ if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
goto exit;
sent_folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
@@ -614,38 +634,49 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
g_string_append_printf (
err, _("Failed to append to %s: %s\n"
"Appending to local 'Sent' folder instead."),
- description, camel_exception_get_description (ex));
+ description, local_error->message);
g_object_ref (sent_folder);
g_object_unref (folder);
folder = sent_folder;
- camel_exception_clear (ex);
- camel_folder_append_message (folder, message, info, NULL, ex);
+ g_clear_error (&local_error);
+ camel_folder_append_message (
+ folder, message, info, NULL, &local_error);
}
- if (camel_exception_is_set (ex)) {
- if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
+ if (local_error != NULL) {
+ if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
goto exit;
if (err->len)
g_string_append(err, "\n\n");
- g_string_append_printf (err, _("Failed to append to local 'Sent' folder: %s"),
- camel_exception_get_description (ex));
+ g_string_append_printf (
+ err, _("Failed to append to local 'Sent' folder: %s"),
+ local_error->message);
}
}
}
- if (!camel_exception_is_set(ex)) {
- camel_folder_set_message_flags (queue, uid, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, ~0);
- /* Sync it to disk, since if it crashes in between, we keep sending it again on next start. */
+
+ if (local_error == NULL) {
+ camel_folder_set_message_flags (
+ queue, uid, CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_SEEN, ~0);
+ /* Sync it to disk, since if it crashes in between,
+ * we keep sending it again on next start. */
camel_folder_sync (queue, FALSE, NULL);
}
if (err->len) {
/* set the culmulative exception report */
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, err->str);
+ g_set_error (
+ &local_error, CAMEL_ERROR,
+ CAMEL_ERROR_GENERIC, "%s", err->str);
}
exit:
+ if (local_error != NULL)
+ g_propagate_error (error, local_error);
+
if (folder) {
camel_folder_sync(folder, FALSE, NULL);
g_object_unref (folder);
@@ -704,8 +735,8 @@ send_queue_exec (struct _send_queue_msg *m)
{
CamelFolder *sent_folder;
GPtrArray *uids, *send_uids = NULL;
- CamelException ex;
gint i, j;
+ GError *local_error = NULL;
d(printf("sending queue\n"));
@@ -742,8 +773,6 @@ send_queue_exec (struct _send_queue_msg *m)
if (!m->cancel)
camel_operation_start (NULL, _("Sending message"));
- camel_exception_init (&ex);
-
/* NB: This code somewhat abuses the 'exception' stuff. Apart from fatal problems, it is also
used as a mechanism to accumualte warning messages and present them back to the user. */
@@ -754,21 +783,38 @@ send_queue_exec (struct _send_queue_msg *m)
if (!m->cancel)
camel_operation_progress (NULL, (i+1) * 100 / send_uids->len);
- mail_send_message (m, m->queue, send_uids->pdata[i], m->destination, m->driver, &ex);
- if (camel_exception_is_set (&ex)) {
- if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) {
+ mail_send_message (
+ m, m->queue, send_uids->pdata[i],
+ m->destination, m->driver, &local_error);
+ if (local_error != NULL) {
+ if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
/* merge exceptions into one */
- if (camel_exception_is_set (&m->base.ex))
- camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM, "%s\n\n%s", m->base.ex.desc, ex.desc);
- else
- camel_exception_xfer (&m->base.ex, &ex);
- camel_exception_clear (&ex);
+ if (m->base.error != NULL) {
+ gchar *old_message;
+
+ old_message = g_strdup (
+ m->base.error->message);
+ g_clear_error (&m->base.error);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR,
+ CAMEL_ERROR_GENERIC,
+ "%s\n\n%s", old_message,
+ local_error->message);
+ g_free (old_message);
+
+ g_clear_error (&local_error);
+ } else {
+ g_propagate_error (&m->base.error, local_error);
+ local_error = NULL;
+ }
/* keep track of the number of failures */
j++;
} else {
- /* transfer the USER_CANCEL exeption to the async op exception and then break */
- camel_exception_xfer (&m->base.ex, &ex);
+ /* transfer the USER_CANCEL error to the
+ * async op exception and then break */
+ g_propagate_error (&m->base.error, local_error);
+ local_error = NULL;
break;
}
}
@@ -778,7 +824,7 @@ send_queue_exec (struct _send_queue_msg *m)
if (j > 0)
report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Failed to send %d of %d messages"), j, send_uids->len);
- else if (m->base.ex.id == CAMEL_EXCEPTION_USER_CANCEL)
+ else if (g_error_matches (m->base.error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Canceled."));
else
report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete."));
@@ -791,15 +837,11 @@ send_queue_exec (struct _send_queue_msg *m)
camel_folder_free_uids (m->queue, uids);
g_ptr_array_free (send_uids, TRUE);
- if (j <= 0 && !camel_exception_is_set (&m->base.ex)) {
- camel_folder_sync (m->queue, TRUE, &ex);
- camel_exception_clear (&ex);
- }
+ if (j <= 0 && m->base.error == NULL)
+ camel_folder_sync (m->queue, TRUE, NULL);
- if (sent_folder) {
- camel_folder_sync (sent_folder, FALSE, &ex);
- camel_exception_clear (&ex);
- }
+ if (sent_folder)
+ camel_folder_sync (sent_folder, FALSE, NULL);
if (!m->cancel)
camel_operation_end (NULL);
@@ -900,14 +942,17 @@ static void
append_mail_exec (struct _append_msg *m)
{
camel_mime_message_set_date(m->message, CAMEL_MESSAGE_DATE_CURRENT, 0);
- camel_folder_append_message(m->folder, m->message, m->info, &m->appended_uid, &m->base.ex);
+ camel_folder_append_message(m->folder, m->message, m->info, &m->appended_uid, &m->base.error);
}
static void
append_mail_done (struct _append_msg *m)
{
if (m->done)
- m->done(m->folder, m->message, m->info, !camel_exception_is_set(&m->base.ex), m->appended_uid, m->data);
+ m->done (
+ m->folder, m->message,
+ m->info, m->base.error == NULL,
+ m->appended_uid, m->data);
}
static void
@@ -980,8 +1025,8 @@ transfer_messages_exec (struct _transfer_msg *m)
{
CamelFolder *dest;
- dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &m->base.ex);
- if (camel_exception_is_set (&m->base.ex))
+ dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &m->base.error);
+ if (dest == NULL)
return;
if (dest == m->source) {
@@ -993,7 +1038,7 @@ 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, &m->base.ex);
+ camel_folder_transfer_messages_to (m->source, m->uids, dest, NULL, m->delete, &m->base.error);
/* make sure all deleted messages are marked as seen */
@@ -1015,7 +1060,7 @@ static void
transfer_messages_done (struct _transfer_msg *m)
{
if (m->done)
- m->done (!camel_exception_is_set (&m->base.ex), m->data);
+ m->done (m->base.error == NULL, m->data);
}
static void
@@ -1089,18 +1134,18 @@ 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->store, NULL, flags, &m->base.ex);
+ m->info = camel_store_get_folder_info (m->store, NULL, flags, &m->base.error);
}
static void
get_folderinfo_done (struct _get_folderinfo_msg *m)
{
- if (!m->info && camel_exception_is_set (&m->base.ex)) {
+ if (!m->info && m->base.error != NULL) {
gchar *url;
url = camel_service_get_url (CAMEL_SERVICE (m->store));
w(g_warning ("Error getting folder info from store at %s: %s",
- url, camel_exception_get_description (&m->base.ex)));
+ url, m->base.error->message));
g_free (url);
}
@@ -1234,7 +1279,7 @@ get_folder_desc (struct _get_folder_msg *m)
static void
get_folder_exec (struct _get_folder_msg *m)
{
- m->folder = mail_tool_uri_to_folder (m->uri, m->flags, &m->base.ex);
+ m->folder = mail_tool_uri_to_folder (m->uri, m->flags, &m->base.error);
}
static void
@@ -1376,7 +1421,7 @@ get_store_exec (struct _get_store_msg *m)
m->store = (CamelStore *) camel_session_get_service (session, m->uri,
CAMEL_PROVIDER_STORE,
- &m->base.ex);
+ &m->base.error);
}
static void
@@ -1430,7 +1475,7 @@ struct _remove_folder_msg {
CamelFolder *folder;
gboolean removed;
- void (*done) (CamelFolder *folder, gboolean removed, CamelException *ex, gpointer data);
+ void (*done) (CamelFolder *folder, gboolean removed, GError **error, gpointer data);
gpointer data;
};
@@ -1440,22 +1485,22 @@ remove_folder_desc (struct _remove_folder_msg *m)
return g_strdup_printf (_("Removing folder '%s'"), camel_folder_get_full_name (m->folder));
}
-static void
-remove_folder_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
+static gboolean
+remove_folder_rec (CamelStore *store, CamelFolderInfo *fi, GError **error)
{
while (fi) {
CamelFolder *folder;
if (fi->child) {
- remove_folder_rec (store, fi->child, ex);
- if (camel_exception_is_set (ex))
- return;
+ if (!remove_folder_rec (store, fi->child, error))
+ return FALSE;
}
d(printf ("deleting folder '%s'\n", fi->full_name));
- if (!(folder = camel_store_get_folder (store, fi->full_name, 0, ex)))
- return;
+ folder = camel_store_get_folder (store, fi->full_name, 0, error);
+ if (folder == NULL)
+ return FALSE;
if (!CAMEL_IS_VEE_FOLDER (folder)) {
GPtrArray *uids = camel_folder_get_uids (folder);
@@ -1477,12 +1522,13 @@ remove_folder_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
camel_store_unsubscribe_folder (store, fi->full_name, NULL);
/* Then delete the folder from the store */
- camel_store_delete_folder (store, fi->full_name, ex);
- if (camel_exception_is_set (ex))
- return;
+ if (!camel_store_delete_folder (store, fi->full_name, error))
+ return FALSE;
fi = fi->next;
}
+
+ return TRUE;
}
static void
@@ -1497,21 +1543,24 @@ 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 (parent_store, full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &m->base.ex);
- if (camel_exception_is_set (&m->base.ex))
+ fi = camel_store_get_folder_info (
+ parent_store, full_name,
+ CAMEL_STORE_FOLDER_INFO_RECURSIVE |
+ CAMEL_STORE_FOLDER_INFO_FAST |
+ CAMEL_STORE_FOLDER_INFO_SUBSCRIBED,
+ &m->base.error);
+ if (fi == NULL)
return;
- remove_folder_rec (parent_store, fi, &m->base.ex);
+ m->removed = remove_folder_rec (parent_store, fi, &m->base.error);
camel_store_free_folder_info (parent_store, fi);
-
- m->removed = !camel_exception_is_set (&m->base.ex);
}
static void
remove_folder_done (struct _remove_folder_msg *m)
{
if (m->done)
- m->done (m->folder, m->removed, &m->base.ex, m->data);
+ m->done (m->folder, m->removed, &m->base.error, m->data);
}
static void
@@ -1529,7 +1578,7 @@ static MailMsgInfo remove_folder_info = {
};
void
-mail_remove_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gboolean removed, CamelException *ex, gpointer data), gpointer data)
+mail_remove_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gboolean removed, GError **error, gpointer data), gpointer data)
{
struct _remove_folder_msg *m;
@@ -1564,7 +1613,7 @@ sync_folder_desc (struct _sync_folder_msg *m)
static void
sync_folder_exec (struct _sync_folder_msg *m)
{
- camel_folder_sync(m->folder, FALSE, &m->base.ex);
+ camel_folder_sync(m->folder, FALSE, &m->base.error);
}
static void
@@ -1631,7 +1680,7 @@ sync_store_desc (struct _sync_store_msg *m)
static void
sync_store_exec (struct _sync_store_msg *m)
{
- camel_store_sync(m->store, m->expunge, &m->base.ex);
+ camel_store_sync(m->store, m->expunge, &m->base.error);
}
static void
@@ -1681,10 +1730,10 @@ refresh_folder_desc (struct _sync_folder_msg *m)
static void
refresh_folder_exec (struct _sync_folder_msg *m)
{
- /* camel_folder_sync (m->folder, FALSE, &m->base.ex); */
+ /* camel_folder_sync (m->folder, FALSE, &m->base.error); */
- /* if (!camel_exception_is_set (&m->base.ex)) */
- camel_folder_refresh_info(m->folder, &m->base.ex);
+ /* if (!camel_exception_is_set (&m->base.error)) */
+ camel_folder_refresh_info(m->folder, &m->base.error);
}
/* we just use the sync stuff where we can, since it would be the same */
@@ -1721,7 +1770,7 @@ expunge_folder_desc (struct _sync_folder_msg *m)
static void
expunge_folder_exec (struct _sync_folder_msg *m)
{
- camel_folder_expunge(m->folder, &m->base.ex);
+ camel_folder_expunge(m->folder, &m->base.error);
}
/* we just use the sync stuff where we can, since it would be the same */
@@ -1772,16 +1821,16 @@ empty_trash_exec (struct _empty_trash_msg *m)
gchar *uri;
if (m->account) {
- trash = mail_tool_get_trash (m->account->source->url, FALSE, &m->base.ex);
+ trash = mail_tool_get_trash (m->account->source->url, FALSE, &m->base.error);
} else {
data_dir = mail_session_get_data_dir ();
uri = g_strdup_printf ("mbox:%s/local", data_dir);
- trash = mail_tool_get_trash (uri, TRUE, &m->base.ex);
+ trash = mail_tool_get_trash (uri, TRUE, &m->base.error);
g_free (uri);
}
if (trash) {
- camel_folder_expunge (trash, &m->base.ex);
+ camel_folder_expunge (trash, &m->base.error);
g_object_unref (trash);
}
}
@@ -1848,7 +1897,7 @@ get_message_exec (struct _get_message_msg *m)
if (m->base.cancel && camel_operation_cancel_check (m->base.cancel))
m->message = NULL;
else
- m->message = camel_folder_get_message (m->folder, m->uid, &m->base.ex);
+ m->message = camel_folder_get_message (m->folder, m->uid, &m->base.error);
}
static void
@@ -1899,14 +1948,14 @@ mail_get_message(CamelFolder *folder, const gchar *uid, void (*done) (CamelFolde
return id;
}
-typedef void (*get_done)(CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, CamelException *);
+typedef void (*get_done)(CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, GError **error);
static void
get_messagex_done (struct _get_message_msg *m)
{
if (m->done && !camel_operation_cancel_check (m->cancel)) {
get_done done = (get_done)m->done;
- done(m->folder, m->uid, m->message, m->data, &m->base.ex);
+ done(m->folder, m->uid, m->message, m->data, &m->base.error);
}
}
@@ -1921,8 +1970,15 @@ static MailMsgInfo get_messagex_info = {
/* This is temporary, to avoid having to rewrite everything that uses
mail_get_message; it adds an exception argument to the callback */
gint
-mail_get_messagex(CamelFolder *folder, const gchar *uid, void (*done) (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, CamelException *),
- gpointer data, MailMsgDispatchFunc dispatch)
+mail_get_messagex (CamelFolder *folder,
+ const gchar *uid,
+ void (*done) (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *msg,
+ gpointer data,
+ GError **error),
+ gpointer data,
+ MailMsgDispatchFunc dispatch)
{
struct _get_message_msg *m;
gint id;
@@ -1971,7 +2027,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(m->folder, m->uids->pdata[i], &m->base.ex);
+ message = camel_folder_get_message(m->folder, m->uids->pdata[i], &m->base.error);
camel_operation_progress(m->base.cancel, pc);
if (message == NULL)
break;
@@ -2111,7 +2167,7 @@ save_messages_exec (struct _save_messages_msg *m)
CamelMimeMessage *message;
gint pc = ((i+1) * 100) / m->uids->len;
- message = camel_folder_get_message(m->folder, m->uids->pdata[i], &m->base.ex);
+ message = camel_folder_get_message(m->folder, m->uids->pdata[i], &m->base.error);
camel_operation_progress(m->base.cancel, pc);
if (message == NULL)
break;
@@ -2120,14 +2176,21 @@ 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) == -1
- || camel_stream_flush(stream) == -1
- || camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, (CamelStream *)filtered_stream) == -1
- || camel_stream_flush((CamelStream *)filtered_stream) == -1
- || camel_stream_write_string(stream, "\n") == -1
- || camel_stream_flush(stream) == -1) {
- camel_exception_setv(&m->base.ex, CAMEL_EXCEPTION_SYSTEM,
- _("Error saving messages to: %s:\n %s"), m->path, g_strerror(errno));
+ 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 (
+ (CamelDataWrapper *) message,
+ (CamelStream *)filtered_stream, &m->base.error) == -1
+ || camel_stream_flush (
+ (CamelStream *)filtered_stream, &m->base.error) == -1
+ || camel_stream_write_string (
+ stream, "\n", &m->base.error) == -1
+ || camel_stream_flush(stream, &m->base.error) == -1) {
+ g_prefix_error (
+ &m->base.error,
+ _("Error saving messages to: %s:\n"),
+ m->path);
g_free(from);
g_object_unref ((CamelObject *)message);
break;
@@ -2216,17 +2279,21 @@ save_part_exec (struct _save_part_msg *m)
if (!m->readonly) {
if (!(stream = camel_stream_vfs_new_with_uri (path, CAMEL_STREAM_VFS_CREATE))) {
- camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot create output file: %s:\n %s"),
- path, g_strerror (errno));
+ g_set_error (
+ &m->base.error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Cannot create output file: %s:\n %s"),
+ path, g_strerror (errno));
if (path != m->path)
g_free (path);
return;
}
} else if (!(stream = camel_stream_vfs_new_with_uri (path, CAMEL_STREAM_VFS_CREATE))) {
- camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot create output file: %s:\n %s"),
- path, g_strerror (errno));
+ g_set_error (
+ &m->base.error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Cannot create output file: %s:\n %s"),
+ path, g_strerror (errno));
if (path != m->path)
g_free (path);
return;
@@ -2237,11 +2304,10 @@ 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) == -1
- || camel_stream_flush (stream) == -1)
- camel_exception_setv (&m->base.ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not write data: %s"),
- g_strerror (errno));
+ if (camel_data_wrapper_decode_to_stream (
+ content, stream, &m->base.error) == -1
+ || camel_stream_flush (stream, &m->base.error) == -1)
+ g_prefix_error (&m->base.error, _("Could not write data: "));
g_object_unref (stream);
}
@@ -2250,7 +2316,7 @@ static void
save_part_done (struct _save_part_msg *m)
{
if (m->done)
- m->done (m->part, m->path, !camel_exception_is_set (&m->base.ex), m->data);
+ m->done (m->part, m->path, m->base.error == NULL, m->data);
}
static void
@@ -2307,14 +2373,14 @@ prep_offline_exec (struct _prep_offline_msg *m)
if (m->cancel)
camel_operation_register(m->cancel);
- folder = mail_tool_uri_to_folder(m->uri, 0, &m->base.ex);
+ folder = mail_tool_uri_to_folder(m->uri, 0, &m->base.error);
if (folder) {
if (CAMEL_IS_DISCO_FOLDER(folder)) {
camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder,
"(match-all)",
- &m->base.ex);
+ &m->base.error);
} else if (CAMEL_IS_OFFLINE_FOLDER (folder)) {
- camel_offline_folder_downsync ((CamelOfflineFolder *) folder, "(match-all)", &m->base.ex);
+ camel_offline_folder_downsync ((CamelOfflineFolder *) folder, "(match-all)", &m->base.error);
}
/* prepare_for_offline should do this? */
/* of course it should all be atomic, but ... */
@@ -2398,31 +2464,31 @@ set_offline_exec (struct _set_offline_msg *m)
if (!m->offline) {
camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store),
CAMEL_DISCO_STORE_ONLINE,
- &m->base.ex);
+ &m->base.error);
return;
} else if (camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (m->store))) {
camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store),
CAMEL_DISCO_STORE_OFFLINE,
- &m->base.ex);
+ &m->base.error);
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.ex);
+ &m->base.error);
return;
} else {
camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (m->store),
CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL,
- &m->base.ex);
+ &m->base.error);
return;
}
}
if (m->offline)
camel_service_disconnect (CAMEL_SERVICE (m->store),
- TRUE, &m->base.ex);
+ TRUE, &m->base.error);
}
static void
@@ -2492,10 +2558,10 @@ prepare_offline_exec (struct _set_offline_msg *m)
{
if (CAMEL_IS_DISCO_STORE (m->store)) {
camel_disco_store_prepare_for_offline (CAMEL_DISCO_STORE (m->store),
- &m->base.ex);
+ &m->base.error);
} else if (CAMEL_IS_OFFLINE_STORE (m->store)) {
camel_offline_store_prepare_for_offline (CAMEL_OFFLINE_STORE (m->store),
- &m->base.ex);
+ &m->base.error);
}
}
@@ -2575,13 +2641,13 @@ check_service_exec (struct _check_msg *m)
{
CamelService *service;
- service = camel_session_get_service(session, m->url, m->type, &m->base.ex);
+ service = camel_session_get_service(session, m->url, m->type, &m->base.error);
if (!service) {
camel_operation_unregister(m->base.cancel);
return;
}
- m->authtypes = camel_service_query_auth_types(service, &m->base.ex);
+ m->authtypes = camel_service_query_auth_types(service, &m->base.error);
g_object_unref (service);
}
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index 506de4ce80..7a3f045b63 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -51,7 +51,7 @@ gint mail_get_message (CamelFolder *folder, const gchar *uid,
gint
mail_get_messagex(CamelFolder *folder, const gchar *uid,
- void (*done) (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, CamelException *),
+ void (*done) (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data, GError **error),
gpointer data, MailMsgDispatchFunc dispatch);
/* get several messages */
@@ -105,7 +105,7 @@ gint mail_get_folderinfo (CamelStore *store, CamelOperation *op,
/* remove an existing folder */
void mail_remove_folder (CamelFolder *folder,
- void (*done) (CamelFolder *folder, gboolean removed, CamelException *ex, gpointer data),
+ void (*done) (CamelFolder *folder, gboolean removed, GError **error, gpointer data),
gpointer data);
/* transfer (copy/move) a folder */
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 149b11d4e8..651692530a 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -122,7 +122,7 @@ struct _send_info {
struct _send_data *data;
};
-static CamelFolder *receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelException *ex);
+static CamelFolder *receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, GError **error);
static struct _send_data *send_data = NULL;
static GtkWidget *send_recv_dialog = NULL;
@@ -372,16 +372,13 @@ static send_info_t
get_receive_type(const gchar *url)
{
CamelProvider *provider;
- CamelException ex;
/* HACK: since mbox is ALSO used for native evolution trees now, we need to
fudge this to treat it as a special 'movemail' source */
if (!strncmp(url, "mbox:", 5))
return SEND_RECEIVE;
- camel_exception_init (&ex);
- provider = camel_provider_get(url, &ex);
- camel_exception_clear (&ex);
+ provider = camel_provider_get(url, NULL);
if (!provider)
return SEND_INVALID;
@@ -792,7 +789,7 @@ receive_done (const gchar *uri, gpointer data)
This can also be used to hook into which folders are being updated, and occasionally
let them refresh */
static CamelFolder *
-receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelException *ex)
+receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, GError **error)
{
struct _send_info *info = data;
CamelFolder *folder;
@@ -806,7 +803,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE
g_object_ref (oldinfo->folder);
return oldinfo->folder;
}
- folder = mail_tool_uri_to_folder (uri, 0, ex);
+ folder = mail_tool_uri_to_folder (uri, 0, error);
if (!folder)
return NULL;
@@ -838,12 +835,8 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE
static void
get_folders (CamelStore *store, GPtrArray *folders, CamelFolderInfo *info)
{
- CamelException ex;
-
- camel_exception_init (&ex);
-
while (info) {
- if (camel_store_can_refresh_folder (store, info, &ex)) {
+ if (camel_store_can_refresh_folder (store, info, NULL)) {
CamelURL *url = camel_url_new (info->uri, NULL);
if (url && (!camel_url_get_param (url, "noselect") || !g_str_equal (camel_url_get_param (url, "noselect"), "yes")))
@@ -852,7 +845,6 @@ get_folders (CamelStore *store, GPtrArray *folders, CamelFolderInfo *info)
if (url)
camel_url_free (url);
}
- camel_exception_clear (&ex);
get_folders (store, folders, info->child);
info = info->next;
@@ -879,21 +871,19 @@ refresh_folders_exec (struct _refresh_folders_msg *m)
{
gint i;
CamelFolder *folder;
- CamelException ex = CAMEL_EXCEPTION_INITIALISER;
+ GError *local_error = NULL;
get_folders (m->store, m->folders, m->finfo);
for (i=0;i<m->folders->len;i++) {
- folder = mail_tool_uri_to_folder(m->folders->pdata[i], 0, &ex);
+ folder = mail_tool_uri_to_folder(m->folders->pdata[i], 0, &local_error);
if (folder) {
- camel_folder_sync (folder, FALSE, &ex);
- camel_exception_clear(&ex);
- camel_folder_refresh_info(folder, &ex);
- camel_exception_clear(&ex);
+ camel_folder_sync (folder, FALSE, NULL);
+ camel_folder_refresh_info(folder, NULL);
g_object_unref (folder);
- } else if (camel_exception_is_set(&ex)) {
- g_warning ("Failed to refresh folders: %s", camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
+ } else if (local_error != NULL) {
+ g_warning ("Failed to refresh folders: %s", local_error->message);
+ g_clear_error (&local_error);
}
if (camel_operation_cancel_check(m->info->cancel))
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 8714823f7a..e2da6389f1 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -89,16 +89,16 @@ struct _MailSessionClass {
static gchar *mail_data_dir;
static gchar *mail_config_dir;
-static gchar *get_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *prompt, const gchar *item, guint32 flags, CamelException *ex);
-static gboolean forget_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *item, CamelException *ex);
+static gchar *get_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *prompt, const gchar *item, guint32 flags, GError **error);
+static gboolean forget_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *item, GError **error);
static gboolean alert_user(CamelSession *session, CamelSessionAlertType type, const gchar *prompt, gboolean cancel);
-static CamelFilterDriver *get_filter_driver(CamelSession *session, const gchar *type, CamelException *ex);
+static CamelFilterDriver *get_filter_driver(CamelSession *session, const gchar *type, GError **error);
static gboolean lookup_addressbook(CamelSession *session, const gchar *name);
static void ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc);
static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, guint size);
static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m);
-static void ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, CamelException *ex);
+static gboolean ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, GError **error);
GType mail_session_get_type (void);
@@ -175,8 +175,13 @@ make_key (CamelService *service, const gchar *item)
/* ********************************************************************** */
static gchar *
-get_password (CamelSession *session, CamelService *service, const gchar *domain,
- const gchar *prompt, const gchar *item, guint32 flags, CamelException *ex)
+get_password (CamelSession *session,
+ CamelService *service,
+ const gchar *domain,
+ const gchar *prompt,
+ const gchar *item,
+ guint32 flags,
+ GError **error)
{
gchar *url;
gchar *ret = NULL;
@@ -266,7 +271,10 @@ get_password (CamelSession *session, CamelService *service, const gchar *domain,
g_free(url);
if (ret == NULL)
- camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled operation."));
+ g_set_error (
+ error, G_IO_ERROR,
+ G_IO_ERROR_CANCELLED,
+ _("User canceled operation."));
return ret;
}
@@ -276,7 +284,7 @@ forget_password (CamelSession *session,
CamelService *service,
const gchar *domain,
const gchar *item,
- CamelException *ex)
+ GError **error)
{
gchar *key = make_key (service, item);
@@ -466,9 +474,12 @@ alert_user(CamelSession *session, CamelSessionAlertType type, const gchar *promp
}
static CamelFolder *
-get_folder (CamelFilterDriver *d, const gchar *uri, gpointer data, CamelException *ex)
+get_folder (CamelFilterDriver *d,
+ const gchar *uri,
+ gpointer data,
+ GError **error)
{
- return mail_tool_uri_to_folder(uri, 0, ex);
+ return mail_tool_uri_to_folder (uri, 0, error);
}
static void
@@ -517,7 +528,7 @@ session_system_beep (CamelFilterDriver *driver, gpointer user_data)
}
static CamelFilterDriver *
-main_get_filter_driver (CamelSession *session, const gchar *type, CamelException *ex)
+main_get_filter_driver (CamelSession *session, const gchar *type, GError **error)
{
CamelFilterDriver *driver;
EFilterRule *rule = NULL;
@@ -599,10 +610,11 @@ main_get_filter_driver (CamelSession *session, const gchar *type, CamelException
}
static CamelFilterDriver *
-get_filter_driver (CamelSession *session, const gchar *type, CamelException *ex)
+get_filter_driver (CamelSession *session, const gchar *type, GError **error)
{
- return (CamelFilterDriver *) mail_call_main (MAIL_CALL_p_ppp, (MailMainFunc) main_get_filter_driver,
- session, type, ex);
+ return (CamelFilterDriver *) mail_call_main (
+ MAIL_CALL_p_ppp, (MailMainFunc) main_get_filter_driver,
+ session, type, error);
}
/* TODO: This is very temporary, until we have a better way to do the progress reporting,
@@ -664,8 +676,12 @@ forward_to_flush_outbox_cb (gpointer data)
}
static void
-ms_forward_to_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info,
- gint queued, const gchar *appended_uid, gpointer data)
+ms_forward_to_cb (CamelFolder *folder,
+ CamelMimeMessage *msg,
+ CamelMessageInfo *info,
+ gint queued,
+ const gchar *appended_uid,
+ gpointer data)
{
static guint preparing_flush = 0;
@@ -681,8 +697,12 @@ ms_forward_to_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *
}
}
-static void
-ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, CamelException *ex)
+static gboolean
+ms_forward_to (CamelSession *session,
+ CamelFolder *folder,
+ CamelMimeMessage *message,
+ const gchar *address,
+ GError **error)
{
EAccount *account;
CamelMimeMessage *forward;
@@ -693,28 +713,34 @@ ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *mes
struct _camel_header_raw *xev;
gchar *subject;
- g_return_if_fail (folder != NULL);
- g_return_if_fail (message != NULL);
- g_return_if_fail (address != NULL);
+ g_return_val_if_fail (folder != NULL, FALSE);
+ g_return_val_if_fail (message != NULL, FALSE);
+ g_return_val_if_fail (address != NULL, FALSE);
if (!*address) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("No destination address provided, forward of the message has been cancelled."));
- return;
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("No destination address provided, forward "
+ "of the message has been cancelled."));
+ return FALSE;
}
account = em_utils_guess_account_with_recipients (message, folder);
if (!account) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("No account found to use, forward of the message has been cancelled."));
- return;
+ g_set_error (
+ error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("No account found to use, forward of the "
+ "message has been cancelled."));
+ return FALSE;
}
forward = camel_mime_message_new ();
/* 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);
- camel_seekable_stream_seek (CAMEL_SEEKABLE_STREAM (mem), 0, CAMEL_STREAM_SET);
- camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)forward, mem);
+ camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, mem, NULL);
+ camel_seekable_stream_seek (CAMEL_SEEKABLE_STREAM (mem), 0, CAMEL_STREAM_SET, NULL);
+ camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)forward, mem, NULL);
g_object_unref (mem);
/* clear previous recipients */
@@ -758,6 +784,8 @@ ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *mes
out_folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
mail_append_mail (out_folder, forward, info, ms_forward_to_cb, NULL);
+
+ return TRUE;
}
gchar *
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index e9470c9a63..22dfb54e22 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -44,16 +44,16 @@
/* **************************************** */
CamelFolder *
-mail_tool_get_inbox (const gchar *url, CamelException *ex)
+mail_tool_get_inbox (const gchar *url, GError **error)
{
CamelStore *store;
CamelFolder *folder;
- store = camel_session_get_store (session, url, ex);
+ store = camel_session_get_store (session, url, error);
if (!store)
return NULL;
- folder = camel_store_get_inbox (store, ex);
+ folder = camel_store_get_inbox (store, error);
g_object_unref (store);
return folder;
@@ -74,21 +74,22 @@ is_local_provider (CamelStore *store)
}
CamelFolder *
-mail_tool_get_trash (const gchar *url, gint connect, CamelException *ex)
+mail_tool_get_trash (const gchar *url, gint connect, GError **error)
{
CamelStore *store;
CamelFolder *trash;
if (connect)
- store = camel_session_get_store (session, url, ex);
+ store = camel_session_get_store (session, url, error);
else
- store = (CamelStore *) camel_session_get_service (session, url, CAMEL_PROVIDER_STORE, ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, url, CAMEL_PROVIDER_STORE, error);
if (!store)
return NULL;
if (connect || ((CamelService *) store)->status == CAMEL_SERVICE_CONNECTED || is_local_provider (store))
- trash = camel_store_get_trash (store, ex);
+ trash = camel_store_get_trash (store, error);
else
trash = NULL;
@@ -100,7 +101,7 @@ mail_tool_get_trash (const gchar *url, gint connect, CamelException *ex)
#ifndef G_OS_WIN32
static gchar *
-mail_tool_get_local_movemail_path (const guchar *uri, CamelException *ex)
+mail_tool_get_local_movemail_path (const guchar *uri, GError **error)
{
guchar *safe_uri, *c;
const gchar *data_dir;
@@ -116,8 +117,11 @@ mail_tool_get_local_movemail_path (const guchar *uri, CamelException *ex)
path = g_build_filename (data_dir, "spool", NULL);
if (g_stat(path, &st) == -1 && g_mkdir_with_parents(path, 0700) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create spool directory '%s': %s"),
- path, g_strerror(errno));
+ g_set_error (
+ error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Could not create spool directory '%s': %s"),
+ path, g_strerror(errno));
g_free(path);
return NULL;
}
@@ -132,33 +136,37 @@ mail_tool_get_local_movemail_path (const guchar *uri, CamelException *ex)
#endif
gchar *
-mail_tool_do_movemail (const gchar *source_url, CamelException *ex)
+mail_tool_do_movemail (const gchar *source_url, GError **error)
{
#ifndef G_OS_WIN32
gchar *dest_path;
struct stat sb;
CamelURL *uri;
+ gboolean success;
- uri = camel_url_new(source_url, ex);
+ uri = camel_url_new(source_url, error);
if (uri == NULL)
return NULL;
if (strcmp(uri->protocol, "mbox") != 0) {
/* This is really only an internal error anyway */
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("Trying to movemail a non-mbox source '%s'"),
- source_url);
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_URL_INVALID,
+ _("Trying to movemail a non-mbox source '%s'"),
+ source_url);
camel_url_free(uri);
return NULL;
}
/* Set up our destination. */
- dest_path = mail_tool_get_local_movemail_path ((guchar *)source_url, ex);
+ dest_path = mail_tool_get_local_movemail_path (
+ (guchar *) source_url, error);
if (dest_path == NULL)
return NULL;
/* Movemail from source (source_url) to dest_path */
- camel_movemail (uri->path, dest_path, ex);
+ success = camel_movemail (uri->path, dest_path, error);
camel_url_free(uri);
if (g_stat (dest_path, &sb) < 0 || sb.st_size == 0) {
@@ -167,7 +175,7 @@ mail_tool_do_movemail (const gchar *source_url, CamelException *ex)
return NULL;
}
- if (camel_exception_is_set (ex)) {
+ if (!success) {
g_free (dest_path);
return NULL;
}
@@ -275,7 +283,7 @@ mail_tool_make_message_attachment (CamelMimeMessage *message)
}
CamelFolder *
-mail_tool_uri_to_folder (const gchar *uri, guint32 flags, CamelException *ex)
+mail_tool_uri_to_folder (const gchar *uri, guint32 flags, GError **error)
{
CamelURL *url;
CamelStore *store = NULL;
@@ -294,19 +302,23 @@ mail_tool_uri_to_folder (const gchar *uri, guint32 flags, CamelException *ex)
/* FIXME?: the filter:get_folder callback should do this itself? */
curi = em_uri_to_camel(uri);
if (uri == NULL) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Invalid folder: '%s'"), uri);
+ g_set_error (
+ error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ _("Invalid folder: '%s'"), uri);
return NULL;
}
uri = curi;
}
- url = camel_url_new (uri + offset, ex);
+ url = camel_url_new (uri + offset, error);
if (!url) {
g_free(curi);
return NULL;
}
- store = (CamelStore *)camel_session_get_service(session, uri+offset, CAMEL_PROVIDER_STORE, ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri + offset, CAMEL_PROVIDER_STORE, error);
if (store) {
const gchar *name;
@@ -323,11 +335,11 @@ mail_tool_uri_to_folder (const gchar *uri, guint32 flags, CamelException *ex)
if (offset) {
if (offset == 7)
- folder = camel_store_get_trash (store, ex);
+ folder = camel_store_get_trash (store, error);
else if (offset == 6)
- folder = camel_store_get_junk (store, ex);
+ folder = camel_store_get_junk (store, error);
} else
- folder = camel_store_get_folder (store, name, flags, ex);
+ folder = camel_store_get_folder (store, name, flags, error);
g_object_unref (store);
}
diff --git a/mail/mail-tools.h b/mail/mail-tools.h
index 544c3601b6..01c800fbd9 100644
--- a/mail/mail-tools.h
+++ b/mail/mail-tools.h
@@ -27,14 +27,14 @@
#include <camel/camel.h>
/* Get the "inbox" for a url (uses global session) */
-CamelFolder *mail_tool_get_inbox (const gchar *url, CamelException *ex);
+CamelFolder *mail_tool_get_inbox (const gchar *url, GError **error);
/* Get the "trash" for a url (uses global session) */
-CamelFolder *mail_tool_get_trash (const gchar *url, gint connect, CamelException *ex);
+CamelFolder *mail_tool_get_trash (const gchar *url, gint connect, GError **error);
/* Does a camel_movemail into the local movemail folder
* and returns the path to the new movemail folder that was created. which shoudl be freed later */
-gchar *mail_tool_do_movemail (const gchar *source_url, CamelException *ex);
+gchar *mail_tool_do_movemail (const gchar *source_url, GError **error);
struct _camel_header_raw *mail_tool_remove_xevolution_headers (CamelMimeMessage *message);
void mail_tool_restore_xevolution_headers (CamelMimeMessage *message, struct _camel_header_raw *);
@@ -46,7 +46,7 @@ gchar *mail_tool_generate_forward_subject (CamelMimeMessage *msg);
CamelMimePart *mail_tool_make_message_attachment (CamelMimeMessage *message);
/* Parse the ui into a real CamelFolder any way we know how. */
-CamelFolder *mail_tool_uri_to_folder (const gchar *uri, guint32 flags, CamelException *ex);
+CamelFolder *mail_tool_uri_to_folder (const gchar *uri, guint32 flags, GError **error);
GHashTable *mail_lookup_url_table (CamelMimeMessage *mime_message);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 3e9199aebe..23fd566043 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -98,13 +98,9 @@ vfolder_setup_exec (struct _setup_msg *m)
while (l && !vfolder_shutdown) {
d(printf(" Adding uri: %s\n", (gchar *)l->data));
- folder = mail_tool_uri_to_folder (l->data, 0, &m->base.ex);
- if (folder) {
- list = g_list_append(list, folder);
- } else {
- g_warning("Could not open vfolder source: %s", (gchar *)l->data);
- camel_exception_clear(&m->base.ex);
- }
+ folder = mail_tool_uri_to_folder (l->data, 0, NULL);
+ if (folder != NULL)
+ list = g_list_append (list, folder);
l = l->next;
}
@@ -258,7 +254,7 @@ vfolder_adduri_exec (struct _adduri_msg *m)
}
if (folder == NULL)
- folder = mail_tool_uri_to_folder (m->uri, 0, &m->base.ex);
+ folder = mail_tool_uri_to_folder (m->uri, 0, &m->base.error);
if (folder != NULL) {
l = m->folders;
@@ -1014,7 +1010,6 @@ vfolder_load_storage(void)
EFilterRule *rule;
gchar *xmlfile;
GConfClient *gconf;
- CamelException ex;
G_LOCK (vfolder_hash);
@@ -1028,19 +1023,15 @@ vfolder_load_storage(void)
G_UNLOCK (vfolder_hash);
- camel_exception_init (&ex);
-
/* first, create the vfolder store, and set it up */
data_dir = mail_session_get_data_dir ();
storeuri = g_strdup_printf("vfolder:%s/vfolder", data_dir);
- vfolder_store = camel_session_get_store(session, storeuri, &ex);
+ vfolder_store = camel_session_get_store(session, storeuri, NULL);
if (vfolder_store == NULL) {
g_warning("Cannot open vfolder store - no vfolders available");
return;
}
- camel_exception_clear (&ex);
-
g_signal_connect (
vfolder_store, "folder-deleted",
G_CALLBACK (store_folder_deleted_cb), NULL);
diff --git a/mail/message-list.c b/mail/message-list.c
index ecb6301773..fdf275ba6c 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1456,14 +1456,15 @@ get_trimmed_subject (CamelMessageInfo *info)
}
static gpointer
-ml_tree_value_at_ex (ETreeModel *etm, ETreePath path, gint col, CamelMessageInfo *msg_info, MessageList *message_list)
+ml_tree_value_at_ex (ETreeModel *etm,
+ ETreePath path,
+ gint col,
+ CamelMessageInfo *msg_info,
+ MessageList *message_list)
{
- CamelException ex;
const gchar *str;
guint32 flags;
- camel_exception_init (&ex);
-
g_return_val_if_fail (msg_info != NULL, NULL);
switch (col) {
@@ -1644,17 +1645,16 @@ ml_tree_value_at_ex (ETreeModel *etm, ETreePath path, gint col, CamelMessageInfo
account = mail_config_get_account_by_source_url (url);
if (account) {
- curl = camel_url_new (url, &ex);
+ curl = camel_url_new (url, NULL);
location = g_strconcat (account->name, ":", curl->path, NULL);
} else {
/* Local account */
euri = em_uri_from_camel(url);
- curl = camel_url_new (euri, &ex);
+ curl = camel_url_new (euri, NULL);
if (curl->host && !strcmp(curl->host, "local") && curl->user && !strcmp(curl->user, "local"))
location = g_strconcat (_("On This Computer"), ":",curl->path, NULL);
}
- camel_exception_clear (&ex);
camel_url_free (curl);
g_free (url);
g_free (euri);
@@ -2160,7 +2160,10 @@ ml_drop_async_exec (struct _drop_msg *m)
{
switch (m->info) {
case DND_X_UID_LIST:
- em_utils_selection_get_uidlist(m->selection, m->folder, m->action == GDK_ACTION_MOVE, &m->base.ex);
+ em_utils_selection_get_uidlist (
+ m->selection, m->folder,
+ m->action == GDK_ACTION_MOVE,
+ &m->base.error);
break;
case DND_MESSAGE_RFC822:
em_utils_selection_get_message(m->selection, m->folder);
@@ -2181,7 +2184,7 @@ ml_drop_async_done (struct _drop_msg *m)
success = FALSE;
delete = FALSE;
} else {
- success = !camel_exception_is_set (&m->base.ex);
+ success = (m->base.error == NULL);
delete = success && m->move && !m->moved;
}
@@ -3684,15 +3687,12 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
gboolean hide_deleted;
GConfClient *gconf;
CamelStore *folder_store;
- CamelException ex;
g_return_if_fail (IS_MESSAGE_LIST (message_list));
if (message_list->folder == folder)
return;
- camel_exception_init (&ex);
-
if (message_list->seen_id) {
g_source_remove (message_list->seen_id);
message_list->seen_id = 0;
@@ -4392,7 +4392,8 @@ regen_list_exec (struct _regen_list_msg *m)
} else {
gboolean store_has_vjunk = folder_store_supports_vjunk_folder (m->folder);
- searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex);
+ searchuids = uids = camel_folder_search_by_expression (
+ m->folder, expr, &m->base.error);
/* If m->changes is not NULL, then it means we are called from folder_changed event,
thus we will keep the selected message to be sure it doesn't disappear because
it no longer belong to our search filter. */
@@ -4430,7 +4431,7 @@ regen_list_exec (struct _regen_list_msg *m)
}
}
- if (camel_exception_is_set (&m->base.ex))
+ if (m->base.error != NULL)
return;
e_profile_event_emit("list.threaduids", m->folder->full_name, 0);
@@ -4446,17 +4447,11 @@ regen_list_exec (struct _regen_list_msg *m)
else
m->tree = camel_folder_thread_messages_new (m->folder, uids, m->thread_subject);
} else {
- CamelException ex;
-
camel_folder_sort_uids (m->ml->folder, uids);
m->summary = g_ptr_array_new ();
- camel_exception_init (&ex);
- camel_folder_summary_prepare_fetch_all (m->folder->summary, &ex);
- if (camel_exception_is_set (&ex)) {
- g_warning ("Exception while reloading: %s\n", camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- }
+ camel_folder_summary_prepare_fetch_all (
+ m->folder->summary, NULL);
for (i = 0; i < uids->len; i++) {
info = camel_folder_get_message_info (m->folder, uids->pdata[i]);
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index ce88a18267..ce811bf79f 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);
+ camel_data_wrapper_decode_to_stream (wrapper, stream, NULL);
g_object_unref (stream);
component = e_cal_util_parse_ics_string ((gchar *) buffer->data);
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c
index 55de059d12..3240c560de 100644
--- a/modules/mail/e-mail-attachment-handler.c
+++ b/modules/mail/e-mail-attachment-handler.c
@@ -181,13 +181,13 @@ 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);
- camel_stream_reset (stream);
+ camel_stream_write (stream, data, length, 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) == -1)
+ if (camel_data_wrapper_construct_from_stream (wrapper, stream, NULL) == -1)
goto exit;
store = e_attachment_view_get_store (view);
@@ -221,7 +221,6 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
guint time)
{
static GdkAtom atom = GDK_NONE;
- CamelException ex = CAMEL_EXCEPTION_INITIALISER;
CamelDataWrapper *wrapper;
CamelMimeMessage *message;
CamelMultipart *multipart;
@@ -236,6 +235,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
gpointer parent;
gint length;
guint ii;
+ GError *local_error = NULL;
if (G_UNLIKELY (atom == GDK_NONE))
atom = gdk_atom_intern_static_string ("x-uid-list");
@@ -276,14 +276,14 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
goto exit;
/* The first string is the folder URI. */
- folder = mail_tool_uri_to_folder (data, 0, &ex);
+ folder = mail_tool_uri_to_folder (data, 0, &local_error);
if (folder == NULL)
goto exit;
/* Handle one message. */
if (uids->len == 1) {
message = camel_folder_get_message (
- folder, uids->pdata[0], &ex);
+ folder, uids->pdata[0], &local_error);
if (message == NULL)
goto exit;
@@ -307,7 +307,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
for (ii = 0; ii < uids->len; ii++) {
message = camel_folder_get_message (
- folder, uids->pdata[ii], &ex);
+ folder, uids->pdata[ii], &local_error);
if (message == NULL) {
g_object_unref (multipart);
goto exit;
@@ -346,7 +346,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
g_object_unref (multipart);
exit:
- if (camel_exception_is_set (&ex)) {
+ if (local_error != NULL) {
const gchar *folder_name = data;
if (folder != NULL)
@@ -354,10 +354,9 @@ exit:
e_alert_run_dialog_for_args (
parent, "mail-composer:attach-nomessages",
- folder_name, camel_exception_get_description (&ex),
- NULL);
+ folder_name, local_error->message, NULL);
- camel_exception_clear (&ex);
+ g_clear_error (&local_error);
}
if (folder != NULL)
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index e69ae55220..3bee268afb 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -551,38 +551,28 @@ all_accounts:
/* Add local folders. */
iter = mail_vfolder_get_sources_local ();
while (iter != NULL) {
- CamelException ex;
-
- camel_exception_init (&ex);
-
folder_uri = iter->data;
- folder = mail_tool_uri_to_folder (folder_uri, 0, &ex);
+ folder = mail_tool_uri_to_folder (folder_uri, 0, NULL);
if (folder != NULL)
list = g_list_append (list, folder);
else
g_warning ("Could not open vfolder source: %s", folder_uri);
- camel_exception_clear (&ex);
iter = g_list_next (iter);
}
/* Add remote folders. */
iter = mail_vfolder_get_sources_remote ();
while (iter != NULL) {
- CamelException ex;
-
- camel_exception_init (&ex);
-
folder_uri = iter->data;
- folder = mail_tool_uri_to_folder (folder_uri, 0, &ex);
+ folder = mail_tool_uri_to_folder (folder_uri, 0, NULL);
if (folder != NULL)
list = g_list_append (list, folder);
else
g_warning ("Could not open vfolder source: %s", folder_uri);
- camel_exception_clear (&ex);
iter = g_list_next (iter);
}
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c
index 983bf12438..802490ab0e 100644
--- a/plugins/audio-inline/audio-inline.c
+++ b/plugins/audio-inline/audio-inline.c
@@ -208,10 +208,10 @@ org_gnome_audio_inline_play_clicked (GtkWidget *button, EMFormatHTMLPObject *pob
d(printf ("audio inline formatter: write to temp file %s\n", po->filename));
- stream = camel_stream_fs_new_with_name (po->filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
+ 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);
- camel_stream_flush (stream);
+ camel_data_wrapper_decode_to_stream (data, stream, NULL);
+ camel_stream_flush (stream, 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 6cc2e80d4d..2bd72f96cd 100644
--- a/plugins/bogo-junk-plugin/bf-junk-filter.c
+++ b/plugins/bogo-junk-plugin/bf-junk-filter.c
@@ -83,7 +83,7 @@ static gboolean em_junk_bf_unicode = TRUE;
static void
init_db (void)
{
- CamelStream *stream = camel_stream_fs_new_with_name (WELCOME_MESSAGE, O_RDONLY, 0);
+ CamelStream *stream = camel_stream_fs_new_with_name (WELCOME_MESSAGE, O_RDONLY, 0, NULL);
CamelMimeParser *parser = camel_mime_parser_new ();
CamelMimeMessage *msg = camel_mime_message_new ();
const gchar *argv[] = {
@@ -93,11 +93,11 @@ init_db (void)
NULL
};
- camel_mime_parser_init_with_stream (parser, stream);
+ camel_mime_parser_init_with_stream (parser, stream, NULL);
camel_mime_parser_scan_from (parser, FALSE);
g_object_unref (stream);
- camel_mime_part_construct_from_parser ((CamelMimePart *) msg, parser);
+ camel_mime_part_construct_from_parser ((CamelMimePart *) msg, parser, NULL);
g_object_unref (parser);
d(fprintf (stderr, "Initing the bogofilter DB with Welcome message\n"));
@@ -164,9 +164,10 @@ retry:
}
stream = camel_stream_fs_new_with_fd (bf_in);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream);
- camel_stream_flush (stream);
- camel_stream_close (stream);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (msg), stream, NULL);
+ camel_stream_flush (stream, NULL);
+ camel_stream_close (stream, NULL);
g_object_unref (stream);
#ifndef G_OS_WIN32
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index 8126e85dfd..608a981a46 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -105,7 +105,6 @@ typedef struct {
gint status_pc;
gint status_timeout_id;
CamelOperation *status;
- CamelException ex;
guint32 *indices;
guint32 index_count;
@@ -310,7 +309,9 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
d(printf("Loading index table at 0x%x\n", pos));
if (dbx_pread(m->dbx_fd, &tindex, sizeof(tindex), pos) != sizeof(tindex)) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read table index from DBX file");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read table index from DBX file");
return FALSE;
}
tindex.anotherTablePtr = GUINT32_FROM_LE(tindex.anotherTablePtr);
@@ -318,8 +319,10 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
tindex.indexCount = GUINT32_FROM_LE(tindex.indexCount);
if (tindex.self != pos) {
- camel_exception_setv(&m->base.ex, 1, "Corrupt DBX file: Index table at 0x%x does not point to itself",
- pos);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Index table at 0x%x does not "
+ "point to itself", pos);
return FALSE;
}
@@ -336,7 +339,10 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
for (i = 0; i < tindex.ptrCount; i++) {
if (dbx_pread(m->dbx_fd, &index, sizeof(index), pos) != sizeof(index)) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read index entry from DBX file");
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read index entry from DBX file");
return FALSE;
}
index.indexptr = GUINT32_FROM_LE(index.indexptr);
@@ -344,9 +350,12 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
index.indexCount = GUINT32_FROM_LE(index.indexCount);
if (*index_ofs == m->index_count) {
- camel_exception_setv(&m->base.ex, 1,
- "Corrupt DBX file: Seems to contain more than %d entries claimed in its header\n",
- m->index_count);
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Seems to contain more "
+ "than %d entries claimed in its header",
+ m->index_count);
return FALSE;
}
m->indices[(*index_ofs)++] = index.indexptr;
@@ -364,12 +373,16 @@ static gboolean dbx_load_indices(DbxImporter *m)
guint32 index_ofs = 0;
if (dbx_pread(m->dbx_fd, &indexptr, 4, INDEX_POINTER) != 4) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read first index pointer from DBX file");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read first index pointer from DBX file");
return FALSE;
}
if (dbx_pread(m->dbx_fd, &itemcount, 4, ITEM_COUNT) != 4) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read item count from DBX file");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read item count from DBX file");
return FALSE;
}
@@ -385,9 +398,10 @@ static gboolean dbx_load_indices(DbxImporter *m)
d(printf("Loaded %d of %d indices\n", index_ofs, m->index_count));
if (index_ofs < m->index_count) {
- camel_exception_setv(&m->base.ex, 1,
- "Corrupt DBX file: Seems to contain fewer than %d entries claimed in its header\n",
- m->index_count);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Seems to contain fewer than %d "
+ "entries claimed in its header", m->index_count);
return FALSE;
}
return TRUE;
@@ -410,9 +424,11 @@ dbx_read_mail_body (DbxImporter *m, guint32 offset, gint bodyfd)
d(printf("Reading mail data chunk from %x\n", offset));
if (dbx_pread(m->dbx_fd, &hdr, sizeof(hdr), offset) != sizeof(hdr)) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail data block from DBX file at offset %x\n",
- offset);
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail data block from "
+ "DBX file at offset %x", offset);
return FALSE;
}
hdr.self = GUINT32_FROM_LE(hdr.self);
@@ -420,9 +436,11 @@ dbx_read_mail_body (DbxImporter *m, guint32 offset, gint bodyfd)
hdr.nextaddress = GUINT32_FROM_LE(hdr.nextaddress);
if (hdr.self != offset) {
- camel_exception_setv(&m->base.ex, 1,
- "Corrupt DBX file: Mail data block at 0x%x does not point to itself",
- offset);
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Mail data block at "
+ "0x%x does not point to itself", offset);
return FALSE;
}
@@ -433,15 +451,19 @@ dbx_read_mail_body (DbxImporter *m, guint32 offset, gint bodyfd)
}
d(printf("Reading %d bytes from %lx\n", hdr.blocksize, offset + sizeof(hdr)));
if (dbx_pread(m->dbx_fd, buffer, hdr.blocksize, offset + sizeof(hdr)) != hdr.blocksize) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail data from DBX file at offset %x\n",
- offset + sizeof(hdr));
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail data from DBX file "
+ "at offset %x",
+ offset + sizeof(hdr));
return FALSE;
}
if (write(bodyfd, buffer, hdr.blocksize) != hdr.blocksize) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to write mail data to temporary file\n",
- offset + sizeof(hdr));
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to write mail data to temporary file");
return FALSE;
}
offset = hdr.nextaddress;
@@ -458,25 +480,29 @@ dbx_read_email (DbxImporter *m, guint32 offset, gint bodyfd, gint *flags)
int i;
if (dbx_pread(m->dbx_fd, &hdr, sizeof(hdr), offset) != sizeof(hdr)) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail header from DBX file at offset %x\n",
- offset);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail header from DBX file at offset %x",
+ offset);
return FALSE;
}
hdr.self = GUINT32_FROM_LE(hdr.self);
hdr.size = GUINT32_FROM_LE(hdr.size);
if (hdr.self != offset) {
- camel_exception_setv(&m->base.ex, 1, "Corrupt DBX file: Mail header at 0x%x does not point to itself",
- offset);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Mail header at 0x%x does not "
+ "point to itself", offset);
return FALSE;
}
buffer = g_malloc(hdr.size);
offset += sizeof(hdr);
if (dbx_pread(m->dbx_fd, buffer, hdr.size, offset) != hdr.size) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail data block from DBX file at offset %x\n",
- offset);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail data block from DBX file "
+ "at offset %x", offset);
g_free(buffer);
return FALSE;
}
@@ -529,7 +555,7 @@ dbx_import_file (DbxImporter *m)
m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */
camel_operation_start (NULL, _("Importing '%s'"), filename);
- folder = mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ folder = mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
if (!folder)
return;
d(printf("importing to %s\n", camel_folder_get_full_name(folder)));
@@ -541,7 +567,9 @@ dbx_import_file (DbxImporter *m)
g_free (filename);
if (m->dbx_fd == -1) {
- camel_exception_setv(&m->base.ex, 1, "Failed to open import file\n");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to open import file");
goto out;
}
@@ -550,7 +578,9 @@ dbx_import_file (DbxImporter *m)
tmpfile = e_mkstemp("dbx-import-XXXXXX");
if (tmpfile == -1) {
- camel_exception_setv(&m->base.ex, 1, "Failed to create temporary file for import\n");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to create temporary file for import");
goto out;
}
@@ -560,6 +590,7 @@ dbx_import_file (DbxImporter *m)
CamelMimeParser *mp;
gint dbx_flags = 0;
gint flags = 0;
+ gboolean success;
camel_operation_progress(NULL, 100 * i / m->index_count);
camel_operation_progress(m->status, 100 * i / m->index_count);
@@ -567,7 +598,7 @@ dbx_import_file (DbxImporter *m)
if (!dbx_read_email(m, m->indices[i], tmpfile, &dbx_flags)) {
d(printf("Cannot read email index %d at %x\n",
i, m->indices[i]));
- if (camel_exception_is_set(&m->base.ex))
+ if (m->base.error != NULL)
goto out;
missing++;
continue;
@@ -585,7 +616,7 @@ 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) == -1) {
+ if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp, NULL) == -1) {
/* set exception? */
g_object_unref (msg);
g_object_unref (mp);
@@ -594,11 +625,12 @@ dbx_import_file (DbxImporter *m)
info = camel_message_info_new(NULL);
camel_message_info_set_flags(info, flags, ~0);
- camel_folder_append_message(folder, msg, info, NULL, &m->base.ex);
+ success = camel_folder_append_message (
+ folder, msg, info, NULL, &m->base.error);
camel_message_info_free(info);
g_object_unref (msg);
-
- if (camel_exception_is_set(&m->base.ex)) {
+
+ if (!success) {
g_object_unref(mp);
break;
}
@@ -611,10 +643,12 @@ dbx_import_file (DbxImporter *m)
camel_folder_sync(folder, FALSE, NULL);
camel_folder_thaw(folder);
g_object_unref(folder);
- if (missing && !camel_exception_is_set(&m->base.ex)) {
- camel_exception_setv(&m->base.ex, 1,
- "%d messages imported correctly; %d message bodies were not present in the DBX file",
- m->index_count - missing, missing);
+ if (missing && m->base.error == NULL) {
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "%d messages imported correctly; %d message "
+ "bodies were not present in the DBX file",
+ m->index_count - missing, missing);
}
camel_operation_end(NULL);
}
diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c
index d2addbf095..55a3fb1664 100644
--- a/plugins/groupwise-features/install-shared.c
+++ b/plugins/groupwise-features/install-shared.c
@@ -58,7 +58,6 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
gchar *parent_name;
gchar *container_id;
const gchar *item_id;
- CamelException ex;
CamelStore *store;
CamelFolder *folder;
EAccount *account;
@@ -91,9 +90,9 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
else
parent_name = NULL;
}
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL) {
g_strfreev (names);
return;
}
@@ -116,9 +115,8 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
account = mail_config_get_account_by_source_url (uri);
uri = account->source->url;
em_folder_tree_model_remove_store (model, store);
- camel_exception_init (&ex);
- if (!(provider = camel_provider_get(uri, &ex))) {
- camel_exception_clear (&ex);
+ provider = camel_provider_get (uri, NULL);
+ if (provider == NULL) {
g_strfreev (names);
return;
}
@@ -208,8 +206,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);
- camel_stream_write (stream, "", 1);
+ camel_data_wrapper_write_to_stream (dw, stream, NULL);
+ camel_stream_write (stream, "", 1, 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 c539974564..fb0e786239 100644
--- a/plugins/groupwise-features/proxy.c
+++ b/plugins/groupwise-features/proxy.c
@@ -642,7 +642,6 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
proxyDialog *prd;
proxyDialogPrivate *priv;
CamelOfflineStore *store;
- CamelException ex;
gint pag_num;
target_account = (EMConfigTargetAccount *)data->config->target;
@@ -650,11 +649,11 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
/* We are using some g_object_set on this. We shuold also avoid double-free later. So reffing */
g_object_ref (account);
- camel_exception_init (&ex);
- if (!(store = (CamelOfflineStore *) camel_session_get_service (session, e_account_get_string(account, E_ACCOUNT_SOURCE_URL), CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelOfflineStore *) camel_session_get_service (
+ session, e_account_get_string (account, E_ACCOUNT_SOURCE_URL),
+ CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return NULL;
- }
if (g_strrstr (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), "groupwise://"))
{
@@ -717,7 +716,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
}
g_object_unref (store);
- camel_exception_clear (&ex);
+
return NULL;
}
diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c
index 91758da535..532316599c 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/share-folder-common.c
@@ -66,7 +66,6 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
{
gchar *uri;
EAccount *account;
- CamelException ex;
CamelProvider *provider;
uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL);
@@ -78,11 +77,10 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
uri = account->source->url;
em_folder_tree_model_remove_store (model, store);
- camel_exception_init (&ex);
- if (!(provider = camel_provider_get(uri, &ex))) {
- camel_exception_clear (&ex);
+ provider = camel_provider_get (uri, NULL);
+ if (provider == NULL)
return;
- }
+
if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
return;
em_folder_tree_model_add_store (model, store, account->name);
@@ -143,9 +141,9 @@ 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 (m->store, m->parent, m->name, &m->base.ex))) {
+ if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.error))) {
if (camel_store_supports_subscriptions (m->store))
- camel_store_subscribe_folder (m->store, m->full_name, &m->base.ex);
+ camel_store_subscribe_folder (m->store, m->full_name, &m->base.error);
}
}
@@ -239,7 +237,6 @@ users_dialog_response(GtkWidget *dialog, gint response, struct ShareInfo *ssi)
struct _EMFolderTreeModelStoreInfo *si;
EMFolderSelector *emfs = ssi->emfs;
const gchar *uri, *path;
- CamelException ex;
CamelStore *store;
if (response != GTK_RESPONSE_OK) {
@@ -253,11 +250,10 @@ users_dialog_response(GtkWidget *dialog, gint response, struct ShareInfo *ssi)
d(printf ("Creating new folder: %s (%s)\n", path, uri));
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return;
- }
if (!(si = em_folder_tree_model_lookup_store_info (ssi->model, store))) {
g_assert_not_reached ();
@@ -293,7 +289,6 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m
struct ShareInfo *ssi;
const gchar *uri;
EGwConnection *cnc;
- CamelException ex;
CamelStore *store;
ssi = g_new0(struct ShareInfo, 1);
@@ -304,11 +299,10 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m
/* i want store at this point to get cnc not sure proper or not*/
uri = em_folder_selector_get_selected_uri (emfs);
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return;
- }
cnc = get_cnc (store);
users_dialog = gtk_dialog_new_with_buttons (
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index 5548948f1a..41b4a898dd 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -361,7 +361,7 @@ 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);
+ camel_data_wrapper_decode_to_stream (data_wrapper, stream, 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/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c
index 910986e592..f03c08e919 100644
--- a/plugins/imap-features/imap-headers.c
+++ b/plugins/imap-features/imap-headers.c
@@ -88,7 +88,6 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data)
EAccount *temp = NULL;
EAccountList *accounts = e_get_account_list ();
CamelURL *url = NULL;
- CamelException ex;
GtkTreeModel *model;
GtkTreeIter iter;
GString *str;
@@ -98,7 +97,7 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data)
temp = mail_config_get_account_by_source_url (account->source->url);
- url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), &ex);
+ url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), NULL);
model = gtk_tree_view_get_model (ui->custom_headers_tree);
if (gtk_tree_model_get_iter_first(model, &iter)) {
@@ -261,7 +260,6 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data)
EAccount *account;
GtkWidget *vbox;
CamelURL *url = NULL;
- CamelException ex;
GtkBuilder *builder;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -290,7 +288,7 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data)
ui->remove_header = GTK_BUTTON(e_builder_get_widget (builder, "removeHeader"));
ui->entry_header = GTK_ENTRY (e_builder_get_widget (builder, "customHeaderEntry"));
- url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), &ex);
+ url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), NULL);
ui->store = gtk_tree_store_new (1, G_TYPE_STRING);
gtk_tree_view_set_model (ui->custom_headers_tree, GTK_TREE_MODEL(ui->store));
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index c2e38464ec..cbefc53bc4 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2569,7 +2569,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);
+ camel_data_wrapper_decode_to_stream (content, stream, NULL);
if (byte_array->len == 0)
puri->vcalendar = NULL;
@@ -2751,6 +2751,6 @@ itip_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
d(printf("writing to frame content, handler is '%s'\n", info->handle->mime_type));
info->handle->handler(emf, stream, info->puri.part, info->handle, FALSE);
- camel_stream_close(stream);
+ camel_stream_close(stream, NULL);
}
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 55a230a33f..504dca64a0 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);
+ camel_data_wrapper_decode_to_stream (content, stream, NULL);
str = g_strndup ((gchar *) byte_array->data, byte_array->len);
g_object_unref (stream);
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 826a596be6..8e7c158cc0 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -343,29 +343,31 @@ mark_all_as_read (CamelFolder *folder)
camel_folder_free_uids (folder, uids);
}
-static void
+static gboolean
mar_all_sub_folders (CamelStore *store,
CamelFolderInfo *fi,
- CamelException *ex)
+ GError **error)
{
while (fi) {
CamelFolder *folder;
if (fi->child) {
- mar_all_sub_folders (store, fi->child, ex);
- if (camel_exception_is_set (ex))
- return;
+ if (!mar_all_sub_folders (store, fi->child, error))
+ return FALSE;
}
- if (!(folder = camel_store_get_folder (store, fi->full_name, 0, ex)))
- return;
+ folder = camel_store_get_folder (
+ store, fi->full_name, 0, error);
+ if (folder == NULL)
+ return FALSE;
- if (!CAMEL_IS_VEE_FOLDER (folder)) {
+ if (!CAMEL_IS_VEE_FOLDER (folder))
mark_all_as_read (folder);
- }
fi = fi->next;
}
+
+ return TRUE;
}
static void
@@ -375,7 +377,6 @@ mar_got_folder (gchar *folder_uri,
{
CamelFolderInfo *folder_info;
CamelStore *parent_store;
- CamelException ex;
const gchar *full_name;
gint response;
@@ -383,17 +384,15 @@ mar_got_folder (gchar *folder_uri,
if (!folder)
return;
- camel_exception_init (&ex);
-
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
folder_info = camel_store_get_folder_info (
parent_store, full_name,
CAMEL_STORE_FOLDER_INFO_RECURSIVE |
- CAMEL_STORE_FOLDER_INFO_FAST, &ex);
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL);
- if (camel_exception_is_set (&ex))
+ if (folder_info == NULL)
goto exit;
response = prompt_user (folder_info->child != NULL);
@@ -404,7 +403,7 @@ mar_got_folder (gchar *folder_uri,
if (response == MARK_ALL_READ_CURRENT_FOLDER)
mark_all_as_read (folder);
else if (response == MARK_ALL_READ_WITH_SUBFOLDERS)
- mar_all_sub_folders (parent_store, folder_info, &ex);
+ mar_all_sub_folders (parent_store, folder_info, NULL);
exit:
camel_store_free_folder_info (parent_store, folder_info);
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 84706b783e..13a4868fa9 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -116,7 +116,6 @@ struct _PstImporter {
gint status_pc;
gint status_timeout_id;
CamelOperation *status;
- CamelException ex;
pst_file pst;
@@ -453,7 +452,7 @@ pst_import_file (PstImporter *m)
camel_operation_start (NULL, _("Importing '%s'"), filename);
if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) {
- mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
}
ret = pst_init (&m->pst, filename);
@@ -704,7 +703,7 @@ pst_create_folder (PstImporter *m)
*pos = '\0';
- folder = mail_tool_uri_to_folder (dest, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ folder = mail_tool_uri_to_folder (dest, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
g_object_unref (folder);
*pos = '/';
}
@@ -716,7 +715,7 @@ pst_create_folder (PstImporter *m)
g_object_unref (m->folder);
}
- m->folder = mail_tool_uri_to_folder (m->folder_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ m->folder = mail_tool_uri_to_folder (m->folder_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
}
@@ -769,6 +768,7 @@ pst_process_email (PstImporter *m, pst_item *item)
CamelMimePart *part;
CamelMessageInfo *info;
pst_item_attach *attach;
+ gboolean success;
if (m->folder == NULL) {
pst_create_folder (m);
@@ -822,7 +822,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) == -1)
+ if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream, NULL) == -1)
g_warning ("Error reading headers, skipped");
} else {
@@ -916,16 +916,16 @@ pst_process_email (PstImporter *m, pst_item *item)
if (item->flags & 0x08)
camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT, ~0);
- camel_folder_append_message (m->folder, msg, info, NULL, &m->ex);
+ success = camel_folder_append_message (
+ m->folder, msg, info, NULL, NULL);
camel_message_info_free (info);
g_object_unref (msg);
camel_folder_sync (m->folder, FALSE, NULL);
camel_folder_thaw (m->folder);
- if (camel_exception_is_set (&m->ex)) {
+ if (!success) {
g_critical ("Exception!");
- camel_exception_clear (&m->ex);
return;
}
@@ -1232,7 +1232,7 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta
continue;
}
- if (!(stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) {
+ if (!(stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0666, NULL))) {
g_warning ("Could not create stream for file %s - %s", path, g_strerror (errno));
attach = attach->next;
continue;
@@ -1240,8 +1240,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) == -1
- || camel_stream_flush (stream) == -1)
+ if (camel_data_wrapper_decode_to_stream (content, stream, NULL) == -1
+ || camel_stream_flush (stream, NULL) == -1)
{
g_warning ("Could not write attachment to %s: %s", path, g_strerror (errno));
g_object_unref (stream);
diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c
index 537831a07e..edfb896107 100644
--- a/plugins/sa-junk-plugin/em-junk-filter.c
+++ b/plugins/sa-junk-plugin/em-junk-filter.c
@@ -186,12 +186,13 @@ 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);
- camel_stream_flush (stream);
- camel_stream_close (stream);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (msg), stream, NULL);
+ camel_stream_flush (stream, NULL);
+ camel_stream_close (stream, NULL);
g_object_unref (stream);
} else if (in) {
- camel_write (fds[1], in, strlen (in));
+ camel_write (fds[1], in, strlen (in), NULL);
close (fds[1]);
}
@@ -203,7 +204,7 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin
memstream = (CamelStreamMem *) camel_stream_mem_new ();
camel_stream_mem_set_byte_array (memstream, output_buffer);
- camel_stream_write_to_stream (stream, (CamelStream *) memstream);
+ camel_stream_write_to_stream (stream, (CamelStream *) memstream, NULL);
g_object_unref (stream);
g_byte_array_append (output_buffer, (guchar *)"", 1);
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 74e167a9fe..5bf3eb7e65 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -483,9 +483,10 @@ 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);
- camel_stream_reset (mem);
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (new), mem);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (template), mem, NULL);
+ camel_stream_reset (mem, NULL);
+ camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (new), mem, NULL);
g_object_unref (mem);
/* Add the headers from the message we are replying to, so CC and that
diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c
index 8bb5341998..35f152a373 100644
--- a/plugins/tnef-attachments/tnef-plugin.c
+++ b/plugins/tnef-attachments/tnef-plugin.c
@@ -86,14 +86,14 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
name = g_build_filename(tmpdir, ".evo-attachment.tnef", NULL);
- out = camel_stream_fs_new_with_name(name, O_RDWR|O_CREAT, 0666);
+ out = camel_stream_fs_new_with_name(name, O_RDWR|O_CREAT, 0666, NULL);
if (out == NULL)
goto fail;
content = camel_medium_get_content ((CamelMedium *)t->part);
if (content == NULL)
goto fail;
- if (camel_data_wrapper_decode_to_stream(content, out) == -1
- || camel_stream_close(out) == -1) {
+ if (camel_data_wrapper_decode_to_stream(content, out, NULL) == -1
+ || camel_stream_close(out, NULL) == -1) {
g_object_unref (out);
goto fail;
}
@@ -136,9 +136,9 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
path = g_build_filename(tmpdir, d->d_name, NULL);
- stream = camel_stream_fs_new_with_name(path, O_RDONLY, 0);
+ 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);
+ camel_data_wrapper_construct_from_stream(content, stream, 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 0b7756211f..dffc407d66 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -99,7 +99,7 @@ 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);
+ camel_data_wrapper_decode_to_stream (data_wrapper, stream, NULL);
/* because the result is not NULL-terminated */
g_byte_array_append (array, padding, 2);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c41eb6ae0a..24a793ee76 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -205,8 +205,10 @@ mail/em-folder-utils.c
mail/em-format-html-display.c
mail/em-format-html-print.c
mail/em-format-html.c
+mail/em-html-stream.c
mail/em-junk.c
mail/em-subscribe-editor.c
+mail/em-sync-stream.c
mail/em-utils.c
mail/em-vfolder-editor.c
mail/em-vfolder-rule.c
diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c
index 7d34a29bfe..e2306baae1 100644
--- a/widgets/misc/e-account-combo-box.c
+++ b/widgets/misc/e-account-combo-box.c
@@ -107,7 +107,6 @@ static gboolean
account_combo_box_test_account (EAccount *account)
{
CamelStore *store;
- CamelException ex;
const gchar *url;
gboolean writable = FALSE;
@@ -124,15 +123,13 @@ account_combo_box_test_account (EAccount *account)
return TRUE;
/* Account must be writable. */
- camel_exception_init (&ex);
url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
store = CAMEL_STORE (camel_session_get_service (
- camel_session, url, CAMEL_PROVIDER_STORE, &ex));
+ camel_session, url, CAMEL_PROVIDER_STORE, NULL));
if (store != NULL) {
writable = (store->mode & CAMEL_STORE_WRITE);
g_object_unref (store);
}
- camel_exception_clear (&ex);
return writable;
}
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 1872de6b77..56659ae01c 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -1080,7 +1080,7 @@ e_attachment_add_to_multipart (EAttachment *attachment,
CAMEL_STREAM_FILTER (filtered_stream),
CAMEL_MIME_FILTER (filter));
camel_data_wrapper_decode_to_stream (
- wrapper, filtered_stream);
+ wrapper, filtered_stream, NULL);
g_object_unref (filtered_stream);
g_object_unref (stream);
@@ -1563,9 +1563,9 @@ 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);
+ camel_data_wrapper_construct_from_stream (wrapper, stream, NULL);
camel_data_wrapper_set_mime_type (wrapper, mime_type);
- camel_stream_close (stream);
+ camel_stream_close (stream, NULL);
g_object_unref (stream);
mime_part = camel_mime_part_new ();
@@ -2498,7 +2498,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);
+ camel_data_wrapper_decode_to_stream (wrapper, stream, NULL);
g_object_unref (stream);
/* Load the buffer into a GMemoryInputStream.