[anjal] Fix the way search works. Now restore search works well across tabs.



commit 78e02c39811ba5c8029593e55686acd868b7e325
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Mon Jan 25 16:54:35 2010 +0530

    Fix the way search works. Now restore search works well across tabs.

 src/mail-folder-view.c                |    2 +-
 src/module/anjal-shell-view-actions.c |   34 +++++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 6af57a0..985dfeb 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -577,7 +577,7 @@ mail_folder_view_set_folder (MailFolderView *mfv, CamelFolder *folder, const cha
 			 }
 		}
 		gtk_widget_grab_focus ((GtkWidget *)mfv->tree);
-		if (mfv->search_str && *mfv->search_str)
+		//if (mfv->search_str && *mfv->search_str)
 			g_signal_emit (mfv, signals[SEARCH_SET], 0);			
 
 		/* FIXME: Set a signal emit and listen for it at note book and set the title appropriately */
diff --git a/src/module/anjal-shell-view-actions.c b/src/module/anjal-shell-view-actions.c
index 37fb68c..1da47b2 100644
--- a/src/module/anjal-shell-view-actions.c
+++ b/src/module/anjal-shell-view-actions.c
@@ -20,6 +20,7 @@
  */
 
 #include "anjal-shell-view-private.h"
+#include <shell/e-shell-searchbar.h>
 
 static void
 action_mail_account_disable_cb (GtkAction *action,
@@ -280,6 +281,11 @@ action_mail_search_cb (GtkRadioAction *action,
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	const gchar *search_hint;
+	EShellSearchbar *search_bar;
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	gchar *folder_uri;
+
 
 	/* XXX Figure out a way to handle this in EShellContent
 	 *     instead of every shell view having to handle it.
@@ -290,9 +296,33 @@ action_mail_search_cb (GtkRadioAction *action,
 
 	shell_view = E_SHELL_VIEW (mail_shell_view);
 	shell_content = e_shell_view_get_shell_content (shell_view);
-/*
+
 	search_hint = gtk_action_get_label (GTK_ACTION (current));
-	e_shell_content_set_search_hint (shell_content, search_hint); */
+	search_bar = (EShellSearchbar *) e_shell_content_get_searchbar (shell_content);
+	e_shell_searchbar_set_search_hint (search_bar, search_hint); 
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+	
+	if (folder_uri != NULL) {
+		const gchar *key;
+		const gchar *string;
+		gchar *group_name;
+		GKeyFile *key_file;
+
+		key_file = e_shell_view_get_state_key_file (shell_view);
+		key = STATE_KEY_SEARCH_FILTER;
+		string = gtk_action_get_name (GTK_ACTION (current));
+		group_name = g_strdup_printf ("Folder %s", folder_uri);
+
+		g_key_file_set_string (key_file, group_name, key, string);
+		e_shell_view_set_state_dirty (shell_view);
+
+		g_free (group_name);
+	}
+	g_free (folder_uri);
 }
 
 static void



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