aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-08 00:25:05 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-08 01:48:19 +0800
commitcad21a7450e8d88032038f2592abf0d95ae5139b (patch)
tree743741e367ec06d2263b5c81beb76be8dd17c508
parent75b7e16821f78f4163c0fa9655075fc57853960e (diff)
downloadgsoc2013-evolution-cad21a7450e8d88032038f2592abf0d95ae5139b.tar.gz
gsoc2013-evolution-cad21a7450e8d88032038f2592abf0d95ae5139b.tar.zst
gsoc2013-evolution-cad21a7450e8d88032038f2592abf0d95ae5139b.zip
EMailAccountStore: Check for a collection when adding a service.
If the mail account is part of a collection of sources, we want to read the enabled state from the top-level "collection" source instead of the mail account source. Addendum: Same deal in mail_ui_session_source_changed_cb().
-rw-r--r--mail/e-mail-account-store.c12
-rw-r--r--mail/e-mail-ui-session.c17
2 files changed, 28 insertions, 1 deletions
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index d344d5c60d..9dde7561c5 100644
--- a/mail/e-mail-account-store.c
+++ b/mail/e-mail-account-store.c
@@ -1061,6 +1061,7 @@ e_mail_account_store_add_service (EMailAccountStore *store,
} else {
EMailSession *session;
ESourceRegistry *registry;
+ ESourceCollection *collection;
ESource *source;
session = e_mail_account_store_get_session (store);
@@ -1069,6 +1070,17 @@ e_mail_account_store_add_service (EMailAccountStore *store,
source = e_source_registry_ref_source (registry, uid);
g_return_if_fail (source != NULL);
+ /* If this ESource is part of a collection, we need to
+ * pick up the enabled state for the entire collection.
+ * Check the ESource and its ancestors for a collection
+ * extension and read from the containing source. */
+ collection = e_source_registry_find_extension (
+ registry, source, E_SOURCE_EXTENSION_COLLECTION);
+ if (collection != NULL) {
+ g_object_unref (source);
+ source = collection;
+ }
+
builtin = FALSE;
enabled = e_source_get_enabled (source);
diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c
index e946bbbe9a..efbcd8fcc4 100644
--- a/mail/e-mail-ui-session.c
+++ b/mail/e-mail-ui-session.c
@@ -478,6 +478,8 @@ mail_ui_session_source_changed_cb (ESourceRegistry *registry,
{
EMFolderTreeModel *folder_tree_model;
CamelService *service;
+ ESource *collection;
+ gboolean enabled;
const gchar *extension_name;
const gchar *uid;
@@ -505,7 +507,20 @@ mail_ui_session_source_changed_cb (ESourceRegistry *registry,
em_folder_tree_model_remove_store (
folder_tree_model, CAMEL_STORE (service));
- if (e_source_get_enabled (source))
+ /* If this ESource is part of a collection, we need to
+ * pick up the enabled state for the entire collection.
+ * Check the ESource and its ancestors for a collection
+ * extension and read from the containing source. */
+ collection = e_source_registry_find_extension (
+ registry, source, E_SOURCE_EXTENSION_COLLECTION);
+ if (collection != NULL) {
+ enabled = e_source_get_enabled (collection);
+ g_object_unref (collection);
+ } else {
+ enabled = e_source_get_enabled (source);
+ }
+
+ if (enabled)
em_folder_tree_model_add_store (
folder_tree_model, CAMEL_STORE (service));
}