#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"
{
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;
static void quicksearch_set_type(QuickSearch *quicksearch, gint type)
{
+#if !GTK_CHECK_VERSION(3, 0, 0)
gint index;
quicksearch->request->type = type;
if (quicksearch->gui == FALSE)
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)
static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
QuickSearch *quicksearch)
{
- if (event && (event->keyval == GDK_Escape)) {
+ if (event && (event->keyval == GDK_KEY_Escape)) {
gchar *str;
quicksearch->in_typing = FALSE;
return TRUE;
}
- if (event != NULL && (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter)) {
+ if (event != NULL && (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter)) {
if (quicksearch->press_timeout_id != -1) {
g_source_remove(quicksearch->press_timeout_id);
quicksearch->press_timeout_id = -1;
return TRUE;
}
- if (event && (event->keyval == GDK_Down || event->keyval == GDK_Up)) {
+ if (event && (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_Up)) {
combobox_set_value_from_arrow_key(
GTK_COMBO_BOX(quicksearch->search_string_entry),
event->keyval);
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;
/* 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,
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);
static void quicksearch_set_active(QuickSearch *quicksearch, gboolean active)
{
+#if !GTK_CHECK_VERSION(3, 0, 0)
static GdkColor yellow;
static GdkColor red;
static GdkColor black;
static gboolean colors_initialised = FALSE;
+#else
+ static GdkColor yellow = { (guint32)0, (guint16)0xf5, (guint16)0xf6, (guint16)0xbe };
+ static GdkColor red = { (guint32)0, (guint16)0xff, (guint16)0x70, (guint16)0x70 };
+ static GdkColor black = { (guint32)0, (guint16)0x0, (guint16)0x0, (guint16)0x0 };
+#endif
gboolean error = FALSE;
if (quicksearch->gui == FALSE)
return;
+#if !GTK_CHECK_VERSION(3, 0, 0)
if (!colors_initialised) {
gdk_color_parse("#f5f6be", &yellow);
gdk_color_parse("#000000", &black);
colors_initialised &= gdk_colormap_alloc_color(
gdk_colormap_get_system(), &red, FALSE, TRUE);
}
+#endif
if (active &&
(prefs_common.summary_quicksearch_type == QUICK_SEARCH_EXTENDED
if (active) {
gtk_widget_set_sensitive(quicksearch->clear_search, TRUE);
+#if !GTK_CHECK_VERSION(3, 0, 0)
if (colors_initialised) {
+#endif
gtk_widget_modify_base(
gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
GTK_STATE_NORMAL, error ? &red : &yellow);
gtk_widget_modify_text(
gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
GTK_STATE_NORMAL, &black);
+#if !GTK_CHECK_VERSION(3, 0, 0)
}
+#endif
} else {
gtk_widget_set_sensitive(quicksearch->clear_search, FALSE);
if (colors_initialised) {
gtk_widget_modify_text(
gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
GTK_STATE_NORMAL, NULL);
+#if !GTK_CHECK_VERSION(3, 0, 0)
}
+#endif
}
if (!active) {