aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-07-05 05:40:28 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-07-09 02:37:52 +0800
commit137b0743ddfbd3bbc01c9813615ede91ddd9b954 (patch)
tree1d8e09ba0239eff419d432bdd8d5b521fbb727ba /plugins
parent36f1f29b9a42c56a619e031b045db5a18f2b1dd7 (diff)
downloadgsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar.gz
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar.bz2
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar.lz
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar.xz
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar.zst
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.zip
Migrate from CamelException to GError.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/audio-inline/audio-inline.c6
-rw-r--r--plugins/bogo-junk-plugin/bf-junk-filter.c13
-rw-r--r--plugins/dbx-import/dbx-importer.c124
-rw-r--r--plugins/groupwise-features/install-shared.c16
-rw-r--r--plugins/groupwise-features/proxy.c11
-rw-r--r--plugins/groupwise-features/share-folder-common.c28
-rw-r--r--plugins/image-inline/image-inline.c2
-rw-r--r--plugins/imap-features/imap-headers.c6
-rw-r--r--plugins/itip-formatter/itip-formatter.c4
-rw-r--r--plugins/mail-to-task/mail-to-task.c2
-rw-r--r--plugins/mark-all-read/mark-all-read.c29
-rw-r--r--plugins/pst-import/pst-importer.c22
-rw-r--r--plugins/sa-junk-plugin/em-junk-filter.c11
-rw-r--r--plugins/templates/templates.c7
-rw-r--r--plugins/tnef-attachments/tnef-plugin.c10
-rw-r--r--plugins/vcard-inline/vcard-inline.c2
16 files changed, 159 insertions, 134 deletions
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c
index 983bf12438..802490ab0e 100644
--- a/plugins/audio-inline/audio-inline.c
+++ b/plugins/audio-inline/audio-inline.c
@@ -208,10 +208,10 @@ org_gnome_audio_inline_play_clicked (GtkWidget *button, EMFormatHTMLPObject *pob
d(printf ("audio inline formatter: write to temp file %s\n", po->filename));
- stream = camel_stream_fs_new_with_name (po->filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
+ stream = camel_stream_fs_new_with_name (po->filename, O_RDWR | O_CREAT | O_TRUNC, 0600, NULL);
data = camel_medium_get_content (CAMEL_MEDIUM (po->part));
- camel_data_wrapper_decode_to_stream (data, stream);
- camel_stream_flush (stream);
+ camel_data_wrapper_decode_to_stream (data, stream, NULL);
+ camel_stream_flush (stream, NULL);
g_object_unref (stream);
d(printf ("audio inline formatter: init gst playbin\n"));
diff --git a/plugins/bogo-junk-plugin/bf-junk-filter.c b/plugins/bogo-junk-plugin/bf-junk-filter.c
index 6cc2e80d4d..2bd72f96cd 100644
--- a/plugins/bogo-junk-plugin/bf-junk-filter.c
+++ b/plugins/bogo-junk-plugin/bf-junk-filter.c
@@ -83,7 +83,7 @@ static gboolean em_junk_bf_unicode = TRUE;
static void
init_db (void)
{
- CamelStream *stream = camel_stream_fs_new_with_name (WELCOME_MESSAGE, O_RDONLY, 0);
+ CamelStream *stream = camel_stream_fs_new_with_name (WELCOME_MESSAGE, O_RDONLY, 0, NULL);
CamelMimeParser *parser = camel_mime_parser_new ();
CamelMimeMessage *msg = camel_mime_message_new ();
const gchar *argv[] = {
@@ -93,11 +93,11 @@ init_db (void)
NULL
};
- camel_mime_parser_init_with_stream (parser, stream);
+ camel_mime_parser_init_with_stream (parser, stream, NULL);
camel_mime_parser_scan_from (parser, FALSE);
g_object_unref (stream);
- camel_mime_part_construct_from_parser ((CamelMimePart *) msg, parser);
+ camel_mime_part_construct_from_parser ((CamelMimePart *) msg, parser, NULL);
g_object_unref (parser);
d(fprintf (stderr, "Initing the bogofilter DB with Welcome message\n"));
@@ -164,9 +164,10 @@ retry:
}
stream = camel_stream_fs_new_with_fd (bf_in);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream);
- camel_stream_flush (stream);
- camel_stream_close (stream);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (msg), stream, NULL);
+ camel_stream_flush (stream, NULL);
+ camel_stream_close (stream, NULL);
g_object_unref (stream);
#ifndef G_OS_WIN32
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index 8126e85dfd..608a981a46 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -105,7 +105,6 @@ typedef struct {
gint status_pc;
gint status_timeout_id;
CamelOperation *status;
- CamelException ex;
guint32 *indices;
guint32 index_count;
@@ -310,7 +309,9 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
d(printf("Loading index table at 0x%x\n", pos));
if (dbx_pread(m->dbx_fd, &tindex, sizeof(tindex), pos) != sizeof(tindex)) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read table index from DBX file");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read table index from DBX file");
return FALSE;
}
tindex.anotherTablePtr = GUINT32_FROM_LE(tindex.anotherTablePtr);
@@ -318,8 +319,10 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
tindex.indexCount = GUINT32_FROM_LE(tindex.indexCount);
if (tindex.self != pos) {
- camel_exception_setv(&m->base.ex, 1, "Corrupt DBX file: Index table at 0x%x does not point to itself",
- pos);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Index table at 0x%x does not "
+ "point to itself", pos);
return FALSE;
}
@@ -336,7 +339,10 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
for (i = 0; i < tindex.ptrCount; i++) {
if (dbx_pread(m->dbx_fd, &index, sizeof(index), pos) != sizeof(index)) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read index entry from DBX file");
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read index entry from DBX file");
return FALSE;
}
index.indexptr = GUINT32_FROM_LE(index.indexptr);
@@ -344,9 +350,12 @@ static gboolean dbx_load_index_table(DbxImporter *m, guint32 pos, guint32 *index
index.indexCount = GUINT32_FROM_LE(index.indexCount);
if (*index_ofs == m->index_count) {
- camel_exception_setv(&m->base.ex, 1,
- "Corrupt DBX file: Seems to contain more than %d entries claimed in its header\n",
- m->index_count);
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Seems to contain more "
+ "than %d entries claimed in its header",
+ m->index_count);
return FALSE;
}
m->indices[(*index_ofs)++] = index.indexptr;
@@ -364,12 +373,16 @@ static gboolean dbx_load_indices(DbxImporter *m)
guint32 index_ofs = 0;
if (dbx_pread(m->dbx_fd, &indexptr, 4, INDEX_POINTER) != 4) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read first index pointer from DBX file");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read first index pointer from DBX file");
return FALSE;
}
if (dbx_pread(m->dbx_fd, &itemcount, 4, ITEM_COUNT) != 4) {
- camel_exception_setv(&m->base.ex, 1, "Failed to read item count from DBX file");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read item count from DBX file");
return FALSE;
}
@@ -385,9 +398,10 @@ static gboolean dbx_load_indices(DbxImporter *m)
d(printf("Loaded %d of %d indices\n", index_ofs, m->index_count));
if (index_ofs < m->index_count) {
- camel_exception_setv(&m->base.ex, 1,
- "Corrupt DBX file: Seems to contain fewer than %d entries claimed in its header\n",
- m->index_count);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Seems to contain fewer than %d "
+ "entries claimed in its header", m->index_count);
return FALSE;
}
return TRUE;
@@ -410,9 +424,11 @@ dbx_read_mail_body (DbxImporter *m, guint32 offset, gint bodyfd)
d(printf("Reading mail data chunk from %x\n", offset));
if (dbx_pread(m->dbx_fd, &hdr, sizeof(hdr), offset) != sizeof(hdr)) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail data block from DBX file at offset %x\n",
- offset);
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail data block from "
+ "DBX file at offset %x", offset);
return FALSE;
}
hdr.self = GUINT32_FROM_LE(hdr.self);
@@ -420,9 +436,11 @@ dbx_read_mail_body (DbxImporter *m, guint32 offset, gint bodyfd)
hdr.nextaddress = GUINT32_FROM_LE(hdr.nextaddress);
if (hdr.self != offset) {
- camel_exception_setv(&m->base.ex, 1,
- "Corrupt DBX file: Mail data block at 0x%x does not point to itself",
- offset);
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Mail data block at "
+ "0x%x does not point to itself", offset);
return FALSE;
}
@@ -433,15 +451,19 @@ dbx_read_mail_body (DbxImporter *m, guint32 offset, gint bodyfd)
}
d(printf("Reading %d bytes from %lx\n", hdr.blocksize, offset + sizeof(hdr)));
if (dbx_pread(m->dbx_fd, buffer, hdr.blocksize, offset + sizeof(hdr)) != hdr.blocksize) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail data from DBX file at offset %x\n",
- offset + sizeof(hdr));
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail data from DBX file "
+ "at offset %x",
+ offset + sizeof(hdr));
return FALSE;
}
if (write(bodyfd, buffer, hdr.blocksize) != hdr.blocksize) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to write mail data to temporary file\n",
- offset + sizeof(hdr));
+ g_set_error (
+ &m->base.error,
+ CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to write mail data to temporary file");
return FALSE;
}
offset = hdr.nextaddress;
@@ -458,25 +480,29 @@ dbx_read_email (DbxImporter *m, guint32 offset, gint bodyfd, gint *flags)
int i;
if (dbx_pread(m->dbx_fd, &hdr, sizeof(hdr), offset) != sizeof(hdr)) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail header from DBX file at offset %x\n",
- offset);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail header from DBX file at offset %x",
+ offset);
return FALSE;
}
hdr.self = GUINT32_FROM_LE(hdr.self);
hdr.size = GUINT32_FROM_LE(hdr.size);
if (hdr.self != offset) {
- camel_exception_setv(&m->base.ex, 1, "Corrupt DBX file: Mail header at 0x%x does not point to itself",
- offset);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Corrupt DBX file: Mail header at 0x%x does not "
+ "point to itself", offset);
return FALSE;
}
buffer = g_malloc(hdr.size);
offset += sizeof(hdr);
if (dbx_pread(m->dbx_fd, buffer, hdr.size, offset) != hdr.size) {
- camel_exception_setv(&m->base.ex, 1,
- "Failed to read mail data block from DBX file at offset %x\n",
- offset);
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to read mail data block from DBX file "
+ "at offset %x", offset);
g_free(buffer);
return FALSE;
}
@@ -529,7 +555,7 @@ dbx_import_file (DbxImporter *m)
m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */
camel_operation_start (NULL, _("Importing '%s'"), filename);
- folder = mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ folder = mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
if (!folder)
return;
d(printf("importing to %s\n", camel_folder_get_full_name(folder)));
@@ -541,7 +567,9 @@ dbx_import_file (DbxImporter *m)
g_free (filename);
if (m->dbx_fd == -1) {
- camel_exception_setv(&m->base.ex, 1, "Failed to open import file\n");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to open import file");
goto out;
}
@@ -550,7 +578,9 @@ dbx_import_file (DbxImporter *m)
tmpfile = e_mkstemp("dbx-import-XXXXXX");
if (tmpfile == -1) {
- camel_exception_setv(&m->base.ex, 1, "Failed to create temporary file for import\n");
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "Failed to create temporary file for import");
goto out;
}
@@ -560,6 +590,7 @@ dbx_import_file (DbxImporter *m)
CamelMimeParser *mp;
gint dbx_flags = 0;
gint flags = 0;
+ gboolean success;
camel_operation_progress(NULL, 100 * i / m->index_count);
camel_operation_progress(m->status, 100 * i / m->index_count);
@@ -567,7 +598,7 @@ dbx_import_file (DbxImporter *m)
if (!dbx_read_email(m, m->indices[i], tmpfile, &dbx_flags)) {
d(printf("Cannot read email index %d at %x\n",
i, m->indices[i]));
- if (camel_exception_is_set(&m->base.ex))
+ if (m->base.error != NULL)
goto out;
missing++;
continue;
@@ -585,7 +616,7 @@ dbx_import_file (DbxImporter *m)
camel_mime_parser_init_with_fd(mp, tmpfile);
msg = camel_mime_message_new();
- if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) {
+ if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp, NULL) == -1) {
/* set exception? */
g_object_unref (msg);
g_object_unref (mp);
@@ -594,11 +625,12 @@ dbx_import_file (DbxImporter *m)
info = camel_message_info_new(NULL);
camel_message_info_set_flags(info, flags, ~0);
- camel_folder_append_message(folder, msg, info, NULL, &m->base.ex);
+ success = camel_folder_append_message (
+ folder, msg, info, NULL, &m->base.error);
camel_message_info_free(info);
g_object_unref (msg);
-
- if (camel_exception_is_set(&m->base.ex)) {
+
+ if (!success) {
g_object_unref(mp);
break;
}
@@ -611,10 +643,12 @@ dbx_import_file (DbxImporter *m)
camel_folder_sync(folder, FALSE, NULL);
camel_folder_thaw(folder);
g_object_unref(folder);
- if (missing && !camel_exception_is_set(&m->base.ex)) {
- camel_exception_setv(&m->base.ex, 1,
- "%d messages imported correctly; %d message bodies were not present in the DBX file",
- m->index_count - missing, missing);
+ if (missing && m->base.error == NULL) {
+ g_set_error (
+ &m->base.error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ "%d messages imported correctly; %d message "
+ "bodies were not present in the DBX file",
+ m->index_count - missing, missing);
}
camel_operation_end(NULL);
}
diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c
index d2addbf095..55a3fb1664 100644
--- a/plugins/groupwise-features/install-shared.c
+++ b/plugins/groupwise-features/install-shared.c
@@ -58,7 +58,6 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
gchar *parent_name;
gchar *container_id;
const gchar *item_id;
- CamelException ex;
CamelStore *store;
CamelFolder *folder;
EAccount *account;
@@ -91,9 +90,9 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
else
parent_name = NULL;
}
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL) {
g_strfreev (names);
return;
}
@@ -116,9 +115,8 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
account = mail_config_get_account_by_source_url (uri);
uri = account->source->url;
em_folder_tree_model_remove_store (model, store);
- camel_exception_init (&ex);
- if (!(provider = camel_provider_get(uri, &ex))) {
- camel_exception_clear (&ex);
+ provider = camel_provider_get (uri, NULL);
+ if (provider == NULL) {
g_strfreev (names);
return;
}
@@ -208,8 +206,8 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target)
byte_array = g_byte_array_new ();
stream = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_write_to_stream (dw, stream);
- camel_stream_write (stream, "", 1);
+ camel_data_wrapper_write_to_stream (dw, stream, NULL);
+ camel_stream_write (stream, "", 1, NULL);
from_addr = camel_mime_message_get_from ((CamelMimeMessage *)target->message);
if (from_addr && camel_internet_address_get(from_addr, 0, &name, &email)) {
diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c
index c539974564..fb0e786239 100644
--- a/plugins/groupwise-features/proxy.c
+++ b/plugins/groupwise-features/proxy.c
@@ -642,7 +642,6 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
proxyDialog *prd;
proxyDialogPrivate *priv;
CamelOfflineStore *store;
- CamelException ex;
gint pag_num;
target_account = (EMConfigTargetAccount *)data->config->target;
@@ -650,11 +649,11 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
/* We are using some g_object_set on this. We shuold also avoid double-free later. So reffing */
g_object_ref (account);
- camel_exception_init (&ex);
- if (!(store = (CamelOfflineStore *) camel_session_get_service (session, e_account_get_string(account, E_ACCOUNT_SOURCE_URL), CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelOfflineStore *) camel_session_get_service (
+ session, e_account_get_string (account, E_ACCOUNT_SOURCE_URL),
+ CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return NULL;
- }
if (g_strrstr (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), "groupwise://"))
{
@@ -717,7 +716,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
}
g_object_unref (store);
- camel_exception_clear (&ex);
+
return NULL;
}
diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c
index 91758da535..532316599c 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/share-folder-common.c
@@ -66,7 +66,6 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
{
gchar *uri;
EAccount *account;
- CamelException ex;
CamelProvider *provider;
uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL);
@@ -78,11 +77,10 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
uri = account->source->url;
em_folder_tree_model_remove_store (model, store);
- camel_exception_init (&ex);
- if (!(provider = camel_provider_get(uri, &ex))) {
- camel_exception_clear (&ex);
+ provider = camel_provider_get (uri, NULL);
+ if (provider == NULL)
return;
- }
+
if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
return;
em_folder_tree_model_add_store (model, store, account->name);
@@ -143,9 +141,9 @@ create_folder_exec (struct _EMCreateFolder *m)
{
d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name));
- if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.ex))) {
+ if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.error))) {
if (camel_store_supports_subscriptions (m->store))
- camel_store_subscribe_folder (m->store, m->full_name, &m->base.ex);
+ camel_store_subscribe_folder (m->store, m->full_name, &m->base.error);
}
}
@@ -239,7 +237,6 @@ users_dialog_response(GtkWidget *dialog, gint response, struct ShareInfo *ssi)
struct _EMFolderTreeModelStoreInfo *si;
EMFolderSelector *emfs = ssi->emfs;
const gchar *uri, *path;
- CamelException ex;
CamelStore *store;
if (response != GTK_RESPONSE_OK) {
@@ -253,11 +250,10 @@ users_dialog_response(GtkWidget *dialog, gint response, struct ShareInfo *ssi)
d(printf ("Creating new folder: %s (%s)\n", path, uri));
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return;
- }
if (!(si = em_folder_tree_model_lookup_store_info (ssi->model, store))) {
g_assert_not_reached ();
@@ -293,7 +289,6 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m
struct ShareInfo *ssi;
const gchar *uri;
EGwConnection *cnc;
- CamelException ex;
CamelStore *store;
ssi = g_new0(struct ShareInfo, 1);
@@ -304,11 +299,10 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m
/* i want store at this point to get cnc not sure proper or not*/
uri = em_folder_selector_get_selected_uri (emfs);
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return;
- }
cnc = get_cnc (store);
users_dialog = gtk_dialog_new_with_buttons (
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index 5548948f1a..41b4a898dd 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -361,7 +361,7 @@ org_gnome_image_inline_decode (ImageInlinePObject *image_object)
/* Stream takes ownership of the byte array. */
stream = camel_stream_mem_new_with_byte_array (array);
data_wrapper = camel_medium_get_content (medium);
- camel_data_wrapper_decode_to_stream (data_wrapper, stream);
+ camel_data_wrapper_decode_to_stream (data_wrapper, stream, NULL);
/* Don't trust the content type in the MIME part. It could
* be lying or it could be "application/octet-stream". Let
diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c
index 910986e592..f03c08e919 100644
--- a/plugins/imap-features/imap-headers.c
+++ b/plugins/imap-features/imap-headers.c
@@ -88,7 +88,6 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data)
EAccount *temp = NULL;
EAccountList *accounts = e_get_account_list ();
CamelURL *url = NULL;
- CamelException ex;
GtkTreeModel *model;
GtkTreeIter iter;
GString *str;
@@ -98,7 +97,7 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data)
temp = mail_config_get_account_by_source_url (account->source->url);
- url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), &ex);
+ url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), NULL);
model = gtk_tree_view_get_model (ui->custom_headers_tree);
if (gtk_tree_model_get_iter_first(model, &iter)) {
@@ -261,7 +260,6 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data)
EAccount *account;
GtkWidget *vbox;
CamelURL *url = NULL;
- CamelException ex;
GtkBuilder *builder;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -290,7 +288,7 @@ org_gnome_imap_headers (EPlugin *epl, EConfigHookItemFactoryData *data)
ui->remove_header = GTK_BUTTON(e_builder_get_widget (builder, "removeHeader"));
ui->entry_header = GTK_ENTRY (e_builder_get_widget (builder, "customHeaderEntry"));
- url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), &ex);
+ url = camel_url_new (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), NULL);
ui->store = gtk_tree_store_new (1, G_TYPE_STRING);
gtk_tree_view_set_model (ui->custom_headers_tree, GTK_TREE_MODEL(ui->store));
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index c2e38464ec..cbefc53bc4 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2569,7 +2569,7 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target)
byte_array = g_byte_array_new ();
stream = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_decode_to_stream (content, stream);
+ camel_data_wrapper_decode_to_stream (content, stream, NULL);
if (byte_array->len == 0)
puri->vcalendar = NULL;
@@ -2751,6 +2751,6 @@ itip_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
d(printf("writing to frame content, handler is '%s'\n", info->handle->mime_type));
info->handle->handler(emf, stream, info->puri.part, info->handle, FALSE);
- camel_stream_close(stream);
+ camel_stream_close(stream, NULL);
}
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 55a230a33f..504dca64a0 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -203,7 +203,7 @@ set_description (ECalComponent *comp, CamelMimeMessage *message)
byte_array = g_byte_array_new ();
stream = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_decode_to_stream (content, stream);
+ camel_data_wrapper_decode_to_stream (content, stream, NULL);
str = g_strndup ((gchar *) byte_array->data, byte_array->len);
g_object_unref (stream);
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 826a596be6..8e7c158cc0 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -343,29 +343,31 @@ mark_all_as_read (CamelFolder *folder)
camel_folder_free_uids (folder, uids);
}
-static void
+static gboolean
mar_all_sub_folders (CamelStore *store,
CamelFolderInfo *fi,
- CamelException *ex)
+ GError **error)
{
while (fi) {
CamelFolder *folder;
if (fi->child) {
- mar_all_sub_folders (store, fi->child, ex);
- if (camel_exception_is_set (ex))
- return;
+ if (!mar_all_sub_folders (store, fi->child, error))
+ return FALSE;
}
- if (!(folder = camel_store_get_folder (store, fi->full_name, 0, ex)))
- return;
+ folder = camel_store_get_folder (
+ store, fi->full_name, 0, error);
+ if (folder == NULL)
+ return FALSE;
- if (!CAMEL_IS_VEE_FOLDER (folder)) {
+ if (!CAMEL_IS_VEE_FOLDER (folder))
mark_all_as_read (folder);
- }
fi = fi->next;
}
+
+ return TRUE;
}
static void
@@ -375,7 +377,6 @@ mar_got_folder (gchar *folder_uri,
{
CamelFolderInfo *folder_info;
CamelStore *parent_store;
- CamelException ex;
const gchar *full_name;
gint response;
@@ -383,17 +384,15 @@ mar_got_folder (gchar *folder_uri,
if (!folder)
return;
- camel_exception_init (&ex);
-
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
folder_info = camel_store_get_folder_info (
parent_store, full_name,
CAMEL_STORE_FOLDER_INFO_RECURSIVE |
- CAMEL_STORE_FOLDER_INFO_FAST, &ex);
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL);
- if (camel_exception_is_set (&ex))
+ if (folder_info == NULL)
goto exit;
response = prompt_user (folder_info->child != NULL);
@@ -404,7 +403,7 @@ mar_got_folder (gchar *folder_uri,
if (response == MARK_ALL_READ_CURRENT_FOLDER)
mark_all_as_read (folder);
else if (response == MARK_ALL_READ_WITH_SUBFOLDERS)
- mar_all_sub_folders (parent_store, folder_info, &ex);
+ mar_all_sub_folders (parent_store, folder_info, NULL);
exit:
camel_store_free_folder_info (parent_store, folder_info);
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 84706b783e..13a4868fa9 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -116,7 +116,6 @@ struct _PstImporter {
gint status_pc;
gint status_timeout_id;
CamelOperation *status;
- CamelException ex;
pst_file pst;
@@ -453,7 +452,7 @@ pst_import_file (PstImporter *m)
camel_operation_start (NULL, _("Importing '%s'"), filename);
if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) {
- mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ mail_tool_uri_to_folder (m->parent_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
}
ret = pst_init (&m->pst, filename);
@@ -704,7 +703,7 @@ pst_create_folder (PstImporter *m)
*pos = '\0';
- folder = mail_tool_uri_to_folder (dest, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ folder = mail_tool_uri_to_folder (dest, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
g_object_unref (folder);
*pos = '/';
}
@@ -716,7 +715,7 @@ pst_create_folder (PstImporter *m)
g_object_unref (m->folder);
}
- m->folder = mail_tool_uri_to_folder (m->folder_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
+ m->folder = mail_tool_uri_to_folder (m->folder_uri, CAMEL_STORE_FOLDER_CREATE, &m->base.error);
}
@@ -769,6 +768,7 @@ pst_process_email (PstImporter *m, pst_item *item)
CamelMimePart *part;
CamelMessageInfo *info;
pst_item_attach *attach;
+ gboolean success;
if (m->folder == NULL) {
pst_create_folder (m);
@@ -822,7 +822,7 @@ pst_process_email (PstImporter *m, pst_item *item)
/*g_message (" Email headers... %s...", item->email->header);*/
stream = camel_stream_mem_new_with_buffer (item->email->header.str, strlen (item->email->header.str));
- if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream) == -1)
+ if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg, stream, NULL) == -1)
g_warning ("Error reading headers, skipped");
} else {
@@ -916,16 +916,16 @@ pst_process_email (PstImporter *m, pst_item *item)
if (item->flags & 0x08)
camel_message_info_set_flags (info, CAMEL_MESSAGE_DRAFT, ~0);
- camel_folder_append_message (m->folder, msg, info, NULL, &m->ex);
+ success = camel_folder_append_message (
+ m->folder, msg, info, NULL, NULL);
camel_message_info_free (info);
g_object_unref (msg);
camel_folder_sync (m->folder, FALSE, NULL);
camel_folder_thaw (m->folder);
- if (camel_exception_is_set (&m->ex)) {
+ if (!success) {
g_critical ("Exception!");
- camel_exception_clear (&m->ex);
return;
}
@@ -1232,7 +1232,7 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta
continue;
}
- if (!(stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) {
+ if (!(stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0666, NULL))) {
g_warning ("Could not create stream for file %s - %s", path, g_strerror (errno));
attach = attach->next;
continue;
@@ -1240,8 +1240,8 @@ set_cal_attachments (ECal *cal, ECalComponent *ec, PstImporter *m, pst_item_atta
content = camel_medium_get_content (CAMEL_MEDIUM (part));
- if (camel_data_wrapper_decode_to_stream (content, stream) == -1
- || camel_stream_flush (stream) == -1)
+ if (camel_data_wrapper_decode_to_stream (content, stream, NULL) == -1
+ || camel_stream_flush (stream, NULL) == -1)
{
g_warning ("Could not write attachment to %s: %s", path, g_strerror (errno));
g_object_unref (stream);
diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c
index 537831a07e..edfb896107 100644
--- a/plugins/sa-junk-plugin/em-junk-filter.c
+++ b/plugins/sa-junk-plugin/em-junk-filter.c
@@ -186,12 +186,13 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin
if (msg) {
stream = camel_stream_fs_new_with_fd (fds[1]);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream);
- camel_stream_flush (stream);
- camel_stream_close (stream);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (msg), stream, NULL);
+ camel_stream_flush (stream, NULL);
+ camel_stream_close (stream, NULL);
g_object_unref (stream);
} else if (in) {
- camel_write (fds[1], in, strlen (in));
+ camel_write (fds[1], in, strlen (in), NULL);
close (fds[1]);
}
@@ -203,7 +204,7 @@ pipe_to_sa_full (CamelMimeMessage *msg, const gchar *in, const gchar **argv, gin
memstream = (CamelStreamMem *) camel_stream_mem_new ();
camel_stream_mem_set_byte_array (memstream, output_buffer);
- camel_stream_write_to_stream (stream, (CamelStream *) memstream);
+ camel_stream_write_to_stream (stream, (CamelStream *) memstream, NULL);
g_object_unref (stream);
g_byte_array_append (output_buffer, (guchar *)"", 1);
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 74e167a9fe..5bf3eb7e65 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -483,9 +483,10 @@ create_new_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *mes
/* make the exact copy of the template message, with all
its attachments and message structure */
mem = camel_stream_mem_new ();
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (template), mem);
- camel_stream_reset (mem);
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (new), mem);
+ camel_data_wrapper_write_to_stream (
+ CAMEL_DATA_WRAPPER (template), mem, NULL);
+ camel_stream_reset (mem, NULL);
+ camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (new), mem, NULL);
g_object_unref (mem);
/* Add the headers from the message we are replying to, so CC and that
diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c
index 8bb5341998..35f152a373 100644
--- a/plugins/tnef-attachments/tnef-plugin.c
+++ b/plugins/tnef-attachments/tnef-plugin.c
@@ -86,14 +86,14 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
name = g_build_filename(tmpdir, ".evo-attachment.tnef", NULL);
- out = camel_stream_fs_new_with_name(name, O_RDWR|O_CREAT, 0666);
+ out = camel_stream_fs_new_with_name(name, O_RDWR|O_CREAT, 0666, NULL);
if (out == NULL)
goto fail;
content = camel_medium_get_content ((CamelMedium *)t->part);
if (content == NULL)
goto fail;
- if (camel_data_wrapper_decode_to_stream(content, out) == -1
- || camel_stream_close(out) == -1) {
+ if (camel_data_wrapper_decode_to_stream(content, out, NULL) == -1
+ || camel_stream_close(out, NULL) == -1) {
g_object_unref (out);
goto fail;
}
@@ -136,9 +136,9 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t)
path = g_build_filename(tmpdir, d->d_name, NULL);
- stream = camel_stream_fs_new_with_name(path, O_RDONLY, 0);
+ stream = camel_stream_fs_new_with_name(path, O_RDONLY, 0, NULL);
content = camel_data_wrapper_new();
- camel_data_wrapper_construct_from_stream(content, stream);
+ camel_data_wrapper_construct_from_stream(content, stream, NULL);
g_object_unref (stream);
part = camel_mime_part_new();
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 0b7756211f..dffc407d66 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -99,7 +99,7 @@ org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object,
/* Stream takes ownership of the byte array. */
stream = camel_stream_mem_new_with_byte_array (array);
data_wrapper = camel_medium_get_content (medium);
- camel_data_wrapper_decode_to_stream (data_wrapper, stream);
+ camel_data_wrapper_decode_to_stream (data_wrapper, stream, NULL);
/* because the result is not NULL-terminated */
g_byte_array_append (array, padding, 2);