2010-03-21 [pawel] 3.7.5cvs34
authorPaweł Pękala <c0rn@gazeta.pl>
Sun, 21 Mar 2010 18:31:18 +0000 (18:31 +0000)
committerPaweł Pękala <c0rn@gazeta.pl>
Sun, 21 Mar 2010 18:31:18 +0000 (18:31 +0000)
* src/main.c
* src/gtk/quicksearch.c
* src/gtk/quicksearch.h
Implement separate search phrase completion for
normal/extended quicksearch

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

index 738a1df..39ef86c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-21 [pawel]     3.7.5cvs34
+
+       * src/main.c
+       * src/gtk/quicksearch.c
+       * src/gtk/quicksearch.h
+               Implement separate search phrase completion for
+               normal/extended quicksearch
+
 2010-03-11 [paul]      3.7.5cvs33
 
        * po/zh_CN.po
index 5bf777c..5ea8125 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 manual/de/glossary.xml;  ) > 3.7.5cvs31.patchset
 ( cvs diff -u -r 1.1.2.2 -r 1.1.2.3 manual/de/glossary.xml;  ) > 3.7.5cvs32.patchset
 ( cvs diff -u -r 1.5.2.29 -r 1.5.2.30 po/zh_CN.po;  ) > 3.7.5cvs33.patchset
+( cvs diff -u -r 1.115.2.225 -r 1.115.2.226 src/main.c;  cvs diff -u -r 1.1.2.89 -r 1.1.2.90 src/gtk/quicksearch.c;  cvs diff -u -r 1.1.2.18 -r 1.1.2.19 src/gtk/quicksearch.h;  ) > 3.7.5cvs34.patchset
index e98e524..7ec9be9 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=33
+EXTRA_VERSION=34
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0d3f41e..766b1ec 100644 (file)
@@ -69,6 +69,9 @@ struct _QuickSearch
        gboolean                         in_typing;
        guint                            press_timeout_id;
 
+       GList                           *normal_search_strings;
+       GList                           *extended_search_strings;
+       
        /* dynamic and autorun qs settings are exclusive*/
        GtkWidget                        *dynamic_menuitem;
        GtkWidget                        *autorun_menuitem;
@@ -102,6 +105,20 @@ static gchar *quicksearch_get_text(QuickSearch * quicksearch)
        return search_string;
 }
 
+static void quicksearch_set_popdown_strings(QuickSearch *quicksearch)
+{
+       GtkWidget *search_string_entry = quicksearch->search_string_entry;
+
+       combobox_unset_popdown_strings(GTK_COMBO_BOX(search_string_entry));
+
+       if (prefs_common.summary_quicksearch_type == QUICK_SEARCH_EXTENDED)
+               combobox_set_popdown_strings(GTK_COMBO_BOX(search_string_entry),
+                       quicksearch->extended_search_strings);  
+       else
+               combobox_set_popdown_strings(GTK_COMBO_BOX(search_string_entry),
+                       quicksearch->normal_search_strings);
+}
+
 static void prepare_matcher(QuickSearch *quicksearch)
 {
        gchar *search_string = quicksearch_get_text(quicksearch);
@@ -202,12 +219,18 @@ static void searchbar_run(QuickSearch *quicksearch, gboolean run_only_if_fast)
 
        /* add to history */
        if (!quicksearch->in_typing && search_string && strlen(search_string) != 0) {
-               combobox_unset_popdown_strings(GTK_COMBO_BOX(quicksearch->search_string_entry));
+               if (prefs_common.summary_quicksearch_type == QUICK_SEARCH_EXTENDED)
+                       quicksearch->extended_search_strings =
+                               add_history(quicksearch->extended_search_strings,
+                                               search_string);
+               else
+                       quicksearch->normal_search_strings =
+                               add_history(quicksearch->normal_search_strings,
+                                               search_string);         
                prefs_common.summary_quicksearch_history =
                        add_history(prefs_common.summary_quicksearch_history,
                                        search_string);
-               combobox_set_popdown_strings(GTK_COMBO_BOX(quicksearch->search_string_entry),
-                       prefs_common.summary_quicksearch_history);
+               quicksearch_set_popdown_strings(quicksearch);
        }
 
        prepare_matcher(quicksearch);
@@ -317,6 +340,7 @@ static gboolean searchtype_changed(GtkMenuItem *widget, gpointer data)
 
        /* Show extended search description button, only when Extended is selected */
        update_extended_buttons(quicksearch);
+       quicksearch_set_popdown_strings(quicksearch);
 
        if (!search_string || *(search_string) == 0) {
                g_free(search_string);
@@ -648,9 +672,6 @@ QuickSearch *quicksearch_new()
 
        search_string_entry = gtk_combo_box_entry_new_text ();
        gtk_combo_box_set_active(GTK_COMBO_BOX(search_string_entry), -1);
-       if (prefs_common.summary_quicksearch_history)
-               combobox_set_popdown_strings(GTK_COMBO_BOX(search_string_entry),
-                       prefs_common.summary_quicksearch_history);
 
        vbox = gtk_vbox_new(TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), search_string_entry, FALSE, FALSE, 0);
@@ -722,7 +743,9 @@ QuickSearch *quicksearch_new()
        quicksearch->clear_search = clear_search;
        quicksearch->in_typing = FALSE;
        quicksearch->press_timeout_id = -1;
-
+       quicksearch->normal_search_strings = NULL;
+       quicksearch->extended_search_strings = NULL;
+       
        update_extended_buttons(quicksearch);
 
        return quicksearch;
@@ -1327,3 +1350,45 @@ gboolean quicksearch_is_in_typing(QuickSearch *quicksearch)
 {
        return quicksearch->in_typing;
 }
+
+void quicksearch_set_search_strings(QuickSearch *quicksearch)
+{
+       GList *strings = prefs_common.summary_quicksearch_history;
+       gchar *newstr = NULL;
+       MatcherList *matcher_list = NULL;
+
+       if (!strings)
+               return;
+       
+       do {
+               newstr = expand_search_string((gchar *) strings->data);
+               if (newstr && newstr[0] != '\0') {
+                       if (!strchr(newstr, ' ')) {
+                               quicksearch->normal_search_strings =
+                                       g_list_append(
+                                               quicksearch->normal_search_strings,
+                                               strings->data);
+                               g_free(newstr);
+                               continue;
+                       }
+                       
+                       matcher_list = matcher_parser_get_cond(newstr, FALSE);
+                       g_free(newstr);
+                       
+                       if (matcher_list) {
+                               quicksearch->extended_search_strings =
+                                       g_list_append(
+                                               quicksearch->extended_search_strings,
+                                               strings->data);
+                               matcherlist_free(matcher_list);
+                       } else
+                               quicksearch->normal_search_strings =
+                                       g_list_append(
+                                               quicksearch->normal_search_strings,
+                                               strings->data);
+               }
+       
+       } while ((strings = g_list_next(strings)) != NULL);
+
+       quicksearch_set_popdown_strings(quicksearch);
+}
index 98583d2..2f5e321 100644 (file)
@@ -57,4 +57,5 @@ gboolean quicksearch_is_in_subfolder(QuickSearch *quicksearch, FolderItem *cur);
 gboolean quicksearch_is_fast(QuickSearch *quicksearch);
 gboolean quicksearch_is_in_typing(QuickSearch *quicksearch);
 void quicksearch_relayout(QuickSearch *quicksearch);
+void quicksearch_set_search_strings(QuickSearch *quicksearch);
 #endif /* QUICKSEARCH_H */
index 854caa9..4942ecb 100644 (file)
@@ -1450,6 +1450,7 @@ int main(int argc, char *argv[])
        folderview_set(folderview);
 
        prefs_matcher_read_config();
+       quicksearch_set_search_strings(mainwin->summaryview->quicksearch);
 
        /* make one all-folder processing before using claws */
        main_window_cursor_wait(mainwin);