aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-08 23:26:37 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-08 23:58:29 +0800
commitf92f3a1f453b037427539f2c0e3968d56fde8696 (patch)
tree6c8e5b20f609d5dabfbae6767eb120d1e291b768 /mail
parentc95ad7585c93b0c1b6ff89e5a0448068ea368240 (diff)
downloadgsoc2013-evolution-f92f3a1f453b037427539f2c0e3968d56fde8696.tar
gsoc2013-evolution-f92f3a1f453b037427539f2c0e3968d56fde8696.tar.gz
gsoc2013-evolution-f92f3a1f453b037427539f2c0e3968d56fde8696.tar.bz2
gsoc2013-evolution-f92f3a1f453b037427539f2c0e3968d56fde8696.tar.lz
gsoc2013-evolution-f92f3a1f453b037427539f2c0e3968d56fde8696.tar.xz
gsoc2013-evolution-f92f3a1f453b037427539f2c0e3968d56fde8696.tar.zst
gsoc2013-evolution-f92f3a1f453b037427539f2c0e3968d56fde8696.zip
Synchronize identities when enabling/disabling accounts.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-account-store.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index 9543e183d9..ccb122961b 100644
--- a/mail/e-mail-account-store.c
+++ b/mail/e-mail-account-store.c
@@ -544,6 +544,38 @@ mail_account_store_service_enabled (EMailAccountStore *store,
uid = camel_service_get_uid (service);
source = e_source_registry_ref_source (registry, uid);
+ /* Locate the identity source referenced in the [Mail Account]
+ * extension. We want to keep its enabled state synchronized
+ * with the account's enabled state. (Need to do this before
+ * we swap the mail account ESource for a collection below.) */
+ if (source != NULL) {
+ ESource *identity = NULL;
+ ESourceMailAccount *extension;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+ uid = e_source_mail_account_get_identity_uid (extension);
+
+ if (uid != NULL)
+ identity = e_source_registry_ref_source (registry, uid);
+
+ if (identity != NULL) {
+ e_source_set_enabled (identity, TRUE);
+
+ store->priv->busy_count++;
+ g_object_notify (G_OBJECT (store), "busy");
+
+ /* XXX Should this be cancellable? */
+ e_source_write (
+ identity, NULL, (GAsyncReadyCallback)
+ mail_account_store_write_source_cb,
+ g_object_ref (store));
+
+ g_object_unref (identity);
+ }
+ }
+
/* If this ESource is part of a collection, we need to enable
* the entire collection. Check the ESource and its ancestors
* for a collection extension and enable the containing source. */
@@ -589,6 +621,38 @@ mail_account_store_service_disabled (EMailAccountStore *store,
uid = camel_service_get_uid (service);
source = e_source_registry_ref_source (registry, uid);
+ /* Locate the identity source referenced in the [Mail Account]
+ * extension. We want to keep its enabled state synchronized
+ * with the account's enabled state. (Need to do this before
+ * we swap the mail account ESource for a collection below.) */
+ if (source != NULL) {
+ ESource *identity = NULL;
+ ESourceMailAccount *extension;
+ const gchar *extension_name;
+
+ extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
+ extension = e_source_get_extension (source, extension_name);
+ uid = e_source_mail_account_get_identity_uid (extension);
+
+ if (uid != NULL)
+ identity = e_source_registry_ref_source (registry, uid);
+
+ if (identity != NULL) {
+ e_source_set_enabled (identity, FALSE);
+
+ store->priv->busy_count++;
+ g_object_notify (G_OBJECT (store), "busy");
+
+ /* XXX Should this be cancellable? */
+ e_source_write (
+ identity, NULL, (GAsyncReadyCallback)
+ mail_account_store_write_source_cb,
+ g_object_ref (store));
+
+ g_object_unref (identity);
+ }
+ }
+
/* If this ESource is part of a collection, we need to disable
* the entire collection. Check the ESource and its ancestors
* for a collection extension and disable the containing source. */