[evolution] EMailAccountStore: Check for a collection when adding a service.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EMailAccountStore: Check for a collection when adding a service.
- Date: Thu, 7 Jun 2012 17:48:31 +0000 (UTC)
commit cad21a7450e8d88032038f2592abf0d95ae5139b
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jun 7 12:25:05 2012 -0400
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().
mail/e-mail-account-store.c | 12 ++++++++++++
mail/e-mail-ui-session.c | 17 ++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index d344d5c..9dde756 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 e946bbb..efbcd8f 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));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]