aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-utils.c
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 /mail/em-folder-utils.c
parent36f1f29b9a42c56a619e031b045db5a18f2b1dd7 (diff)
downloadgsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar.gz
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.tar.zst
gsoc2013-evolution-137b0743ddfbd3bbc01c9813615ede91ddd9b954.zip
Migrate from CamelException to GError.
Diffstat (limited to 'mail/em-folder-utils.c')
-rw-r--r--mail/em-folder-utils.c85
1 files changed, 53 insertions, 32 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index ab810bfa30..c7fee4b27c 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -104,7 +104,9 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
const gchar *tmp;
gint fromlen;
- if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &m->base.ex)))
+ fi = camel_store_get_folder_info (
+ m->fromstore, m->frombase, flags, &m->base.error);
+ if (fi == NULL)
return;
pending = g_list_append (pending, fi);
@@ -144,8 +146,10 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
if ((info->flags & CAMEL_FOLDER_NOSELECT) == 0) {
d(printf ("this folder is selectable\n"));
if (m->tostore == m->fromstore && m->delete) {
- camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &m->base.ex);
- if (camel_exception_is_set (&m->base.ex))
+ camel_store_rename_folder (
+ m->fromstore, info->full_name,
+ toname->str, &m->base.error);
+ if (m->base.error != NULL)
goto exception;
/* this folder no longer exists, unsubscribe it */
@@ -154,19 +158,28 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
deleted = 1;
} else {
- if (!(fromfolder = camel_store_get_folder (m->fromstore, info->full_name, 0, &m->base.ex)))
+ fromfolder = camel_store_get_folder (
+ m->fromstore, info->full_name,
+ 0, &m->base.error);
+ if (fromfolder == NULL)
goto exception;
- if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &m->base.ex))) {
+ tofolder = camel_store_get_folder (
+ m->tostore, toname->str,
+ CAMEL_STORE_FOLDER_CREATE,
+ &m->base.error);
+ if (tofolder == NULL) {
g_object_unref (fromfolder);
goto exception;
}
uids = camel_folder_get_uids (fromfolder);
- camel_folder_transfer_messages_to (fromfolder, uids, tofolder, NULL, m->delete, &m->base.ex);
+ camel_folder_transfer_messages_to (
+ fromfolder, uids, tofolder,
+ NULL, m->delete, &m->base.error);
camel_folder_free_uids (fromfolder, uids);
- if (m->delete && !camel_exception_is_set (&m->base.ex))
+ if (m->delete && m->base.error == NULL)
camel_folder_sync(fromfolder, TRUE, NULL);
g_object_unref (fromfolder);
@@ -174,7 +187,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m)
}
}
- if (camel_exception_is_set (&m->base.ex))
+ if (m->base.error != NULL)
goto exception;
else if (m->delete && !deleted)
deleting = g_list_prepend (deleting, info);
@@ -265,21 +278,25 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
CamelStore *fromstore = NULL, *tostore = NULL;
CamelStore *local_store;
const gchar *tobase = NULL;
- CamelException ex;
CamelURL *url;
+ GError *local_error = NULL;
if (uri == NULL) {
g_free (cfd);
return;
}
- camel_exception_init (&ex);
-
local_store = e_mail_local_get_store ();
- if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) {
- e_alert_run_dialog_for_args (e_shell_get_active_window (NULL),
- cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
+ fromstore = camel_session_get_store (
+ session, cfd->fi->uri, &local_error);
+ if (fromstore == NULL) {
+ e_alert_run_dialog_for_args (
+ e_shell_get_active_window (NULL),
+ cfd->delete ? "mail:no-move-folder-notexist" :
+ "mail:no-copy-folder-notexist",
+ cfd->fi->full_name, uri,
+ local_error->message, NULL);
goto fail;
}
@@ -293,9 +310,14 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
goto fail;
}
- if (!(tostore = camel_session_get_store (session, uri, &ex))) {
- e_alert_run_dialog_for_args (e_shell_get_active_window (NULL),
- cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-copy-folder-to-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
+ tostore = camel_session_get_store (session, uri, &local_error);
+ if (tostore == NULL) {
+ e_alert_run_dialog_for_args (
+ e_shell_get_active_window (NULL),
+ cfd->delete ? "mail:no-move-folder-to-notexist" :
+ "mail:no-copy-folder-to-notexist",
+ cfd->fi->full_name, uri,
+ local_error->message, NULL);
goto fail;
}
@@ -315,7 +337,9 @@ fail:
g_object_unref (fromstore);
if (tostore)
g_object_unref (tostore);
- camel_exception_clear (&ex);
+
+ g_clear_error (&local_error);
+
g_free (cfd);
}
@@ -395,20 +419,20 @@ em_folder_utils_copy_folder (GtkWindow *parent,
}
static void
-emfu_delete_done (CamelFolder *folder, gboolean removed, CamelException *ex, gpointer data)
+emfu_delete_done (CamelFolder *folder, gboolean removed, GError **error, gpointer data)
{
GtkWidget *dialog = data;
- if (ex && camel_exception_is_set (ex)) {
+ if (error != NULL && *error != NULL) {
GtkWidget *w;
w = e_alert_dialog_new_for_args (
e_shell_get_active_window (NULL),
"mail:no-delete-folder",
camel_folder_get_full_name (folder),
- camel_exception_get_description (ex), NULL);
+ (*error)->message, NULL);
em_utils_show_error_silent (w);
- camel_exception_clear (ex);
+ g_clear_error (error);
}
if (dialog)
@@ -514,9 +538,9 @@ emfu_create_folder__exec (struct _EMCreateFolder *m)
{
d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name));
- if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.ex))) {
+ if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &m->base.error))) {
if (camel_store_supports_subscriptions (m->store))
- camel_store_subscribe_folder (m->store, m->full_name, &m->base.ex);
+ camel_store_subscribe_folder (m->store, m->full_name, &m->base.error);
}
}
@@ -601,7 +625,6 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
EMFolderTreeModelStoreInfo *si;
GtkTreeModel *model;
const gchar *uri, *path;
- CamelException ex;
CamelStore *store;
struct _EMCreateFolderTempData *emcftd;
@@ -617,11 +640,10 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
g_print ("DEBUG: %s (%s)\n", path, uri);
- camel_exception_init (&ex);
- if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
- camel_exception_clear (&ex);
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store == NULL)
return;
- }
model = gtk_tree_view_get_model (GTK_TREE_VIEW (emfs->emft));
si = em_folder_tree_model_lookup_store_info (
@@ -654,7 +676,6 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer
}
g_object_unref (store);
- camel_exception_clear (&ex);
}
/* FIXME: these functions must be documented */
@@ -702,7 +723,7 @@ emfu_unsubscribe_folder__exec (struct _folder_unsub_t *msg)
gint url_flags;
store = camel_session_get_store (
- session, msg->folder_uri, &msg->base.ex);
+ session, msg->folder_uri, &msg->base.error);
if (store == NULL)
return;
@@ -715,7 +736,7 @@ emfu_unsubscribe_folder__exec (struct _folder_unsub_t *msg)
path = url->path + 1;
if (path != NULL)
- camel_store_unsubscribe_folder (store, path, &msg->base.ex);
+ camel_store_unsubscribe_folder (store, path, &msg->base.error);
camel_url_free (url);
}