[evolution] Remove "enable-local" and "enable-vfolders" GSettings key.



commit b4fbbde6ab7deb247f1db19558489a868c75467d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 8 13:18:04 2012 -0400

    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.

 data/evolution.convert                       |    2 -
 data/org.gnome.evolution.mail.gschema.xml.in |   12 +-----
 libemail-engine/mail-vfolder.c               |    8 +---
 mail/e-mail-account-store.c                  |   63 +++++++++----------------
 mail/em-folder-utils.c                       |   15 ------
 modules/mail/e-mail-config-reader.c          |    9 +++-
 modules/mail/e-mail-shell-backend.c          |   12 +----
 modules/mail/e-mail-shell-settings.c         |   10 ----
 8 files changed, 35 insertions(+), 96 deletions(-)
---
diff --git a/data/evolution.convert b/data/evolution.convert
index a748520..f10ff27 100644
--- a/data/evolution.convert
+++ b/data/evolution.convert
@@ -136,8 +136,6 @@ composer-spell-color = /apps/evolution/mail/composer/spell_color
 composer-spell-languages = /apps/evolution/mail/composer/spell_languages
 composer-top-signature = /apps/evolution/mail/composer/top_signature
 default-account = /apps/evolution/mail/default_account
-enable-local = /apps/evolution/mail/display/enable_local
-enable-vfolders = /apps/evolution/mail/display/enable_vfolders
 error-level = /apps/evolution/mail/display/error_level
 error-timeout = /apps/evolution/mail/display/error_timeout
 filters-log-actions = /apps/evolution/mail/filters/log
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index ae54f0c..b6d1ec7 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -240,20 +240,10 @@
       <_summary>Show deleted messages in the message-list</_summary>
       <_description>Show deleted messages (with a strike-through) in the message-list.</_description>
     </key>
-    <key name="enable-local" type="b">
-      <default>true</default>
-      <_summary>Enable local folders</_summary>
-      <_description>Whether to show local folders (On This Computer) in a folder tree</_description>
-    </key>
     <key name="enable-unmatched" type="b">
       <default>true</default>
       <_summary>Enable Unmatched search folder</_summary>
-      <_description>Enable Unmatched search folder within Search Folders. It does nothing if 'enable-vfolders' is false.</_description>
-    </key>
-    <key name="enable-vfolders" type="b">
-      <default>true</default>
-      <_summary>Enable search folders</_summary>
-      <_description>Enable search folders on startup.</_description>
+      <_description>Enable Unmatched search folder within Search Folders. It does nothing if Search Folders are disabled.</_description>
     </key>
     <key name="safe-list" type="b">
       <default>false</default>
diff --git a/libemail-engine/mail-vfolder.c b/libemail-engine/mail-vfolder.c
index be60534..d1fb0a5 100644
--- a/libemail-engine/mail-vfolder.c
+++ b/libemail-engine/mail-vfolder.c
@@ -1018,7 +1018,6 @@ vfolder_load_storage (EMailSession *session)
 	EFilterRule *rule;
 	MailFolderCache *folder_cache;
 	gchar *xmlfile;
-	GSettings *settings;
 
 	G_LOCK (vfolder_hash);
 
@@ -1033,7 +1032,7 @@ vfolder_load_storage (EMailSession *session)
 	G_UNLOCK (vfolder_hash);
 
 	config_dir = mail_session_get_config_dir ();
-	vfolder_store = e_mail_session_get_vfolder_store (E_MAIL_SESSION (session));
+	vfolder_store = e_mail_session_get_vfolder_store (session);
 
 	g_signal_connect (
 		vfolder_store, "folder-deleted",
@@ -1076,11 +1075,6 @@ vfolder_load_storage (EMailSession *session)
 		}
 	}
 
-	/* reenable the feature if required */
-	settings = g_settings_new ("org.gnome.evolution.mail");
-	g_settings_set_boolean (settings, "enable-vfolders", TRUE);
-	g_object_unref (settings);
-
 	folder_cache = e_mail_session_get_folder_cache (session);
 
 	g_signal_connect (
diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c
index ccb1229..630810a 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 ddce87b..cbfd910 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));
 	}
 
diff --git a/modules/mail/e-mail-config-reader.c b/modules/mail/e-mail-config-reader.c
index 3926d05..f732c73 100644
--- a/modules/mail/e-mail-config-reader.c
+++ b/modules/mail/e-mail-config-reader.c
@@ -35,11 +35,14 @@ mail_config_reader_idle_cb (EExtension *extension)
 	EExtensible *extensible;
 	GtkActionGroup *action_group;
 	EShellSettings *shell_settings;
+	ESourceRegistry *registry;
+	ESource *source;
 	EShell *shell;
 
 	extensible = e_extension_get_extensible (extension);
 
 	shell = e_shell_get_default ();
+	registry = e_shell_get_registry (shell);
 	shell_settings = e_shell_get_shell_settings (shell);
 
 	g_object_bind_property (
@@ -56,11 +59,15 @@ mail_config_reader_idle_cb (EExtension *extension)
 		E_MAIL_READER (extensible),
 		E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS);
 
+	source = e_source_registry_ref_source (registry, "vfolder");
+
 	g_object_bind_property (
-		shell_settings, "mail-enable-search-folders",
+		source, "enabled",
 		action_group, "visible",
 		G_BINDING_SYNC_CREATE);
 
+	g_object_unref (source);
+
 	return FALSE;
 }
 
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 3aecfd9..95fea2e 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -519,27 +519,19 @@ static void
 mail_shell_backend_start (EShellBackend *shell_backend)
 {
 	EMailShellBackendPrivate *priv;
-	EShell *shell;
-	EShellSettings *shell_settings;
 	EMailBackend *backend;
 	EMailSession *session;
 	EMailAccountStore *account_store;
-	gboolean enable_search_folders;
 	GError *error = NULL;
 
 	priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
 
-	shell = e_shell_backend_get_shell (shell_backend);
-	shell_settings = e_shell_get_shell_settings (shell);
-
 	backend = E_MAIL_BACKEND (shell_backend);
 	session = e_mail_backend_get_session (backend);
 	account_store = e_mail_ui_session_get_account_store (E_MAIL_UI_SESSION (session));
 
-	enable_search_folders = e_shell_settings_get_boolean (
-		shell_settings, "mail-enable-search-folders");
-	if (enable_search_folders)
-		vfolder_load_storage (session);
+	/* XXX Should we be calling this unconditionally? */
+	vfolder_load_storage (session);
 
 	if (!e_mail_account_store_load_sort_order (account_store, &error)) {
 		g_warning ("%s: %s", G_STRFUNC, error->message);
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 1838a06..8243f79 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -141,16 +141,6 @@ e_mail_shell_settings_init (EShellBackend *shell_backend)
 		"enable-unmatched");
 
 	e_shell_settings_install_property_for_key (
-		"mail-enable-search-folders",
-		MAIL_SCHEMA,
-		"enable-vfolders");
-
-	e_shell_settings_install_property_for_key (
-		"mail-enable-local-folders",
-		MAIL_SCHEMA,
-		"enable-local");
-
-	e_shell_settings_install_property_for_key (
 		"mail-font-monospace",
 		MAIL_SCHEMA,
 		"monospace-font");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]