remove all gtk3 conditionals
[claws.git] / src / gtk / quicksearch.c
index 072246741b6508086f5966118539ce3af9cdb55e..f79cbffe9ec387946bc0133a311bef641044ee11 100644 (file)
@@ -28,9 +28,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
 #include "gtkcmoptionmenu.h"
-#endif
 #include "utils.h"
 #include "combobox.h"
 #include "menu.h"
@@ -58,9 +56,7 @@ struct _QuickSearch
 {
        GtkWidget                       *hbox_search;
        GtkWidget                       *search_type;
-#if !GTK_CHECK_VERSION(3, 0, 0)
        GtkWidget                       *search_type_opt;
-#endif
        GtkWidget                       *search_string_entry;
        GtkWidget                       *search_condition_expression;
        GtkWidget                       *search_description;
@@ -221,14 +217,12 @@ gboolean quicksearch_is_fast(QuickSearch *quicksearch)
 
 static void quicksearch_set_type(QuickSearch *quicksearch, gint type)
 {
-#if !GTK_CHECK_VERSION(3, 0, 0)
        gint index;
        quicksearch->request.type = type;
        index = menu_find_option_menu_index(GTK_CMOPTION_MENU(quicksearch->search_type_opt), 
                                        GINT_TO_POINTER(type),
                                        NULL);
        gtk_cmoption_menu_set_history(GTK_CMOPTION_MENU(quicksearch->search_type_opt), index);  
-#endif
 }
 
 static gchar *quicksearch_get_text(QuickSearch * quicksearch)
@@ -485,6 +479,10 @@ static gchar *search_descr_strings[] = {
        "c S",   N_("messages carbon-copied to S"),
        "C S",   N_("message is either To: or Cc: to S"),
        "D",     N_("deleted messages"), /** how I can filter deleted messages **/
+       "da \"YYYY-MM-dd HH:mm:ss\"",  N_("messages whose date is after requested date "
+                                         "(time is optional)"),
+       "db \"YYYY-MM-dd HH:mm:ss\"",  N_("messages whose date is before requested date "
+                                         "(time is optional)"),
        "e S",   N_("messages which contain S in the Sender field"),
        "E S",   N_("true if execute \"S\" succeeds"),
        "f S",   N_("messages originating from user S"),
@@ -522,7 +520,7 @@ static gchar *search_descr_strings[] = {
        "|",     N_("logical OR operator"),
        "! or ~",       N_("logical NOT operator"),
        "%",     N_("case sensitive search"),
-       "#",     N_("match using regular expressions instead of substring search"),
+       "&#x00023;", N_("match using regular expressions instead of substring search"),
        "",      "" ,
        " ",     N_("all filtering expressions are allowed, but cannot be mixed "
                    "through logical operators with the expressions above"),
@@ -590,12 +588,16 @@ static gboolean search_condition_expr(GtkMenuItem *widget, gpointer data)
                        mainwindow_get_mainwindow()->summaryview->quicksearch != NULL,
                        FALSE);
 
-       /* re-use the current quicksearch value if it's a condition expression,
-          otherwise ignore it silently */
+       /* re-use the current quicksearch value, expanding it so it also works
+        * with extended symbols */
        cond_str = quicksearch_get_text(mainwindow_get_mainwindow()->summaryview->quicksearch);
 
        if (*cond_str != '\0') {
-               matchers = matcher_parser_get_cond((gchar*)cond_str, NULL);
+               gchar *newstr = advsearch_expand_search_string(cond_str);
+
+               if (newstr && newstr[0] != '\0')
+                       matchers = matcher_parser_get_cond(newstr, FALSE);
+               g_free(newstr);
        }
 
        prefs_matcher_open(matchers, search_condition_expr_done);
@@ -643,9 +645,7 @@ QuickSearch *quicksearch_new()
        QuickSearch *quicksearch;
 
        GtkWidget *hbox_search;
-#if !GTK_CHECK_VERSION(3, 0, 0)
        GtkWidget *search_type_opt;
-#endif
        GtkWidget *search_type;
        GtkWidget *search_string_entry;
        GtkWidget *search_hbox;
@@ -673,11 +673,9 @@ QuickSearch *quicksearch_new()
        /* quick search */
        hbox_search = gtk_hbox_new(FALSE, 0);
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
        search_type_opt = gtk_cmoption_menu_new();
        gtk_widget_show(search_type_opt);
        gtk_box_pack_start(GTK_BOX(hbox_search), search_type_opt, FALSE, FALSE, 0);
-#endif
 
        search_type = gtk_menu_new();
        MENUITEM_ADD (search_type, menuitem,
@@ -755,11 +753,9 @@ QuickSearch *quicksearch_new()
                         G_CALLBACK(searchtype_autorun_changed),
                         quicksearch);
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
        gtk_cmoption_menu_set_menu(GTK_CMOPTION_MENU(search_type_opt), search_type);
 
        quicksearch->search_type_opt = search_type_opt;
-#endif
        quicksearch_set_type(quicksearch, prefs_common.summary_quicksearch_type);
 
        gtk_widget_show(search_type);