2007-08-06 [wwp] 2.10.0cvs94
authorTristan Chabredier <wwp@claws-mail.org>
Mon, 6 Aug 2007 16:10:13 +0000 (16:10 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Mon, 6 Aug 2007 16:10:13 +0000 (16:10 +0000)
* src/gtk/quicksearch.c
Replace deprecated GtkCombo with its modern equivalen GtkComboBox.

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

index 03c9a26..c529b74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-06 [wwp]       2.10.0cvs94
+
+       * src/gtk/quicksearch.c
+               Replace deprecated GtkCombo with its modern equivalen GtkComboBox.
+
 2007-08-06 [ticho]     2.10.0cvs93
 
        * src/prefs_account.c
index 967ac32..356fd6e 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.398 -r 1.382.2.399 src/compose.c;  cvs diff -u -r 1.50.2.39 -r 1.50.2.40 src/compose.h;  ) > 2.10.0cvs91.patchset
 ( cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpcore/plugin.def;  ) > 2.10.0cvs92.patchset
 ( cvs diff -u -r 1.105.2.105 -r 1.105.2.106 src/prefs_account.c;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/gtk/combobox.c;  ) > 2.10.0cvs93.patchset
+( cvs diff -u -r 1.1.2.75 -r 1.1.2.76 src/gtk/quicksearch.c;  ) > 2.10.0cvs94.patchset
index a34148b..0efb27e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=93
+EXTRA_VERSION=94
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 8012234..04c77f8 100644 (file)
@@ -30,6 +30,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #include "utils.h"
+#include "combobox.h"
 #include "menu.h"
 #include "prefs_common.h"
 #include "description_window.h"
@@ -94,7 +95,7 @@ static void quicksearch_set_type(QuickSearch *quicksearch, gint type)
 
 static void prepare_matcher(QuickSearch *quicksearch)
 {
-       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(quicksearch->search_string_entry)->entry));
+       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(quicksearch->search_string_entry)->child));
 
        if (search_string == NULL || search_string[0] == '\0') {
                quicksearch_set_active(quicksearch, FALSE);
@@ -185,14 +186,15 @@ gboolean quicksearch_has_focus(QuickSearch *quicksearch)
 
 static void searchbar_run(QuickSearch *quicksearch, gboolean run_only_if_fast)
 {
-       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(quicksearch->search_string_entry)->entry));
+       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(quicksearch->search_string_entry)->child));
 
        /* add to history */
        if (!quicksearch->in_typing && search_string && strlen(search_string) != 0) {
+               combobox_unset_popdown_strings(GTK_COMBO_BOX(quicksearch->search_string_entry));
                prefs_common.summary_quicksearch_history =
                        add_history(prefs_common.summary_quicksearch_history,
                                        search_string);
-               gtk_combo_set_popdown_strings(GTK_COMBO(quicksearch->search_string_entry),
+               combobox_set_popdown_strings(GTK_COMBO_BOX(quicksearch->search_string_entry),
                        prefs_common.summary_quicksearch_history);
        }
 
@@ -219,7 +221,7 @@ static int searchbar_changed_timeout(void *data)
        return FALSE;
 }
 
-static gboolean searchbar_changed_cb(GtkWidget *widget, QuickSearch *qs)
+static void searchbar_changed_cb(GtkWidget *widget, QuickSearch *qs)
 {
        if (!qs->has_focus && prefs_common.summary_quicksearch_autorun) {
                gtk_widget_grab_focus(qs->search_string_entry);
@@ -235,19 +237,19 @@ static gboolean searchbar_changed_cb(GtkWidget *widget, QuickSearch *qs)
                                searchbar_changed_timeout, qs);
        }
 
-       return FALSE;
+       if (!qs->has_focus)
+               gtk_widget_grab_focus(qs->search_string_entry);
 }
 
 static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
                                  QuickSearch *quicksearch)
 {
-       if (event != NULL && event->keyval == GDK_Escape) {
-
+       if (event && (event->keyval == GDK_Escape)) {
                const gchar *str;
 
                quicksearch->in_typing = FALSE;
 
-               str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(quicksearch->search_string_entry)->entry));
+               str = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(quicksearch->search_string_entry)->child));
                g_return_val_if_fail(str != NULL, TRUE);
 
                /* If the string entry is empty -> hide quicksearch bar. If not -> empty it */
@@ -260,7 +262,6 @@ static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
                        gtk_widget_grab_focus(
                                        mainwindow_get_mainwindow()->summaryview->ctree);
                }
-
                return TRUE;
        }
 
@@ -277,13 +278,20 @@ static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
                return TRUE;
        }
 
+       if (event && (event->keyval == GDK_Down || event->keyval == GDK_Up)) {
+               combobox_set_value_from_arrow_key(
+                               GTK_COMBO_BOX(quicksearch->search_string_entry),
+                               event->keyval);
+               return TRUE;
+       }
+
        return FALSE;
 }
 
 static gboolean searchtype_changed(GtkMenuItem *widget, gpointer data)
 {
        QuickSearch *quicksearch = (QuickSearch *)data;
-       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(quicksearch->search_string_entry)->entry));
+       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(quicksearch->search_string_entry)->child));
 
        prefs_common.summary_quicksearch_type = GPOINTER_TO_INT(g_object_get_data(
                                   G_OBJECT(GTK_MENU_ITEM(gtk_menu_get_active(
@@ -309,7 +317,7 @@ static gboolean searchtype_recursive_changed(GtkMenuItem *widget, gpointer data)
 {
        QuickSearch *quicksearch = (QuickSearch *)data;
        gboolean checked = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
-       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(quicksearch->search_string_entry)->entry));
+       const gchar *search_string = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(quicksearch->search_string_entry)->child));
 
        prefs_common.summary_quicksearch_recurse = checked;
 
@@ -489,11 +497,11 @@ static gboolean search_condition_expr(GtkMenuItem *widget, gpointer data)
                        mainwindow_get_mainwindow()->summaryview->quicksearch != NULL,
                        FALSE);
 
-       /* re-use it the current quicksearch value if it's a condition expression,
+       /* re-use the current quicksearch value if it's a condition expression,
           otherwise ignore it silently */
        cond_str = gtk_entry_get_text(
-                       GTK_ENTRY(GTK_COMBO(mainwindow_get_mainwindow()->summaryview->quicksearch->
-                       search_string_entry)->entry));
+                       GTK_ENTRY(GTK_BIN(mainwindow_get_mainwindow()->summaryview->quicksearch->
+                       search_string_entry)->child));
        if (*cond_str != '\0') {
                matchers = matcher_parser_get_cond((gchar*)cond_str, NULL);
        }
@@ -520,6 +528,7 @@ QuickSearch *quicksearch_new()
        GtkWidget *search_condition_expression;
        GtkWidget *menuitem;
        GtkTooltips *tips = gtk_tooltips_new();
+       GtkWidget *vbox;
 
        quicksearch = g_new0(QuickSearch, 1);
 
@@ -614,14 +623,17 @@ QuickSearch *quicksearch_new()
 
        gtk_widget_show(search_type);
 
-       search_string_entry = gtk_combo_new();
-       gtk_box_pack_start(GTK_BOX(hbox_search), search_string_entry, FALSE, FALSE, 2);
-       gtk_combo_set_value_in_list(GTK_COMBO(search_string_entry), FALSE, TRUE);
-       gtk_combo_set_case_sensitive(GTK_COMBO(search_string_entry), TRUE);
+       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)
-               gtk_combo_set_popdown_strings(GTK_COMBO(search_string_entry),
+               combobox_set_popdown_strings(GTK_COMBO_BOX(search_string_entry),
                        prefs_common.summary_quicksearch_history);
-       gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(search_string_entry)->entry), "");
+
+       vbox = gtk_vbox_new(TRUE, 0);
+       gtk_box_pack_start(GTK_BOX(vbox), search_string_entry, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox_search), vbox, FALSE, FALSE, 4);
+
+       gtk_widget_show(vbox);
        gtk_widget_show(search_string_entry);
 
        search_hbox = gtk_hbox_new(FALSE, 5);
@@ -672,21 +684,21 @@ QuickSearch *quicksearch_new()
        gtk_box_pack_start(GTK_BOX(hbox_search), search_hbox, FALSE, FALSE, 2);
        gtk_widget_show(search_hbox);
 
-       g_signal_connect(G_OBJECT(GTK_COMBO(search_string_entry)->entry),
+       g_signal_connect(G_OBJECT(GTK_BIN(search_string_entry)->child),
                           "key_press_event",
                           G_CALLBACK(searchbar_pressed),
                           quicksearch);
 
-       g_signal_connect(G_OBJECT(GTK_COMBO(search_string_entry)->entry),
+       g_signal_connect(G_OBJECT(GTK_BIN(search_string_entry)->child),
                         "changed",
                         G_CALLBACK(searchbar_changed_cb),
                         quicksearch);
 
-       g_signal_connect(G_OBJECT(GTK_COMBO(search_string_entry)->entry),
+       g_signal_connect(G_OBJECT(GTK_BIN(search_string_entry)->child),
                         "focus_in_event",
                         G_CALLBACK(searchbar_focus_evt_in),
                         quicksearch);
-       g_signal_connect(G_OBJECT(GTK_COMBO(search_string_entry)->entry),
+       g_signal_connect(G_OBJECT(GTK_BIN(search_string_entry)->child),
                         "focus_out_event",
                         G_CALLBACK(searchbar_focus_evt_out),
                         quicksearch);
@@ -758,7 +770,7 @@ void quicksearch_show(QuickSearch *quicksearch)
        gtk_widget_show(quicksearch->hbox_search);
        update_extended_buttons(quicksearch);
        gtk_widget_grab_focus(
-               GTK_WIDGET(GTK_COMBO(quicksearch->search_string_entry)->entry));
+               GTK_WIDGET(GTK_BIN(quicksearch->search_string_entry)->child));
 
        GTK_EVENTS_FLUSH();
 
@@ -791,11 +803,11 @@ void quicksearch_set(QuickSearch *quicksearch, QuickSearchType type,
        if (!matchstring || !(*matchstring))
                quicksearch->in_typing = FALSE;
 
-       g_signal_handlers_block_by_func(G_OBJECT(GTK_COMBO(quicksearch->search_string_entry)->entry),
+       g_signal_handlers_block_by_func(G_OBJECT(GTK_BIN(quicksearch->search_string_entry)->child),
                        G_CALLBACK(searchbar_changed_cb), quicksearch);
-       gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(quicksearch->search_string_entry)->entry),
+       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(quicksearch->search_string_entry)->child),
                           matchstring);
-       g_signal_handlers_unblock_by_func(G_OBJECT(GTK_COMBO(quicksearch->search_string_entry)->entry),
+       g_signal_handlers_unblock_by_func(G_OBJECT(GTK_BIN(quicksearch->search_string_entry)->child),
                        G_CALLBACK(searchbar_changed_cb), quicksearch);
 
        prefs_common.summary_quicksearch_type = type;
@@ -846,20 +858,20 @@ static void quicksearch_set_active(QuickSearch *quicksearch, gboolean active)
                gtk_widget_set_sensitive(quicksearch->clear_search, TRUE);
                if (colors_initialised) {
                        gtk_widget_modify_base(
-                               GTK_COMBO(quicksearch->search_string_entry)->entry,
+                               GTK_BIN(quicksearch->search_string_entry)->child,
                                GTK_STATE_NORMAL, error ? &red : &yellow);
                        gtk_widget_modify_text(
-                               GTK_COMBO(quicksearch->search_string_entry)->entry,
+                               GTK_BIN(quicksearch->search_string_entry)->child,
                                GTK_STATE_NORMAL, &black);
                }
        } else {
                gtk_widget_set_sensitive(quicksearch->clear_search, FALSE);
                if (colors_initialised) {
                        gtk_widget_modify_base(
-                               GTK_COMBO(quicksearch->search_string_entry)->entry,
+                               GTK_BIN(quicksearch->search_string_entry)->child,
                                GTK_STATE_NORMAL, NULL);
                        gtk_widget_modify_text(
-                               GTK_COMBO(quicksearch->search_string_entry)->entry,
+                               GTK_BIN(quicksearch->search_string_entry)->child,
                                GTK_STATE_NORMAL, NULL);
                }
        }
@@ -1146,7 +1158,7 @@ gboolean quicksearch_is_running(QuickSearch *quicksearch)
 
 void quicksearch_pass_key(QuickSearch *quicksearch, guint val, GdkModifierType mod)
 {
-       GtkEntry *entry = GTK_ENTRY(GTK_COMBO(quicksearch->search_string_entry)->entry);
+       GtkEntry *entry = GTK_ENTRY(GTK_BIN(quicksearch->search_string_entry)->child);
        glong curpos = gtk_editable_get_position(GTK_EDITABLE(entry));
        guint32 c;
        char *str = g_strdup(gtk_entry_get_text(entry));