diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-06-09 01:18:04 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-09 01:47:22 +0800 |
commit | b4fbbde6ab7deb247f1db19558489a868c75467d (patch) | |
tree | d8dd0d1950cf35719391ec60474e5fa0844e1165 /mail | |
parent | f92f3a1f453b037427539f2c0e3968d56fde8696 (diff) | |
download | gsoc2013-evolution-b4fbbde6ab7deb247f1db19558489a868c75467d.tar.gz gsoc2013-evolution-b4fbbde6ab7deb247f1db19558489a868c75467d.tar.zst gsoc2013-evolution-b4fbbde6ab7deb247f1db19558489a868c75467d.zip |
Remove "enable-local" and "enable-vfolders" GSettings key.
We have built-in ESources for the 'local' and 'vfolder' mail stores,
and can now track their enabled state as we would any other mail store.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-account-store.c | 63 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 15 |
2 files changed, 23 insertions, 55 deletions
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c index ccb122961b..630810acaa 100644 --- a/mail/e-mail-account-store.c +++ b/mail/e-mail-account-store.c @@ -1090,7 +1090,10 @@ void e_mail_account_store_add_service (EMailAccountStore *store, CamelService *service) { - GSettings *settings; + EMailSession *session; + ESourceRegistry *registry; + ESource *collection; + ESource *source; GtkTreeIter iter; const gchar *filename; const gchar *uid; @@ -1106,51 +1109,31 @@ e_mail_account_store_add_service (EMailAccountStore *store, uid = camel_service_get_uid (service); - /* Handle built-in services that don't have an EAccount. */ - - if (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0) { - builtin = TRUE; - - settings = g_settings_new ("org.gnome.evolution.mail"); - enabled = g_settings_get_boolean (settings, "enable-local"); - g_object_unref (settings); - - } else if (g_strcmp0 (uid, E_MAIL_SESSION_VFOLDER_UID) == 0) { - builtin = TRUE; + builtin = + (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0) || + (g_strcmp0 (uid, E_MAIL_SESSION_VFOLDER_UID) == 0); - settings = g_settings_new ("org.gnome.evolution.mail"); - enabled = g_settings_get_boolean (settings, "enable-vfolders"); - g_object_unref (settings); + session = e_mail_account_store_get_session (store); + registry = e_mail_session_get_registry (session); + 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) { + enabled = e_source_get_enabled (collection); + g_object_unref (collection); } else { - EMailSession *session; - ESourceRegistry *registry; - ESource *collection; - ESource *source; - - session = e_mail_account_store_get_session (store); - - registry = e_mail_session_get_registry (session); - 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); - - g_object_unref (source); } + g_object_unref (source); + /* Where do we insert new services now that accounts can be * reordered? This is just a simple policy I came up with. * It's certainly subject to debate and tweaking. diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index ddce87b527..cbfd910eed 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -548,8 +548,6 @@ em_folder_utils_create_folder (GtkWindow *parent, EMFolderTree *emft, const gchar *initial_uri) { - EShell *shell; - EShellSettings *shell_settings; EMFolderSelector *selector; EMFolderTree *folder_tree; EMFolderTreeModel *model; @@ -563,9 +561,6 @@ em_folder_utils_create_folder (GtkWindow *parent, g_return_if_fail (GTK_IS_WINDOW (parent)); g_return_if_fail (E_IS_MAIL_SESSION (session)); - shell = e_shell_get_default (); - shell_settings = e_shell_get_shell_settings (shell); - model = em_folder_tree_model_new (); em_folder_tree_model_set_session (model, session); @@ -575,7 +570,6 @@ em_folder_utils_create_folder (GtkWindow *parent, while (!g_queue_is_empty (&queue)) { CamelService *service; CamelStoreFlags flags; - const gchar *uid, *prop = NULL; service = g_queue_pop_head (&queue); g_warn_if_fail (CAMEL_IS_STORE (service)); @@ -584,15 +578,6 @@ em_folder_utils_create_folder (GtkWindow *parent, if ((flags & CAMEL_STORE_CAN_EDIT_FOLDERS) == 0) continue; - uid = camel_service_get_uid (service); - if (g_strcmp0 (uid, E_MAIL_SESSION_LOCAL_UID) == 0) - prop = "mail-enable-local-folders"; - else if (g_strcmp0 (uid, E_MAIL_SESSION_VFOLDER_UID) == 0) - prop = "mail-enable-search-folders"; - - if (prop && !e_shell_settings_get_boolean (shell_settings, prop)) - continue; - em_folder_tree_model_add_store (model, CAMEL_STORE (service)); } |