2012-09-25 [mones] 3.8.1cvs73
authorRicardo Mones <mones@claws-mail.org>
Tue, 25 Sep 2012 09:24:14 +0000 (09:24 +0000)
committerRicardo Mones <mones@claws-mail.org>
Tue, 25 Sep 2012 09:24:14 +0000 (09:24 +0000)
* src/gtk/quicksearch.c
Fix new expressions not being added to quicksearch
history in extended mode; patch by Sean Buckheister

ChangeLog
PATCHSETS
configure.ac
src/gtk/quicksearch.c

index 963fa66..a1fe26d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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
+
 2012-09-22 [mir]       3.8.1cvs72
 
        * src/advsearch.c
index 97f5d35..8f6dd89 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.213.2.212 -r 1.213.2.213 src/folder.c;  ) > 3.8.1cvs70.patchset
 ( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/advsearch.c;  ) > 3.8.1cvs71.patchset
 ( cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/advsearch.c;  ) > 3.8.1cvs72.patchset
+( cvs diff -u -r 1.1.2.113 -r 1.1.2.114 src/gtk/quicksearch.c;  ) > 3.8.1cvs73.patchset
index 18dc3de..405aabc 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=72
+EXTRA_VERSION=73
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 783041e..1407c72 100644 (file)
@@ -88,6 +88,7 @@ struct _QuickSearch
 
        AdvancedSearch                  *asearch;
        gboolean                         want_reexec;
+       gboolean                         want_history;
 };
 
 void quicksearch_set_on_progress_cb(QuickSearch* search,
@@ -99,6 +100,40 @@ void quicksearch_set_on_progress_cb(QuickSearch* search,
 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 @@ static void quicksearch_invoke_execute(QuickSearch *quicksearch, gboolean run_on
                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 @@ static void searchbar_run(QuickSearch *quicksearch, gboolean run_only_if_fast)
 {
        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);
 }