aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-11-03 22:35:11 +0800
committerMilan Crha <mcrha@redhat.com>2010-11-03 22:35:11 +0800
commit7ce11c62eae2c3b27cb8d2c00c00f9d2a50ac560 (patch)
tree10093158f5a1357121666cc93d32f3fe26d45719
parentf13051ae715206f6f081ed60247836d17c14004b (diff)
downloadgsoc2013-evolution-7ce11c62eae2c3b27cb8d2c00c00f9d2a50ac560.tar.gz
gsoc2013-evolution-7ce11c62eae2c3b27cb8d2c00c00f9d2a50ac560.tar.zst
gsoc2013-evolution-7ce11c62eae2c3b27cb8d2c00c00f9d2a50ac560.zip
Bug #632580 - Freezes UI on account disable
-rw-r--r--mail/e-mail-store.c3
-rw-r--r--mail/mail-ops.c59
-rw-r--r--mail/mail-ops.h2
3 files changed, 63 insertions, 1 deletions
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index b23e6f2121..fdba2cfbd6 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -32,6 +32,7 @@
#include "mail/em-folder-tree-model.h"
#include "mail/mail-folder-cache.h"
#include "mail/mail-mt.h"
+#include "mail/mail-ops.h"
typedef struct _StoreInfo StoreInfo;
@@ -367,7 +368,7 @@ e_mail_store_remove (EMailSession *session,
default_model = em_folder_tree_model_get_default ();
em_folder_tree_model_remove_store (default_model, store);
- camel_service_disconnect_sync (CAMEL_SERVICE (store), TRUE, NULL);
+ mail_disconnect_store (store);
g_object_unref (store);
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index af045c6bb8..3da4f7a085 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -2540,3 +2540,62 @@ mail_check_service (EMailSession *session,
return id;
}
+
+/* ---------------------------------------------------------------------------------- */
+
+struct _disconnect_msg {
+ MailMsg base;
+
+ CamelStore *store;
+};
+
+static gchar *
+disconnect_service_desc (struct _disconnect_msg *m)
+{
+ gchar *name, *res;
+
+ name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE);
+ res = g_strdup_printf (_("Disconnecting %s"), name ? name : "");
+ g_free (name);
+
+ return res;
+}
+
+static void
+disconnect_service_exec (struct _disconnect_msg *m,
+ GCancellable *cancellable,
+ GError **error)
+{
+ camel_service_disconnect_sync (CAMEL_SERVICE (m->store), TRUE, error);
+}
+
+static void
+disconnect_service_free (struct _disconnect_msg *m)
+{
+ g_object_unref (m->store);
+}
+
+static MailMsgInfo disconnect_service_info = {
+ sizeof (struct _disconnect_msg),
+ (MailMsgDescFunc) disconnect_service_desc,
+ (MailMsgExecFunc) disconnect_service_exec,
+ (MailMsgDoneFunc) NULL,
+ (MailMsgFreeFunc) disconnect_service_free
+};
+
+gint
+mail_disconnect_store (CamelStore *store)
+{
+ struct _disconnect_msg *m;
+ gint id;
+
+ g_return_val_if_fail (store != NULL, -1);
+
+ m = mail_msg_new (&disconnect_service_info);
+ m->store = g_object_ref (store);
+
+ id = m->base.seq;
+ mail_msg_unordered_push (m);
+
+ return id;
+}
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index faeae3591b..77ce991d5f 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -163,6 +163,8 @@ gint mail_check_service (EMailSession *session,
void (*done)(const gchar *url, CamelProviderType type, GList *authtypes, gpointer data),
gpointer data);
+gint mail_disconnect_store (CamelStore *store);
+
G_END_DECLS
#endif /* MAIL_OPS_H */