aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-07 04:09:15 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-07 04:13:14 +0800
commitd146d85899bf9e546961f8a9bdcc8cd7aec0de9b (patch)
tree8b2519844e095f431902319b7484198f355d1535
parent32a00018c5de91a06bf07daae2f3d2acb8181510 (diff)
downloadgsoc2013-evolution-d146d85899bf9e546961f8a9bdcc8cd7aec0de9b.tar
gsoc2013-evolution-d146d85899bf9e546961f8a9bdcc8cd7aec0de9b.tar.gz
gsoc2013-evolution-d146d85899bf9e546961f8a9bdcc8cd7aec0de9b.tar.bz2
gsoc2013-evolution-d146d85899bf9e546961f8a9bdcc8cd7aec0de9b.tar.lz
gsoc2013-evolution-d146d85899bf9e546961f8a9bdcc8cd7aec0de9b.tar.xz
gsoc2013-evolution-d146d85899bf9e546961f8a9bdcc8cd7aec0de9b.tar.zst
gsoc2013-evolution-d146d85899bf9e546961f8a9bdcc8cd7aec0de9b.zip
EMailAccountStore: Handle collections when enabling/disabling
If the mail account is part of a collection of sources, we want to enable or disable the top-level "collection" source instead of the mail account source.
-rw-r--r--mail/e-mail-account-store.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index 502493b5b6..d344d5c60d 100644
--- a/mail/e-mail-account-store.c
+++ b/mail/e-mail-account-store.c
@@ -544,6 +544,20 @@ mail_account_store_service_enabled (EMailAccountStore *store,
uid = camel_service_get_uid (service);
source = e_source_registry_ref_source (registry, uid);
+ /* 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. */
+ if (source != NULL) {
+ ESource *collection;
+
+ collection = e_source_registry_find_extension (
+ registry, source, E_SOURCE_EXTENSION_COLLECTION);
+ if (collection != NULL) {
+ g_object_unref (source);
+ source = collection;
+ }
+ }
+
if (source != NULL) {
e_source_set_enabled (source, TRUE);
@@ -575,6 +589,20 @@ mail_account_store_service_disabled (EMailAccountStore *store,
uid = camel_service_get_uid (service);
source = e_source_registry_ref_source (registry, uid);
+ /* 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. */
+ if (source != NULL) {
+ ESource *collection;
+
+ collection = e_source_registry_find_extension (
+ registry, source, E_SOURCE_EXTENSION_COLLECTION);
+ if (collection != NULL) {
+ g_object_unref (source);
+ source = collection;
+ }
+ }
+
if (source != NULL) {
e_source_set_enabled (source, FALSE);