[evolution/camel-gobject: 66/66] Replace CamelException with GError.
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution/camel-gobject: 66/66] Replace CamelException with GError.
- Date: Sat, 28 Nov 2009 19:59:08 +0000 (UTC)
commit 0197fc6390b9c9e63a5e9fe71c90fbc29246ddbd
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Nov 27 20:31:19 2009 -0500
Replace CamelException with GError.
composer/e-msg-composer.c | 57 +++--
em-format/em-format.c | 72 +++---
mail/e-mail-local.c | 16 +-
mail/e-mail-reader.c | 11 +-
mail/e-mail-store.c | 14 +-
mail/em-composer-utils.c | 37 ++-
mail/em-composer-utils.h | 2 +-
mail/em-folder-tree-model.c | 12 +-
mail/em-folder-tree.c | 72 ++----
mail/em-folder-utils.c | 69 +++---
mail/em-subscribe-editor.c | 24 ++-
mail/em-utils.c | 40 +--
mail/em-utils.h | 2 +-
mail/importers/elm-importer.c | 2 +-
mail/importers/evolution-mbox-importer.c | 2 +-
mail/importers/mail-importer.c | 13 +-
mail/importers/mail-importer.h | 2 +-
mail/importers/pine-importer.c | 2 +-
mail/mail-folder-cache.c | 2 +-
mail/mail-mt.c | 23 +-
mail/mail-mt.h | 2 +-
mail/mail-ops.c | 305 ++++++++++++----------
mail/mail-ops.h | 4 +-
mail/mail-send-recv.c | 43 ++--
mail/mail-session.c | 56 +++--
mail/mail-tools.c | 68 +++--
mail/mail-tools.h | 8 +-
mail/mail-vfolder.c | 5 +-
mail/message-list.c | 39 +--
modules/mail/e-mail-attachment-handler.c | 15 +-
modules/mail/e-mail-shell-migrate.c | 92 ++++---
plugins/groupwise-features/install-shared.c | 12 +-
plugins/groupwise-features/proxy.c | 10 +-
plugins/groupwise-features/share-folder-common.c | 26 +--
plugins/imap-features/imap-headers.c | 6 +-
plugins/mark-all-read/mark-all-read.c | 50 ++--
plugins/pst-import/pst-importer.c | 16 +-
plugins/tnef-attachments/tnef-plugin.c | 2 +-
widgets/misc/e-account-combo-box.c | 5 +-
39 files changed, 643 insertions(+), 595 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 0b3b666..4ddfcc3 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -548,7 +548,6 @@ build_message (EMsgComposer *composer,
CamelSession *session;
CamelStream *stream;
CamelMimePart *part;
- CamelException ex;
GByteArray *data;
EAccount *account;
gchar *charset;
@@ -557,6 +556,7 @@ build_message (EMsgComposer *composer,
gboolean smime_sign;
gboolean smime_encrypt;
gint i;
+ GError *error = NULL;
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
@@ -817,8 +817,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);
@@ -876,18 +874,19 @@ build_message (EMsgComposer *composer,
if (pgp_sign) {
CamelMimePart *npart = camel_mime_part_new ();
+ gint retval; /* 0 is success */
cipher = camel_gpg_context_new (session);
if (account != NULL)
camel_gpg_context_set_always_trust (
CAMEL_GPG_CONTEXT (cipher),
account->pgp_always_trust);
- camel_cipher_sign (
+ retval = camel_cipher_sign (
cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1,
- part, npart, &ex);
+ part, npart, &error);
g_object_unref (cipher);
- if (camel_exception_is_set (&ex)) {
+ if (retval != 0) {
g_object_unref (npart);
goto exception;
}
@@ -898,6 +897,7 @@ build_message (EMsgComposer *composer,
if (pgp_encrypt) {
CamelMimePart *npart = camel_mime_part_new ();
+ gboolean retval; /* 0 is success */
/* check to see if we should encrypt to self, NB gets removed immediately after use */
if (account && account->pgp_encrypt_to_self && pgp_userid)
@@ -908,15 +908,15 @@ build_message (EMsgComposer *composer,
camel_gpg_context_set_always_trust (
CAMEL_GPG_CONTEXT (cipher),
account->pgp_always_trust);
- camel_cipher_encrypt (
+ retval = camel_cipher_encrypt (
cipher, pgp_userid, recipients,
- part, npart, &ex);
+ part, npart, &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 (retval != 0) {
g_object_unref (npart);
goto exception;
}
@@ -946,20 +946,23 @@ 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,
- _("Cannot sign outgoing message: No signing certificate set for this account"));
+ g_set_error (
+ &error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot sign outgoing message: No signing certificate set for this account"));
goto exception;
}
if (smime_encrypt
&& (account == NULL || account->smime_sign_key == NULL || account->smime_sign_key[0] == 0)) {
- camel_exception_set (&ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot encrypt outgoing message: No encryption certificate set for this account"));
+ g_set_error (
+ &error, CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot encrypt outgoing message: No encryption certificate set for this account"));
goto exception;
}
if (smime_sign) {
CamelMimePart *npart = camel_mime_part_new ();
+ gint retval; /* 0 is success */
cipher = camel_smime_context_new (session);
@@ -971,10 +974,12 @@ build_message (EMsgComposer *composer,
camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
}
- camel_cipher_sign (cipher, account->smime_sign_key, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex);
+ retval = camel_cipher_sign (
+ cipher, account->smime_sign_key,
+ CAMEL_CIPHER_HASH_SHA1, part, npart, &error);
g_object_unref (cipher);
- if (camel_exception_is_set (&ex)) {
+ if (retval != 0) {
g_object_unref (npart);
goto exception;
}
@@ -984,6 +989,7 @@ build_message (EMsgComposer *composer,
}
if (smime_encrypt) {
+ gint retval; /* 0 is success */
/* check to see if we should encrypt to self, NB removed after use */
if (account->smime_encrypt_to_self)
@@ -992,10 +998,12 @@ build_message (EMsgComposer *composer,
cipher = camel_smime_context_new (session);
camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
- camel_cipher_encrypt (cipher, NULL, recipients, part, (CamelMimePart *)new, &ex);
+ retval = camel_cipher_encrypt (
+ cipher, NULL, recipients, part,
+ (CamelMimePart *) new, &error);
g_object_unref (cipher);
- if (camel_exception_is_set (&ex))
+ if (retval != 0)
goto exception;
if (account->smime_encrypt_to_self)
@@ -1045,12 +1053,14 @@ skip_content:
g_object_unref (new);
- if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) {
- e_error_run ((GtkWindow *)composer, "mail-composer:no-build-message",
- camel_exception_get_description (&ex), NULL);
+ if (!g_error_matches (error, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL)) {
+ e_error_run (
+ GTK_WINDOW (composer),
+ "mail-composer:no-build-message",
+ error->message, NULL);
}
- camel_exception_clear (&ex);
+ g_error_free (error);
if (recipients) {
for (i=0; i<recipients->len; i++)
@@ -2477,7 +2487,6 @@ handle_multipart_encrypted (EMsgComposer *composer,
CamelDataWrapper *content;
CamelMimePart *mime_part;
CamelSession *session;
- CamelException ex;
CamelCipherValidity *valid;
GtkToggleAction *action = NULL;
const gchar *protocol;
@@ -2495,13 +2504,11 @@ 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);
diff --git a/em-format/em-format.c b/em-format/em-format.c
index ac2c6ee..2d69005 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1340,10 +1340,10 @@ static void
emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
{
CamelCipherContext *context;
- CamelException *ex;
CamelMimePart *opart;
CamelCipherValidity *valid;
struct _EMFormatCache *emfc;
+ GError *error = NULL;
/* should this perhaps run off a key of ".secured" ? */
emfc = g_hash_table_lookup(emf->inline_table, emf->part_id->str);
@@ -1352,17 +1352,19 @@ emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *pa
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, &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,
+ _("Could not parse S/MIME message: %s"),
+ error->message);
em_format_part_as(emf, stream, part, NULL);
+ g_error_free (error);
} else {
if (emfc == NULL)
emfc = emf_insert_cache(emf, emf->part_id->str);
@@ -1376,7 +1378,6 @@ emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *pa
g_object_unref(opart);
g_object_unref(context);
- camel_exception_free(ex);
}
#endif
@@ -1483,12 +1484,12 @@ static void
emf_multipart_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
{
CamelCipherContext *context;
- CamelException *ex;
const gchar *protocol;
CamelMimePart *opart;
CamelCipherValidity *valid;
CamelMultipartEncrypted *mpe;
struct _EMFormatCache *emfc;
+ GError *error = NULL;
/* should this perhaps run off a key of ".secured" ? */
emfc = g_hash_table_lookup(emf->inline_table, emf->part_id->str);
@@ -1514,15 +1515,16 @@ emf_multipart_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
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, &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,
+ _("Could not parse PGP/MIME message: %s"),
+ error->message);
em_format_part_as(emf, stream, part, "multipart/mixed");
+ g_error_free (error);
} else {
if (emfc == NULL)
emfc = emf_insert_cache(emf, emf->part_id->str);
@@ -1537,7 +1539,6 @@ emf_multipart_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
/* 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
@@ -1688,14 +1689,17 @@ emf_multipart_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, co
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 *error = NULL;
- valid = camel_cipher_verify(cipher, part, ex);
+ valid = camel_cipher_verify(cipher, part, &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, (error->message != NULL) ?
+ _("Error verifying signature") :
+ _("Unknown error verifying signature"));
+ if (error->message != NULL)
+ em_format_format_error(emf, stream, "%s", error->message);
em_format_part_as(emf, stream, part, "multipart/mixed");
} else {
if (emfc == NULL)
@@ -1708,7 +1712,8 @@ emf_multipart_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, co
em_format_format_secure(emf, stream, cpart, valid);
}
- camel_exception_free(ex);
+ if (error != NULL)
+ g_error_free (error);
g_object_unref(cipher);
}
}
@@ -1819,8 +1824,8 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
CamelDataWrapper *dw;
CamelMimePart *opart;
CamelStream *ostream;
- CamelException *ex;
gchar *type;
+ GError *error = NULL;
if (!ipart) {
em_format_format_error(emf, stream, _("Unknown error verifying signature"));
@@ -1829,17 +1834,16 @@ 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, &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, _("Error verifying signature: %s"),
+ 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 (error);
g_object_unref(cipher);
return;
}
@@ -1892,7 +1896,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
@@ -1900,25 +1903,25 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
{
CamelCipherContext *cipher;
CamelCipherValidity *valid;
- CamelException *ex;
CamelMimePart *opart;
CamelDataWrapper *dw;
gchar *mime_type;
+ GError *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, &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: %s"),
+ 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 (error);
g_object_unref(cipher);
g_object_unref(opart);
return;
@@ -1944,7 +1947,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[] = {
diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c
index 2dd753f..1a09278 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 *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, &error);
g_free (temp);
- if (camel_exception_is_set (&ex))
+ if (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);
@@ -98,9 +94,9 @@ 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", error->message);
- camel_exception_clear (&ex);
+ g_error_free (error);
camel_url_free (url);
}
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index a77ff46..c017ec9 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -1809,7 +1809,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;
EMFormatHTMLDisplay *html_display;
@@ -1871,7 +1871,10 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
timeout_interval, (GSourceFunc)
mail_reader_message_read_cb, reader);
- } else if (camel_exception_is_set (ex)) {
+ /* XXX Kind of strange for a GError to be pushed to a callback
+ * function. Might want to reconsider. Maybe just push
+ * the error message? */
+ } else if (error != NULL && *error != NULL) {
EWebView *web_view;
gchar *string;
@@ -1881,11 +1884,11 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
string = g_strdup_printf (
"<h2>%s</h2><p>%s</p>",
_("Unable to retrieve message"),
- ex->desc);
+ (*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 581ac43..777e6b1 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -294,17 +294,15 @@ e_mail_store_add_by_uri (const gchar *uri,
{
CamelService *service;
CamelProvider *provider;
- CamelException ex;
+ GError *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, &error);
if (provider == NULL)
goto fail;
@@ -312,7 +310,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, &error);
if (service == NULL)
goto fail;
@@ -324,10 +322,8 @@ e_mail_store_add_by_uri (const gchar *uri,
fail:
/* FIXME: Show an error dialog. */
- g_warning (
- "Couldn't get service: %s: %s", uri,
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
+ g_warning ("Couldn't get service: %s: %s", uri, error->message);
+ g_error_free (error);
return NULL;
}
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index d751a5f..1d82d20 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1442,13 +1442,17 @@ 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 */
@@ -1655,8 +1659,11 @@ emu_forward_raw_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageIn
* @param ex Exception.
* Forwards message to the address, in very similar way as redirect does.
**/
-void
-em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, const gchar *address, CamelException *ex)
+gboolean
+em_utils_forward_message_raw (CamelFolder *folder,
+ CamelMimeMessage *message,
+ const gchar *address,
+ GError **error)
{
EAccount *account;
CamelMimeMessage *forward;
@@ -1667,19 +1674,25 @@ em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, co
GQueue trash = G_QUEUE_INIT;
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_SYSTEM,
+ _("No destination address provided, "
+ "forward of the message has been cancelled."));
+ return FALSE;
}
account = guess_account (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_SYSTEM,
+ _("No account found to use, forward of "
+ "the message has been cancelled."));
+ return FALSE;
}
forward = camel_mime_message_new ();
@@ -1732,6 +1745,8 @@ em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, co
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, emu_forward_raw_done, NULL);
+
+ return TRUE;
}
/* Replying to messages... */
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index 70ee0fe..5df5b17 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -50,7 +50,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);
+gboolean 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 c6e96b7..235f3e9 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -182,7 +182,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);
@@ -195,20 +194,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;
- 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;
- }
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 166c33c..b61b7cf 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -188,7 +188,7 @@ folder_tree_get_folder_info__exec (struct _EMFolderTreeGetFolderInfo *m)
{
guint32 flags = m->flags | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
- m->fi = camel_store_get_folder_info (m->store, m->top, flags, &m->base.ex);
+ m->fi = camel_store_get_folder_info (m->store, m->top, flags, NULL);
}
static void
@@ -223,7 +223,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);
@@ -393,7 +393,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;
@@ -405,13 +404,12 @@ folder_tree_cell_edited_cb (EMFolderTree *folder_tree,
gchar **strv;
gpointer parent;
guint index;
+ GError *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_TOPLEVEL (parent) ? parent : NULL;
@@ -449,7 +447,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_error_run (
parent, "mail:no-rename-folder-exists",
@@ -459,17 +457,16 @@ 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, &error)) {
e_error_run (
parent, "mail:no-rename-folder",
- old_full_name, new_full_name, ex.desc, NULL);
+ old_full_name, new_full_name, error->message, NULL);
+ g_error_free (error);
goto exit;
}
exit:
- camel_exception_clear (&ex);
-
g_free (old_name);
g_free (old_full_name);
g_free (new_full_name);
@@ -1185,12 +1182,9 @@ folder_tree_expand_node (const gchar *key, EMFolderTree *folder_tree)
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;
} else if (!strcmp (uid, "vfolder")) {
@@ -1332,7 +1326,6 @@ tree_drag_data_delete(GtkWidget *widget, GdkDragContext *context, EMFolderTree *
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)))
@@ -1352,10 +1345,8 @@ tree_drag_data_delete(GtkWidget *widget, GdkDragContext *context, EMFolderTree *
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);
@@ -1370,7 +1361,6 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData
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)))
@@ -1391,8 +1381,6 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData
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 */
@@ -1400,7 +1388,7 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData
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);
@@ -1412,8 +1400,6 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData
abort();
}
- if (camel_exception_is_set(&ex))
- camel_exception_clear(&ex);
fail:
gtk_tree_path_free(src_path);
g_free (full_name);
@@ -1448,7 +1434,7 @@ folder_tree_drop_folder(struct _DragDataReceivedAsync *m)
d(printf(" * Drop folder '%s' onto '%s'\n", m->selection->data, m->full_name));
- if (!(src = mail_tool_uri_to_folder((gchar *)m->selection->data, 0, &m->base.ex)))
+ if (!(src = mail_tool_uri_to_folder((gchar *)m->selection->data, 0, NULL)))
return;
em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move);
@@ -1490,14 +1476,16 @@ 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_SYSTEM,
+ _("Cannot drop message(s) into toplevel store"));
+ } else if ((folder = camel_store_get_folder (m->store, m->full_name, 0, NULL))) {
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 */
@@ -2140,11 +2128,10 @@ 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) {
@@ -2496,14 +2483,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);
@@ -2512,9 +2496,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;
}
@@ -2527,14 +2510,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 d96b827..c2f12ad 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -103,7 +103,7 @@ 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)))
+ if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &m->base.error)))
return;
pending = g_list_append (pending, fi);
@@ -143,8 +143,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
if ((info->flags & CAMEL_FOLDER_NOSELECT) == 0) {
d(printf ("this folder is selectable\n"));
if (m->tostore == m->fromstore && m->delete) {
- camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &m->base.ex);
- if (camel_exception_is_set (&m->base.ex))
+ if (camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &m->base.error))
goto exception;
/* this folder no longer exists, unsubscribe it */
@@ -153,19 +152,19 @@ 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)))
+ if (!(fromfolder = camel_store_get_folder (m->fromstore, info->full_name, 0, &m->base.error)))
goto exception;
- if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &m->base.ex))) {
+ if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &m->base.error))) {
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);
@@ -173,7 +172,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);
@@ -262,21 +261,23 @@ 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 *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_error_run (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);
+ if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &error))) {
+ e_error_run (
+ e_shell_get_active_window (NULL),
+ cfd->delete ? "mail:no-move-folder-notexist" :
+ "mail:no-copy-folder-notexist", cfd->fi->full_name,
+ uri, error->message, NULL);
+ g_error_free (error);
goto fail;
}
@@ -284,15 +285,20 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
GtkWidget *w;
w = e_error_new (
- e_shell_get_active_window (NULL), "mail:no-rename-special-folder",
+ e_shell_get_active_window (NULL),
+ "mail:no-rename-special-folder",
cfd->fi->full_name, NULL);
em_utils_show_error_silent (w);
goto fail;
}
- if (!(tostore = camel_session_get_store (session, uri, &ex))) {
- e_error_run (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);
+ if (!(tostore = camel_session_get_store (session, uri, &error))) {
+ e_error_run (
+ 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, error->message, NULL);
+ g_error_free (error);
goto fail;
}
@@ -312,7 +318,6 @@ fail:
g_object_unref(fromstore);
if (tostore)
g_object_unref(tostore);
- camel_exception_clear (&ex);
g_free (cfd);
}
@@ -391,18 +396,19 @@ 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) {
GtkWidget *w;
w = e_error_new (
- e_shell_get_active_window (NULL), "mail:no-delete-folder",
- folder->full_name, camel_exception_get_description (ex), NULL);
+ e_shell_get_active_window (NULL),
+ "mail:no-delete-folder",
+ folder->full_name,
+ error->message, NULL);
em_utils_show_error_silent (w);
- camel_exception_clear (ex);
}
if (dialog)
@@ -493,9 +499,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);
}
}
@@ -579,7 +585,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;
@@ -595,11 +600,8 @@ 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);
+ if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL)))
return;
- }
model = gtk_tree_view_get_model (GTK_TREE_VIEW (emfs->emft));
si = em_folder_tree_model_lookup_store_info (
@@ -632,7 +634,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 */
@@ -675,7 +676,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;
@@ -688,7 +689,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-subscribe-editor.c b/mail/em-subscribe-editor.c
index f187d1c..ecd8888 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -167,9 +167,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
@@ -186,7 +190,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
@@ -347,8 +351,11 @@ sub_folderinfo_exec (struct _emse_folderinfo_msg *m)
if (m->seq == m->sub->seq) {
camel_operation_register(m->base.cancel);
- m->info = camel_store_get_folder_info(m->sub->store, m->node?m->node->info->full_name:pub_full_name,
- CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL | CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST, &m->base.ex);
+ m->info = camel_store_get_folder_info (
+ m->sub->store, m->node ? m->node->info->full_name :
+ pub_full_name, CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL |
+ CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST,
+ &m->base.error);
camel_operation_unregister(m->base.cancel);
}
}
@@ -362,9 +369,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) {
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 9502f72..e8ef993 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -604,9 +604,8 @@ 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 = FALSE;
camel_mime_parser_scan_from(mp, TRUE);
camel_mime_parser_init_with_stream(mp, stream);
@@ -621,21 +620,19 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream)
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;
}
/**
@@ -703,20 +700,17 @@ void
em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder)
{
CamelStream *stream;
- CamelException *ex;
CamelMimeMessage *msg;
if (data->data == NULL || data->length == -1)
return;
- ex = camel_exception_new();
stream = (CamelStream *)camel_stream_mem_new_with_buffer((gchar *)data->data, 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);
+ camel_folder_append_message(folder, msg, NULL, NULL, NULL);
g_object_unref(msg);
g_object_unref(stream);
- camel_exception_free(ex);
}
/**
@@ -756,7 +750,7 @@ em_utils_selection_set_uidlist(GtkSelectionData *data, const gchar *uri, GPtrArr
* Warning: Could take some time to run.
**/
void
-em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint move, CamelException *ex)
+em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint move, GError **error)
{
/* format: "uri\0uid1\0uid2\0uid3\0...\0uidn" */
gchar *inptr, *inend;
@@ -787,9 +781,9 @@ em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, gint m
return;
}
- folder = mail_tool_uri_to_folder((gchar *)data->data, 0, ex);
+ folder = mail_tool_uri_to_folder((gchar *)data->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);
}
@@ -1326,13 +1320,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)) {
@@ -1340,16 +1331,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);
@@ -1401,22 +1389,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);
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 9bb8714..699dceb 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -59,7 +59,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 4d26696..a02d56c 100644
--- a/mail/importers/elm-importer.c
+++ b/mail/importers/elm-importer.c
@@ -208,7 +208,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 3adc629..6215eb9 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -200,7 +200,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;
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index 3ed336a..99c5d35 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -56,7 +56,7 @@ struct _import_mbox_msg {
gchar *uri;
CamelOperation *cancel;
- void (*done)(gpointer data, CamelException *ex);
+ void (*done)(gpointer data, GError *error);
gpointer done_data;
};
@@ -124,7 +124,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;
@@ -179,11 +180,11 @@ 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 +207,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 +228,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 dbd2e7e..a326091 100644
--- a/mail/importers/mail-importer.h
+++ b/mail/importers/mail-importer.h
@@ -39,7 +39,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 66dfaa7..6ef363e 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -250,7 +250,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 438d026..ca0de7a 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -898,7 +898,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 11bb6a6..02dfa1c 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -75,7 +75,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;
@@ -144,7 +143,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);
}
@@ -247,9 +248,9 @@ mail_msg_check_error (gpointer msg)
if (!mail_session_get_interactive ())
return;
- 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, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL)
+ || 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,9 @@ mail_msg_check_error (gpointer msg)
/* we key on the operation pointer, which is at least accurate enough
for the operation type, although it could be on a different object. */
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));
+ g_message (
+ "Error occurred while existing dialogue active:\n%s",
+ m->error->message);
return;
}
@@ -268,10 +271,14 @@ mail_msg_check_error (gpointer msg)
if (m->info->desc
&& (what = m->info->desc (m))) {
- gd = (GtkDialog *)e_error_new(parent, "mail:async-error", what, camel_exception_get_description(&m->ex), NULL);
+ gd = (GtkDialog *) e_error_new (
+ parent, "mail:async-error", what,
+ m->error->message, NULL);
g_free(what);
} else
- gd = (GtkDialog *)e_error_new(parent, "mail:async-error-nodescribe", camel_exception_get_description(&m->ex), NULL);
+ gd = (GtkDialog *) e_error_new (
+ parent, "mail:async-error-nodescribe",
+ 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 ae9f6ab..193ed9d 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; /* upto the caller to use this */
MailMsgPrivate *priv;
};
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index b1eb71a..d033799 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -128,15 +128,15 @@ 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)
@@ -272,20 +272,20 @@ 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_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 = 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
@@ -314,14 +314,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, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL))
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]));
@@ -329,7 +329,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);
}
@@ -458,7 +458,7 @@ 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;
@@ -474,8 +474,9 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
GQueue evo_headers = G_QUEUE_INIT;
GList *link;
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;
@@ -540,12 +541,11 @@ 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;
}
@@ -582,30 +582,34 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
mail_tool_restore_xevolution_headers (message, &evo_headers);
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, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL))
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);
}
}
- camel_exception_clear (ex);
+ g_clear_error (&local_error);
if (xport == NULL
|| !( ((CamelService *)xport)->provider->flags & CAMEL_PROVIDER_DISABLE_SENT_FOLDER)) {
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 (local_error != 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);
}
}
@@ -614,11 +618,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, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL))
goto exit;
sent_folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT);
@@ -629,29 +632,32 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
camel_object_get (folder, NULL, CAMEL_OBJECT_DESCRIPTION, (gchar **) &name, 0);
if (err->len)
g_string_append(err, "\n\n");
- g_string_append_printf (err, _("Failed to append to %s: %s\n"
- "Appending to local `Sent' folder instead."),
- name, camel_exception_get_description (ex));
+ g_string_append_printf (
+ err, _("Failed to append to %s: %s\n"
+ "Appending to local `Sent' folder instead."),
+ name, 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, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL))
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)) {
+
+ 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);
@@ -659,7 +665,11 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
if (err->len) {
/* set the culmulative exception report */
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, err->str);
+ g_clear_error (&local_error);
+ g_set_error (
+ &local_error,
+ CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ "%s", err->str);
}
exit:
@@ -679,7 +689,8 @@ exit:
g_string_free(err, TRUE);
g_object_unref(message);
- return;
+ if (local_error != NULL)
+ g_propagate_error (error, local_error);
}
/* ** SEND MAIL QUEUE ***************************************************** */
@@ -721,8 +732,8 @@ send_queue_exec (struct _send_queue_msg *m)
{
CamelFolder *sent_folder;
GPtrArray *uids, *send_uids = NULL;
- CamelException ex;
gint i, j;
+ GError *error = NULL;
d(printf("sending queue\n"));
@@ -759,8 +770,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. */
@@ -771,21 +780,34 @@ 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) {
- /* 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);
+ mail_send_message (
+ m, m->queue, send_uids->pdata[i],
+ m->destination, m->driver, &error);
+ if (error != NULL) {
+ if (!g_error_matches (error, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL)) {
+ /* merge errors into one */
+ if (m->base.error != NULL) {
+ GError *abused_error = NULL;
+
+ g_set_error (
+ &abused_error,
+ CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ "%s\n\n%s", m->base.error->message,
+ error->message);
+ g_clear_error (&error);
+ g_clear_error (&m->base.error);
+ g_propagate_error (&m->base.error, abused_error);
+ } else {
+ g_propagate_error (&m->base.error, error);
+ 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 error and then break */
+ g_propagate_error (&m->base.error, error);
+ error = NULL;
break;
}
}
@@ -795,7 +817,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, CAMEL_ERROR, CAMEL_ERROR_USER_CANCEL))
report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Canceled."));
else
report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete."));
@@ -808,15 +830,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);
@@ -916,14 +934,16 @@ 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
@@ -994,8 +1014,9 @@ 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) {
@@ -1007,7 +1028,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 */
@@ -1029,7 +1050,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
@@ -1102,18 +1123,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);
}
@@ -1246,7 +1267,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
@@ -1386,7 +1407,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
@@ -1440,7 +1461,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;
};
@@ -1450,22 +1471,21 @@ 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;
+ if (!(folder = camel_store_get_folder (store, fi->full_name, 0, error)))
+ return FALSE;
if (!CAMEL_IS_VEE_FOLDER (folder)) {
GPtrArray *uids = camel_folder_get_uids (folder);
@@ -1487,12 +1507,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
@@ -1505,21 +1526,26 @@ remove_folder_exec (struct _remove_folder_msg *m)
store = m->folder->parent_store;
- fi = camel_store_get_folder_info (store, m->folder->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 (
+ store, m->folder->full_name,
+ CAMEL_STORE_FOLDER_INFO_RECURSIVE |
+ CAMEL_STORE_FOLDER_INFO_FAST |
+ CAMEL_STORE_FOLDER_INFO_SUBSCRIBED,
+ &m->base.error);
+ if (m->base.error != NULL)
return;
- remove_folder_rec (store, fi, &m->base.ex);
+ remove_folder_rec (store, fi, &m->base.error);
camel_store_free_folder_info (store, fi);
- m->removed = !camel_exception_is_set (&m->base.ex);
+ m->removed = (m->base.error == NULL);
}
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
@@ -1537,7 +1563,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;
@@ -1571,7 +1597,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
@@ -1637,7 +1663,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
@@ -1686,10 +1712,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 */
@@ -1725,7 +1751,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 */
@@ -1775,16 +1801,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 = em_utils_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);
}
}
@@ -1851,7 +1877,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
@@ -1901,14 +1927,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 *);
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);
}
}
@@ -1923,7 +1949,7 @@ 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 *),
+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;
@@ -1972,7 +1998,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 +2137,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;
@@ -2126,8 +2152,11 @@ save_messages_exec (struct _save_messages_msg *m)
|| camel_stream_flush(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));
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Error saving messages to: %s:\n %s"),
+ m->path, g_strerror (errno));
g_free(from);
g_object_unref((CamelObject *)message);
break;
@@ -2215,17 +2244,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,
+ CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("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,
+ CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Cannot create output file: %s:\n %s"),
+ path, g_strerror (errno));
if (path != m->path)
g_free (path);
return;
@@ -2238,9 +2271,11 @@ save_part_exec (struct _save_part_msg *m)
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));
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_SYSTEM,
+ _("Could not write data: %s"),
+ g_strerror (errno));
g_object_unref (stream);
}
@@ -2249,7 +2284,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
@@ -2305,14 +2340,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 ... */
@@ -2396,31 +2431,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
@@ -2489,10 +2524,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);
}
}
@@ -2571,13 +2606,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 b2c8bfb..1d0b3d8 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -50,7 +50,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 */
@@ -104,7 +104,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 3b35a85..74a070b 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -125,7 +125,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;
@@ -375,16 +375,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;
@@ -789,7 +786,10 @@ 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;
@@ -801,7 +801,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE
g_mutex_unlock(info->data->lock);
if (oldinfo)
return g_object_ref (oldinfo->folder);
- folder = mail_tool_uri_to_folder (uri, 0, ex);
+ folder = mail_tool_uri_to_folder (uri, 0, error);
if (!folder)
return NULL;
@@ -831,12 +831,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")))
@@ -845,7 +841,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;
@@ -870,23 +865,25 @@ refresh_folders_desc (struct _refresh_folders_msg *m)
static void
refresh_folders_exec (struct _refresh_folders_msg *m)
{
- gint i;
CamelFolder *folder;
- CamelException ex = CAMEL_EXCEPTION_INITIALISER;
+ gint i;
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);
+ GError *error = NULL;
+
+ folder = mail_tool_uri_to_folder (
+ m->folders->pdata[i], 0, &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 (error != NULL) {
+ g_warning (
+ "Failed to refresh folders: %s",
+ error->message);
+ g_error_free (error);
}
if (camel_operation_cancel_check(m->info->cancel))
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 0018c3f..db6e723 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -65,16 +65,16 @@ static gint session_check_junk_notify_id = -1;
static EShellBackend *session_shell_backend;
static gpointer parent_class;
-static gchar *get_password(CamelSession *session, CamelService *service, const gchar *domain, const gchar *prompt, const gchar *item, guint32 flags, CamelException *ex);
-static void 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 void 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 void ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, GError **error);
static void
session_finalize (GObject *object)
@@ -154,8 +154,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;
@@ -245,13 +250,20 @@ 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, CAMEL_ERROR,
+ CAMEL_ERROR_USER_CANCEL,
+ _("User canceled operation."));
return ret;
}
static void
-forget_password (CamelSession *session, CamelService *service, const gchar *domain, const gchar *item, CamelException *ex)
+forget_password (CamelSession *session,
+ CamelService *service,
+ const gchar *domain,
+ const gchar *item,
+ GError **error)
{
gchar *key = make_key (service, item);
@@ -441,9 +453,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
@@ -492,7 +507,9 @@ 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;
@@ -574,10 +591,13 @@ 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,
@@ -616,13 +636,17 @@ static void ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg,
}
static void
-ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, CamelException *ex)
+ms_forward_to (CamelSession *session,
+ CamelFolder *folder,
+ CamelMimeMessage *message,
+ const gchar *address,
+ GError **error)
{
g_return_if_fail (session != NULL);
g_return_if_fail (message != NULL);
g_return_if_fail (address != NULL);
- em_utils_forward_message_raw (folder, message, address, ex);
+ em_utils_forward_message_raw (folder, message, address, error);
}
gchar *
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 1ea73dd..72d9e5a 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -57,16 +57,17 @@
/* **************************************** */
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;
@@ -87,21 +88,24 @@ 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;
@@ -113,7 +117,8 @@ 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;
@@ -129,8 +134,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, 0777) == -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;
}
@@ -145,33 +153,38 @@ 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) {
@@ -180,7 +193,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;
}
@@ -340,7 +353,9 @@ 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;
@@ -359,19 +374,22 @@ 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_SYSTEM,
+ _("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;
@@ -388,11 +406,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 5d2498a..e1543ef 100644
--- a/mail/mail-tools.h
+++ b/mail/mail-tools.h
@@ -26,14 +26,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);
void mail_tool_remove_xevolution_headers
(CamelMimeMessage *message,
@@ -49,7 +49,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 c752377..f5a2511 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -100,12 +100,11 @@ 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);
+ folder = mail_tool_uri_to_folder (l->data, 0, NULL);
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);
}
l = l->next;
}
@@ -258,7 +257,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;
diff --git a/mail/message-list.c b/mail/message-list.c
index aa0d546..b84fa72 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1359,12 +1359,9 @@ get_trimmed_subject (CamelMessageInfo *info)
static gpointer
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) {
@@ -1545,17 +1542,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);
@@ -2075,7 +2071,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);
@@ -2096,7 +2095,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;
}
@@ -3434,15 +3433,12 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
ETreeModel *etm = message_list->model;
gboolean hide_deleted;
GConfClient *gconf;
- CamelException ex;
g_return_if_fail (IS_MESSAGE_LIST (message_list));
if (message_list->folder == folder)
return;
- camel_exception_init (&ex);
-
/* remove the cursor activate idle handler */
if (message_list->idle_id != 0) {
g_source_remove (message_list->idle_id);
@@ -4304,7 +4300,8 @@ regen_list_exec (struct _regen_list_msg *m)
if (expr == NULL) {
uids = camel_folder_get_uids (m->folder);
} else {
- 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. */
@@ -4342,14 +4339,13 @@ regen_list_exec (struct _regen_list_msg *m)
}
}
- if (camel_exception_is_set (&m->base.ex))
+ if (m->base.error != NULL)
return;
/* perform hiding */
if (m->hideexpr && camel_folder_has_search_capability(m->folder)) {
- uidnew = camel_folder_search_by_expression (m->ml->folder, m->hideexpr, &m->base.ex);
- /* well, lets not abort just because this faileld ... */
- camel_exception_clear (&m->base.ex);
+ uidnew = camel_folder_search_by_expression (
+ m->ml->folder, m->hideexpr, NULL);
if (uidnew) {
MESSAGE_LIST_LOCK(m->ml, hide_lock);
@@ -4449,16 +4445,9 @@ regen_list_exec (struct _regen_list_msg *m)
} else {
camel_folder_sort_uids (m->ml->folder, showuids);
m->summary = g_ptr_array_new ();
- if (showuids->len > camel_folder_summary_cache_size (m->folder->summary) ) {
- CamelException ex;
- camel_exception_init (&ex);
- camel_folder_summary_reload_from_db (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);
- }
+ if (showuids->len > camel_folder_summary_cache_size (m->folder->summary))
+ camel_folder_summary_reload_from_db (m->folder->summary, NULL);
- }
for (i = 0; i < showuids->len; i++) {
info = camel_folder_get_message_info (m->folder, showuids->pdata[i]);
if (info)
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c
index 92233fc..794ee78 100644
--- a/modules/mail/e-mail-attachment-handler.c
+++ b/modules/mail/e-mail-attachment-handler.c
@@ -222,7 +222,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;
@@ -237,6 +236,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
gpointer parent;
gint length;
guint ii;
+ GError *error = NULL;
if (G_UNLIKELY (atom == GDK_NONE))
atom = gdk_atom_intern_static_string ("x-uid-list");
@@ -277,14 +277,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, &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], &error);
if (message == NULL)
goto exit;
@@ -308,7 +308,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], &error);
if (message == NULL) {
g_object_unref (multipart);
goto exit;
@@ -347,7 +347,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view,
g_object_unref (multipart);
exit:
- if (camel_exception_is_set (&ex)) {
+ if (error != NULL) {
gchar *folder_name;
if (folder != NULL)
@@ -359,8 +359,7 @@ exit:
e_error_run (
parent, "mail-composer:attach-nomessages",
- folder_name, camel_exception_get_description (&ex),
- NULL);
+ folder_name, error->message, NULL);
if (folder != NULL)
camel_object_free (
@@ -368,7 +367,7 @@ exit:
else
g_free (folder_name);
- camel_exception_clear (&ex);
+ g_error_free (error);
}
if (folder != NULL)
diff --git a/modules/mail/e-mail-shell-migrate.c b/modules/mail/e-mail-shell-migrate.c
index 2e0b73b..083fa1c 100644
--- a/modules/mail/e-mail-shell-migrate.c
+++ b/modules/mail/e-mail-shell-migrate.c
@@ -1520,11 +1520,13 @@ mbox_build_filename (GString *path, const gchar *toplevel_dir, const gchar *full
}
static gboolean
-em_migrate_folder(EMMigrateSession *session, const gchar *dirname, const gchar *full_name, GError **error)
+em_migrate_folder (EMMigrateSession *session,
+ const gchar *dirname,
+ const gchar *full_name,
+ GError **error)
{
CamelFolder *old_folder = NULL, *new_folder = NULL;
CamelStore *local_store = NULL;
- CamelException ex;
gchar *name, *uri;
GPtrArray *uids;
struct stat st;
@@ -1533,8 +1535,6 @@ em_migrate_folder(EMMigrateSession *session, const gchar *dirname, const gchar *
GString *src, *dest;
gboolean success = FALSE;
- camel_exception_init (&ex);
-
src = g_string_new("");
g_string_printf(src, "%s/folder-metadata.xml", dirname);
@@ -1666,12 +1666,12 @@ em_migrate_folder(EMMigrateSession *session, const gchar *dirname, const gchar *
} else {
guint32 flags = CAMEL_STORE_FOLDER_CREATE;
- if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, &ex))
- || !(old_folder = camel_store_get_folder (local_store, name, 0, &ex)))
+ if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, error))
+ || !(old_folder = camel_store_get_folder (local_store, name, 0, error)))
goto fatal;
flags |= (index ? CAMEL_STORE_FOLDER_BODY_INDEX : 0);
- if (!(new_folder = camel_store_get_folder (session->store, full_name, flags, &ex)))
+ if (!(new_folder = camel_store_get_folder (session->store, full_name, flags, error)))
goto fatal;
if (!thread_list) {
@@ -1687,17 +1687,17 @@ em_migrate_folder(EMMigrateSession *session, const gchar *dirname, const gchar *
if (!(info = camel_folder_get_message_info (old_folder, uids->pdata[i])))
continue;
- if (!(message = camel_folder_get_message (old_folder, uids->pdata[i], &ex))) {
+ if (!(message = camel_folder_get_message (old_folder, uids->pdata[i], error))) {
camel_folder_free_message_info (old_folder, info);
camel_folder_free_uids (old_folder, uids);
goto fatal;
}
- camel_folder_append_message (new_folder, message, info, NULL, &ex);
+ success = camel_folder_append_message (new_folder, message, info, NULL, error);
camel_folder_free_message_info (old_folder, info);
g_object_unref (message);
- if (camel_exception_is_set (&ex))
+ if (!success)
break;
em_migrate_set_progress (((double) i + 1) / ((double) uids->len));
@@ -1705,7 +1705,7 @@ em_migrate_folder(EMMigrateSession *session, const gchar *dirname, const gchar *
camel_folder_free_uids (old_folder, uids);
- if (camel_exception_is_set (&ex))
+ if (!success)
goto fatal;
}
success = TRUE;
@@ -1721,14 +1721,6 @@ fatal:
if (new_folder)
g_object_unref(new_folder);
- if (camel_exception_is_set (&ex)) {
- g_set_error (
- error, E_SHELL_MIGRATE_ERROR,
- E_SHELL_MIGRATE_ERROR_FAILED,
- "%s", camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- }
-
return success;
}
@@ -2506,10 +2498,10 @@ static gboolean
em_migrate_1_4 (const gchar *data_dir, xmlDocPtr filters, xmlDocPtr vfolders, GError **error)
{
EMMigrateSession *session;
- CamelException lex;
struct stat st;
gchar *path;
xmlDocPtr searches;
+ GError *local_error = NULL;
camel_init (data_dir, TRUE);
camel_provider_init();
@@ -2532,16 +2524,15 @@ em_migrate_1_4 (const gchar *data_dir, xmlDocPtr filters, xmlDocPtr vfolders, GE
}
}
- camel_exception_init (&lex);
- if (!(session->store = camel_session_get_store ((CamelSession *) session, path, &lex))) {
+ if (!(session->store = camel_session_get_store ((CamelSession *) session, path, &local_error))) {
g_set_error (
error, E_SHELL_MIGRATE_ERROR,
E_SHELL_MIGRATE_ERROR_FAILED,
_("Failed to create local mail storage `%s': %s"),
- path, lex.desc);
+ path, local_error->message);
g_free (session->srcdir);
g_object_unref (session);
- camel_exception_clear (&lex);
+ g_clear_error (&local_error);
g_free (path);
return FALSE;
}
@@ -2793,7 +2784,14 @@ update_progress_in_main_thread (double *progress)
}
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,
+ GError **error,
+ gboolean *done,
+ gint *nth_folder,
+ gint total_folders)
{
CamelFolder *folder;
@@ -2811,13 +2809,18 @@ migrate_folders(CamelStore *store, gboolean is_local, CamelFolderInfo *fi, const
g_idle_add ((GSourceFunc) update_progress_in_main_thread, &progress);
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, error);
else
- folder = camel_store_get_folder (store, fi->full_name, 0, ex);
+ folder = camel_store_get_folder (
+ store, fi->full_name, 0, error);
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, error,
+ done, nth_folder, total_folders);
fi = fi->next;
}
@@ -2859,9 +2862,9 @@ setup_local_store (EShellBackend *shell_backend,
struct migrate_folders_to_db_structure {
gchar *account_name;
- CamelException ex;
CamelStore *store;
CamelFolderInfo *info;
+ GError *error;
gboolean done;
gboolean is_local_store;
};
@@ -2871,9 +2874,14 @@ 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->error,
+ &migrate_dbs->done,
+ &nth_folder, num_of_folders);
}
static void
@@ -2913,7 +2921,7 @@ 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.error = NULL;
migrate_dbs.account_name = _("On This Computer");
migrate_dbs.info = info;
migrate_dbs.store = store;
@@ -2939,18 +2947,22 @@ 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) {
GThread *thread;
struct migrate_folders_to_db_structure migrate_dbs;
- migrate_dbs.ex = ex;
+ migrate_dbs.error = NULL;
migrate_dbs.account_name = account->name;
migrate_dbs.info = info;
migrate_dbs.store = store;
@@ -2961,8 +2973,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/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c
index c8df77b..8d3f2f9 100644
--- a/plugins/groupwise-features/install-shared.c
+++ b/plugins/groupwise-features/install-shared.c
@@ -60,7 +60,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;
@@ -93,9 +92,10 @@ 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;
}
@@ -118,9 +118,7 @@ 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);
+ if (!(provider = camel_provider_get (uri, NULL))) {
g_strfreev (names);
return;
}
diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c
index d322331..53aed8a 100644
--- a/plugins/groupwise-features/proxy.c
+++ b/plugins/groupwise-features/proxy.c
@@ -635,7 +635,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;
@@ -643,11 +642,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://"))
{
@@ -710,7 +709,6 @@ 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 4306c7c..6e6b62a 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/share-folder-common.c
@@ -68,7 +68,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);
@@ -80,11 +79,8 @@ 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);
+ if (!(provider = camel_provider_get(uri, NULL)))
return;
- }
if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
return;
em_folder_tree_model_add_store (model, store, account->name);
@@ -143,9 +139,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);
}
}
@@ -238,7 +234,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) {
@@ -252,11 +247,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 ();
@@ -291,7 +285,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);
@@ -302,11 +295,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/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c
index e5eafd7..30930d4 100644
--- a/plugins/imap-features/imap-headers.c
+++ b/plugins/imap-features/imap-headers.c
@@ -80,7 +80,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;
@@ -90,7 +89,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)) {
@@ -253,7 +252,6 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data)
EAccount *account;
GtkWidget *vbox;
CamelURL *url = NULL;
- CamelException ex;
GtkBuilder *builder;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -282,7 +280,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/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index d5036c0..cd77bc3 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -50,7 +50,7 @@ gboolean e_plugin_ui_init (GtkUIManager *ui_manager,
EShellView *shell_view);
static void mar_got_folder (gchar *uri, CamelFolder *folder, gpointer data);
-static void mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex);
+static gboolean mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, GError **error);
static void
button_clicked_cb (GtkButton *button,
@@ -216,11 +216,12 @@ mark_all_as_read (CamelFolder *folder)
}
static void
-mar_got_folder (gchar *uri, CamelFolder *folder, gpointer data)
+mar_got_folder (gchar *uri,
+ CamelFolder *folder,
+ gpointer data)
{
CamelFolderInfo *info;
CamelStore *store;
- CamelException ex;
gint response;
guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST;
@@ -228,12 +229,10 @@ mar_got_folder (gchar *uri, CamelFolder *folder, gpointer data)
if (!folder)
return;
- camel_exception_init (&ex);
-
store = folder->parent_store;
- info = camel_store_get_folder_info (store, folder->full_name, flags, &ex);
-
- if (camel_exception_is_set (&ex))
+ info = camel_store_get_folder_info (
+ store, folder->full_name, flags, NULL);
+ if (info == NULL)
goto out;
if (info && (info->child || info->next))
@@ -244,36 +243,43 @@ mar_got_folder (gchar *uri, CamelFolder *folder, gpointer data)
if (response == GTK_RESPONSE_NO)
mark_all_as_read (folder);
else if (response == GTK_RESPONSE_YES)
- mar_all_sub_folders (store, info, &ex);
+ mar_all_sub_folders (store, info, NULL);
out:
camel_store_free_folder_info(store, info);
}
-static void
-mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
+static gboolean
+mar_all_sub_folders (CamelStore *store,
+ CamelFolderInfo *fi,
+ 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 (fi->child)
+ 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
-has_unread_mail (GtkTreeModel *model, GtkTreeIter *parent, gboolean is_root, gboolean *has_unread, gboolean *applicable)
+has_unread_mail (GtkTreeModel *model,
+ GtkTreeIter *parent,
+ gboolean is_root,
+ gboolean *has_unread,
+ gboolean *applicable)
{
guint unread = 0;
GtkTreeIter iter, child;
@@ -348,7 +354,7 @@ static GtkActionEntry entries[] = {
};
static void
-update_actions_cb (EShellView *shell_view, gpointer user_data)
+update_actions_cb (EShellView *shell_view)
{
GtkActionGroup *action_group;
EShellWindow *shell_window;
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index c745ae2..eee8183 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -110,7 +110,6 @@ struct _PstImporter {
gint status_pc;
gint status_timeout_id;
CamelOperation *status;
- CamelException ex;
pst_file pst;
@@ -447,7 +446,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);
@@ -698,7 +697,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 = '/';
}
@@ -710,7 +709,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);
}
@@ -910,19 +909,12 @@ 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);
+ 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)) {
- g_critical ("Exception!");
- camel_exception_clear (&m->ex);
- return;
- }
-
}
static void
diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c
index 5e85566..8a81ca1 100644
--- a/plugins/tnef-attachments/tnef-plugin.c
+++ b/plugins/tnef-attachments/tnef-plugin.c
@@ -159,7 +159,7 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
g_free(path);
camel_multipart_add_part(mp, part);
- camel_object_unref(part);
+ g_object_unref(part);
}
closedir(dir);
diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c
index c650761..38707e3 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]