2007-04-20 [colin] 2.9.1cvs4
authorColin Leroy <colin@colino.net>
Fri, 20 Apr 2007 06:42:19 +0000 (06:42 +0000)
committerColin Leroy <colin@colino.net>
Fri, 20 Apr 2007 06:42:19 +0000 (06:42 +0000)
* src/gtk/quicksearch.c
* src/gtk/quicksearch.h
Add "From, To or Subject" quicksearch
type. Patch by ulfschaper@users.sf.net

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

index aa91802..36f3c4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-04-20 [colin]     2.9.1cvs4
+
+       * src/gtk/quicksearch.c
+       * src/gtk/quicksearch.h
+               Add "From, To or Subject" quicksearch
+               type. Patch by ulfschaper@users.sf.net
+
 2007-04-20 [colin]     2.9.1cvs3
 
        * src/matcher.c
index e7424f8..dcfb263 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.42.2.30 -r 1.42.2.31 NEWS;  cvs diff -u -r 1.8.2.34 -r 1.8.2.35 README;  cvs diff -u -r 1.1.2.19 -r 1.1.2.20 RELEASE_NOTES;  cvs diff -u -r 1.654.2.2585 -r 1.654.2.2586 configure.ac;  ) > 2.9.1cvs1.patchset
 ( cvs diff -u -r 1.16.2.27 -r 1.16.2.28 src/prefs_display_header.c;  cvs diff -u -r 1.3.12.27 -r 1.3.12.28 src/message_search.c;  ) > 2.9.1cvs2.patchset
 ( cvs diff -u -r 1.75.2.39 -r 1.75.2.40 src/matcher.c;  ) > 2.9.1cvs3.patchset
+( cvs diff -u -r 1.1.2.66 -r 1.1.2.67 src/gtk/quicksearch.c;  cvs diff -u -r 1.1.2.13 -r 1.1.2.14 src/gtk/quicksearch.h;  ) > 2.9.1cvs4.patchset
index 20b3299..4e5b99c 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=3
+EXTRA_VERSION=4
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index c2d04e4..ed3b7c4 100644 (file)
@@ -470,6 +470,7 @@ QuickSearch *quicksearch_new()
        GtkWidget *search_condition_expression;
        GtkWidget *menuitem;
        GtkTooltips *tips = gtk_tooltips_new();
+       gint index;
 
        quicksearch = g_new0(QuickSearch, 1);
 
@@ -493,6 +494,10 @@ QuickSearch *quicksearch_new()
        g_signal_connect(G_OBJECT(menuitem), "activate",
                         G_CALLBACK(searchtype_changed),
                         quicksearch);
+       MENUITEM_ADD (search_type, menuitem, _("From, To or Subject"), QUICK_SEARCH_MIXED);
+       g_signal_connect(G_OBJECT(menuitem), "activate",
+                        G_CALLBACK(searchtype_changed),
+                        quicksearch);
        MENUITEM_ADD (search_type, menuitem, _("Extended"), QUICK_SEARCH_EXTENDED);
        g_signal_connect(G_OBJECT(menuitem), "activate",
                         G_CALLBACK(searchtype_changed),
@@ -532,7 +537,10 @@ QuickSearch *quicksearch_new()
 
        gtk_option_menu_set_menu(GTK_OPTION_MENU(search_type_opt), search_type);
 
-       gtk_option_menu_set_history(GTK_OPTION_MENU(search_type_opt), prefs_common.summary_quicksearch_type);
+       index = menu_find_option_menu_index(GTK_OPTION_MENU(search_type_opt), 
+                                       GINT_TO_POINTER(prefs_common.summary_quicksearch_type),
+                                       NULL);
+       gtk_option_menu_set_history(GTK_OPTION_MENU(search_type_opt), index);
 
        gtk_widget_show(search_type);
 
@@ -819,6 +827,8 @@ gboolean quicksearch_match(QuickSearch *quicksearch, MsgInfo *msginfo)
        case QUICK_SEARCH_TO:
                searched_header = msginfo->to;
                break;
+       case QUICK_SEARCH_MIXED:
+               break;
        case QUICK_SEARCH_EXTENDED:
                break;
        default:
@@ -827,9 +837,16 @@ gboolean quicksearch_match(QuickSearch *quicksearch, MsgInfo *msginfo)
        }
        quicksearch->matching = TRUE;
        if (prefs_common.summary_quicksearch_type != QUICK_SEARCH_EXTENDED &&
+           prefs_common.summary_quicksearch_type != QUICK_SEARCH_MIXED &&
            quicksearch->search_string &&
             searched_header && strcasestr(searched_header, quicksearch->search_string) != NULL)
                result = TRUE;
+       else if (prefs_common.summary_quicksearch_type == QUICK_SEARCH_MIXED &&
+               quicksearch->search_string && (
+               (msginfo->to && strcasestr(msginfo->to, quicksearch->search_string) != NULL) ||
+               (msginfo->from && strcasestr(msginfo->from, quicksearch->search_string) != NULL) ||
+               (msginfo->subject && strcasestr(msginfo->subject, quicksearch->search_string) != NULL)  ))
+               result = TRUE;
        else if ((quicksearch->matcher_list != NULL) &&
                 matcherlist_match(quicksearch->matcher_list, msginfo))
                result = TRUE;
index d4cf8af..650453a 100644 (file)
@@ -26,7 +26,8 @@ typedef enum
        QUICK_SEARCH_SUBJECT,
        QUICK_SEARCH_FROM,
        QUICK_SEARCH_TO,
-       QUICK_SEARCH_EXTENDED
+       QUICK_SEARCH_EXTENDED,
+       QUICK_SEARCH_MIXED
 } QuickSearchType;
 
 typedef struct _QuickSearch QuickSearch;