[anjal] Make tab/search work well. Some more still there.



commit a7ef23dc14ad91ea1fefd04a4dccc0667c76b2fa
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Thu Jun 4 10:49:35 2009 +0530

    Make tab/search work well. Some more still there.
---
 src/mail-folder-view.c |    5 +++++
 src/mail-folder-view.h |    1 +
 src/mail-search.c      |    5 +++--
 src/mail-view.c        |    9 ++++++---
 src/mail-view.h        |    2 +-
 5 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 54a560a..6ec18a4 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -199,6 +199,7 @@ mail_folder_view_init (MailFolderView  *shell)
 
 	shell->type = MAIL_VIEW_FOLDER;
 	shell->search_state = NULL;
+	shell->search_str = NULL;
 	img = gtk_image_new_from_pixbuf (pbuf);
 	g_object_set_data ((GObject *)img, "pbuf", pbuf);
 	g_signal_connect (img, "expose-event", G_CALLBACK(mfv_btn_expose), shell);
@@ -252,6 +253,10 @@ mail_folder_view_finalize (GObject *object)
 		 g_free(mfv->search_state);
 		 mfv->search_state = NULL;
 	 }
+	 if (mfv->search_str) {
+		 g_free(mfv->search_str);
+		 mfv->search_str = NULL;
+	 } 
 	 if (mfv->priv->folder) {
 		  camel_object_unref (mfv->priv->folder);
 	 }
diff --git a/src/mail-folder-view.h b/src/mail-folder-view.h
index 0a0d9ac..403c3f0 100644
--- a/src/mail-folder-view.h
+++ b/src/mail-folder-view.h
@@ -54,6 +54,7 @@ typedef struct _MailFolderView {
 	
 	MailFolderViewPrivate *priv;
 	char *search;
+	char *search_str;
 	char *search_state;
 } MailFolderView;
 
diff --git a/src/mail-search.c b/src/mail-search.c
index 054ec99..57a0fd6 100644
--- a/src/mail-search.c
+++ b/src/mail-search.c
@@ -142,12 +142,13 @@ mail_search_config_search(EFilterBar *efb, FilterRule *rule, int id, const char
 static void
 mail_search_activate (EFilterBar *bar, MailSearch *search)
 {
-	char *word, *state;
+	char *word, *state, *str;
 	ESearchBar *esb = (ESearchBar *)bar;
 
+	str = e_search_bar_get_text (esb);
 	g_object_get (esb, "query", &word, NULL);
 	g_object_get (esb, "state", &state, NULL);
-	mail_view_set_search (search->view, word, state);
+	mail_view_set_search (search->view, word, state, str);
 }
 
 
diff --git a/src/mail-view.c b/src/mail-view.c
index e4f3fa7..6a89a03 100644
--- a/src/mail-view.c
+++ b/src/mail-view.c
@@ -117,7 +117,7 @@ mv_switch (GtkNotebook     *notebook,GtkNotebookPage *page, guint page_num, gpoi
 			 mail_conv_view_activate ((MailConvView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
 		else if (child->type == MAIL_VIEW_FOLDER) /* For some reason, Im not able to get right type */ {
 			 mail_folder_view_activate ((MailFolderView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, TRUE);
-		 	mail_search_set_state (shell->priv->search, ((MailFolderView *)child)->search, ((MailFolderView *)child)->search_state);
+		 	mail_search_set_state (shell->priv->search, ((MailFolderView *)child)->search_str, ((MailFolderView *)child)->search_state);
 
 		} else if (child->type == MAIL_VIEW_ACCOUNT)
 			mail_account_view_activate ((MailAccountView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
@@ -244,7 +244,7 @@ mv_close_mcv (MailViewChild *mfv, MailView *mv)
 		 mail_conv_view_activate ((MailConvView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
 	else if (child->type == MAIL_VIEW_FOLDER) {
 		 mail_folder_view_activate ((MailFolderView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, TRUE);
-		 mail_search_set_state (mv->priv->search, ((MailFolderView *)mfv)->search, ((MailFolderView *)mfv)->search_state);
+		 mail_search_set_state (mv->priv->search, ((MailFolderView *)mfv)->search_str, ((MailFolderView *)mfv)->search_state);
 	} else if (child->type == MAIL_VIEW_ACCOUNT)
 		mail_account_view_activate ((MailAccountView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
 
@@ -601,7 +601,7 @@ mail_view_save (MailView *mv)
 }
 
 void
-mail_view_set_search (MailView *mv, const char *search, char *state)
+mail_view_set_search (MailView *mv, const char *search, char *state, char *search_str)
 {
 	MailViewChild *child = (MailViewChild *)mv->priv->current_view;
 
@@ -613,7 +613,10 @@ mail_view_set_search (MailView *mv, const char *search, char *state)
 			return;
 		if (mfv->search_state)
 			g_free (mfv->search_state);
+		if (mfv->search_str)
+			g_free (mfv->search_str);
 		mfv->search_state = state;
+		mfv->search_str = search_str;
 		mail_folder_view_set_search (mfv, search);
 	}
 }
diff --git a/src/mail-view.h b/src/mail-view.h
index 8ed64df..1b09180 100644
--- a/src/mail-view.h
+++ b/src/mail-view.h
@@ -75,7 +75,7 @@ void mail_view_set_folder_tree_widget (MailView *mv, GtkWidget *tree);
 void mail_view_set_folder_tree (MailView *mv, GtkWidget *tree);
 void mail_view_save (MailView *mv);
 MailViewChild * mail_view_add_page (MailView *mv, guint16 type, gpointer data);
-void mail_view_set_search (MailView *view, const char *search, char *state);
+void mail_view_set_search (MailView *view, const char *search, char *state, char *search_str);
 void mail_view_set_slider (MailView *mv, GtkWidget *slider);
 void mail_view_init_search (MailView *mv, GtkWidget *search);
 



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