[evolution] EMailAccountStore: Handle collections when enabling/disabling
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EMailAccountStore: Handle collections when enabling/disabling
- Date: Wed, 6 Jun 2012 20:13:19 +0000 (UTC)
commit d146d85899bf9e546961f8a9bdcc8cd7aec0de9b
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Jun 6 16:09:15 2012 -0400
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.
mail/e-mail-account-store.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index 502493b..d344d5c 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]