diff options
-rw-r--r-- | mail/e-mail-account-store.c | 12 | ||||
-rw-r--r-- | 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 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)); } |