2006-12-01 [wwp] 2.6.0cvs73
authorTristan Chabredier <wwp@claws-mail.org>
Fri, 1 Dec 2006 10:07:04 +0000 (10:07 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Fri, 1 Dec 2006 10:07:04 +0000 (10:07 +0000)
* src/gtk/quicksearch.c
adapt quicksearch code to use modern gtk_combo_box'es.

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

index adc2e20..04a11c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-01 [wwp]       2.6.0cvs73
+
+       * src/gtk/quicksearch.c
+               adapt quicksearch code to use modern gtk_combo_box'es.
+
 2006-12-01 [wwp]       2.6.0cvs72
 
        * src/common/defs.h
index 24e1e17..34b7db9 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.96.2.159 -r 1.96.2.160 src/textview.c;  ) > 2.6.0cvs70.patchset
 ( cvs diff -u -r 1.395.2.269 -r 1.395.2.270 src/summaryview.c;  ) > 2.6.0cvs71.patchset
 ( cvs diff -u -r 1.9.2.30 -r 1.9.2.31 src/common/defs.h;  cvs diff -u -r 1.204.2.109 -r 1.204.2.110 src/prefs_common.c;  cvs diff -u -r 1.103.2.67 -r 1.103.2.68 src/prefs_common.h;  cvs diff -u -r 1.3.12.18 -r 1.3.12.19 src/message_search.c;  cvs diff -u -r 1.15.2.36 -r 1.15.2.37 src/summary_search.c;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/gtk/combobox.c;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/gtk/combobox.h;  ) > 2.6.0cvs72.patchset
+( cvs diff -u -r 1.1.2.53 -r 1.1.2.54 src/gtk/quicksearch.c;  ) > 2.6.0cvs73.patchset
index 2136bc0..86e7260 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=72
+EXTRA_VERSION=73
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0a1b96c..a1925b8 100644 (file)
@@ -29,6 +29,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #include "utils.h"
+#include "combobox.h"
 #include "menu.h"
 #include "prefs_common.h"
 #include "description_window.h"
@@ -78,7 +79,7 @@ gboolean quicksearch_is_fast(QuickSearch *quicksearch)
 
 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);
@@ -159,14 +160,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);
        }
 
@@ -203,6 +205,8 @@ static gboolean searchbar_changed_cb(GtkWidget *widget, QuickSearch *qs)
                                searchbar_changed_timeout, qs);
        }
 
+       gtk_widget_grab_focus(qs->search_string_entry);
+
        return FALSE;
 }
 
@@ -215,7 +219,7 @@ static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
 
                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 */
@@ -224,7 +228,7 @@ static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
                } else {
                        quicksearch_set(quicksearch, prefs_common.summary_quicksearch_type, "");
                        gtk_widget_grab_focus(
-                                       GTK_WIDGET(GTK_COMBO(quicksearch->search_string_entry)->entry));
+                                       GTK_WIDGET(GTK_BIN(quicksearch->search_string_entry)->child));
                }
 
                return TRUE;
@@ -245,7 +249,7 @@ static gboolean searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
 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(
@@ -271,7 +275,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;
 
@@ -431,11 +435,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);
        }
@@ -528,14 +532,12 @@ 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),
-                       prefs_common.summary_quicksearch_history);
-       gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(search_string_entry)->entry), "");
+               combobox_set_popdown_strings(GTK_COMBO_BOX(search_string_entry),
+                               prefs_common.summary_quicksearch_history);
+       gtk_box_pack_start(GTK_BOX(hbox_search), search_string_entry, FALSE, FALSE, 2);
        gtk_widget_show(search_string_entry);
 
        search_hbox = gtk_hbox_new(FALSE, 5);
@@ -581,21 +583,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);
@@ -629,7 +631,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));
 }
 
 void quicksearch_hide(QuickSearch *quicksearch)
@@ -645,11 +647,11 @@ void quicksearch_set(QuickSearch *quicksearch, QuickSearchType type,
        gtk_option_menu_set_history(GTK_OPTION_MENU(quicksearch->search_type_opt),
                                    type);
 
-       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;
@@ -700,20 +702,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);
                }
        }
@@ -963,7 +965,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));