[evolution/kill-bonobo: 23/54] Use an EShellSettings property for folder tree search.



commit 6e7f42e0a60659411f2e10dbf8e84c705f0498a4
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jul 10 14:42:53 2009 -0400

    Use an EShellSettings property for folder tree search.

 mail/em-folder-tree.c                |    3 ---
 modules/mail/e-mail-shell-settings.c |   12 ++++++++++++
 modules/mail/e-mail-shell-sidebar.c  |   13 +++++++++++++
 3 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 96c2e13..1c35699 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -888,11 +888,9 @@ folder_tree_new (EMFolderTree *emft)
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer;
 	GtkWidget *tree;
-	gboolean side_bar_search;
 	GConfClient *gconf;
 
 	gconf = mail_config_get_gconf_client ();
-	side_bar_search = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/side_bar_search", NULL);
 
 	/* FIXME[KILL-BONOBO] Gross hack */
 	tree = GTK_WIDGET (emft);
@@ -923,7 +921,6 @@ folder_tree_new (EMFolderTree *emft)
 	gtk_tree_view_set_headers_visible ((GtkTreeView *) tree, FALSE);
 
 	gtk_tree_view_set_search_column((GtkTreeView *)tree, COL_STRING_DISPLAY_NAME);
-	gtk_tree_view_set_enable_search((GtkTreeView *)tree, side_bar_search);
 
 	return (GtkTreeView *) tree;
 }
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 897ccfc..7f73bf3 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -386,6 +386,18 @@ e_mail_shell_settings_init (EShell *shell)
 
 	e_shell_settings_install_property (
 		g_param_spec_boolean (
+			"mail-side-bar-search",
+			NULL,
+			NULL,
+			TRUE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-side-bar-search",
+		"/apps/evolution/mail/display/side_bar_search");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
 			"mail-use-custom-fonts",
 			NULL,
 			NULL,
diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index 2e5dffc..0f8e4f5 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -24,6 +24,8 @@
 #include <string.h>
 #include <camel/camel.h>
 
+#include "e-util/e-binding.h"
+
 #include "em-utils.h"
 #include "em-folder-utils.h"
 
@@ -410,8 +412,11 @@ static void
 mail_shell_sidebar_constructed (GObject *object)
 {
 	EMailShellSidebar *mail_shell_sidebar;
+	EShellSettings *shell_settings;
 	EShellSidebar *shell_sidebar;
+	EShellWindow *shell_window;
 	EShellView *shell_view;
+	EShell *shell;
 	GtkTreeSelection *selection;
 	GtkTreeView *tree_view;
 	GtkTreeModel *model;
@@ -423,6 +428,10 @@ mail_shell_sidebar_constructed (GObject *object)
 
 	shell_sidebar = E_SHELL_SIDEBAR (object);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
 
 	mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (object);
 
@@ -448,6 +457,10 @@ mail_shell_sidebar_constructed (GObject *object)
 	mail_shell_sidebar->priv->folder_tree = g_object_ref (widget);
 	gtk_widget_show (widget);
 
+	e_binding_new (
+		G_OBJECT (shell_settings), "mail-side-bar-search",
+		G_OBJECT (widget), "enable-search");
+
 	tree_view = GTK_TREE_VIEW (mail_shell_sidebar->priv->folder_tree);
 	selection = gtk_tree_view_get_selection (tree_view);
 	model = gtk_tree_view_get_model (tree_view);



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