[Commits] quicksearch.c 1.1.2.113 1.1.2.114

mones at claws-mail.org mones at claws-mail.org
Tue Sep 25 11:24:16 CEST 2012


Update of /home/claws-mail/claws/src/gtk
In directory srv:/tmp/cvs-serv5328/src/gtk

Modified Files:
      Tag: gtk2
	quicksearch.c 
Log Message:
2012-09-25 [mones]	3.8.1cvs73

	* src/gtk/quicksearch.c
		Fix new expressions not being added to quicksearch
		history in extended mode; patch by Sean Buckheister 

Index: quicksearch.c
===================================================================
RCS file: /home/claws-mail/claws/src/gtk/quicksearch.c,v
retrieving revision 1.1.2.113
retrieving revision 1.1.2.114
diff -u -d -r1.1.2.113 -r1.1.2.114
--- quicksearch.c	21 Sep 2012 12:42:52 -0000	1.1.2.113
+++ quicksearch.c	25 Sep 2012 09:24:14 -0000	1.1.2.114
@@ -88,6 +88,7 @@
 
 	AdvancedSearch			*asearch;
 	gboolean			 want_reexec;
+	gboolean			 want_history;
 };
 
 void quicksearch_set_on_progress_cb(QuickSearch* search,
@@ -99,6 +100,40 @@
 static void quicksearch_set_running(QuickSearch *quicksearch, gboolean run);
 static void quicksearch_set_matchstring(QuickSearch *quicksearch, const gchar *matchstring);
 static void quicksearch_set_active(QuickSearch *quicksearch, gboolean active);
+static void quicksearch_set_popdown_strings(QuickSearch *quicksearch);
+
+static void quicksearch_add_to_history(QuickSearch* quicksearch)
+{
+	gchar* search_string = quicksearch->request.matchstring;
+
+	/* add to history, for extended search add only correct matching rules */
+	if (quicksearch->want_history && !quicksearch->in_typing && search_string && strlen(search_string) != 0) {
+		switch (prefs_common.summary_quicksearch_type) {
+			case ADVANCED_SEARCH_EXTENDED:
+				if (advsearch_has_proper_predicate(quicksearch->asearch)) {
+					quicksearch->extended_search_strings =
+						add_history(quicksearch->extended_search_strings,
+								g_strdup(search_string));
+					prefs_common.summary_quicksearch_history =
+						add_history(prefs_common.summary_quicksearch_history,
+								g_strdup(search_string));
+				}
+				break;
+			default:
+				quicksearch->normal_search_strings =
+					add_history(quicksearch->normal_search_strings,
+							g_strdup(search_string));		
+				prefs_common.summary_quicksearch_history =
+					add_history(prefs_common.summary_quicksearch_history,
+							g_strdup(search_string));
+				break;
+		}
+
+		quicksearch_set_popdown_strings(quicksearch);
+	}
+
+	quicksearch->want_history = FALSE;
+}
 
 static void quicksearch_invoke_execute(QuickSearch *quicksearch, gboolean run_only_if_fast)
 {
@@ -116,6 +151,8 @@
 		if (run_only_if_fast && !advsearch_is_fast(quicksearch->asearch))
 			return;
 
+		quicksearch_add_to_history(quicksearch);
+
 		quicksearch_set_active(quicksearch, active);
 
 		quicksearch->want_reexec = FALSE;
@@ -218,36 +255,10 @@
 {
 	gchar *search_string = quicksearch_get_text(quicksearch);
 	quicksearch_set_matchstring(quicksearch, search_string);
-
-	/* add to history, for extended search add only correct matching rules */
-	if (!quicksearch->in_typing && search_string && strlen(search_string) != 0) {
-		switch (prefs_common.summary_quicksearch_type) {
-			case ADVANCED_SEARCH_EXTENDED:
-				if (advsearch_has_proper_predicate(quicksearch->asearch)) {
-					quicksearch->extended_search_strings =
-						add_history(quicksearch->extended_search_strings,
-								g_strdup(search_string));
-					prefs_common.summary_quicksearch_history =
-						add_history(prefs_common.summary_quicksearch_history,
-								g_strdup(search_string));
-				}
-				break;
-			default:
-				quicksearch->normal_search_strings =
-					add_history(quicksearch->normal_search_strings,
-							g_strdup(search_string));		
-				prefs_common.summary_quicksearch_history =
-					add_history(prefs_common.summary_quicksearch_history,
-							g_strdup(search_string));
-				break;
-		}
-
-		quicksearch_set_popdown_strings(quicksearch);
-
-	}
-
 	g_free(search_string);
 
+	quicksearch->want_history = TRUE;
+
 	quicksearch_invoke_execute(quicksearch, run_only_if_fast);
 }
 



More information about the Commits mailing list