2007-10-17 [wwp] 3.0.2cvs78
authorTristan Chabredier <wwp@claws-mail.org>
Wed, 17 Oct 2007 14:43:24 +0000 (14:43 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Wed, 17 Oct 2007 14:43:24 +0000 (14:43 +0000)
* src/prefs_customheader.c
* src/prefs_ext_prog.c
* src/prefs_filtering_action.c
* src/prefs_matcher.c
* src/prefs_other.c
* src/prefs_toolbar.c
* src/gtk/combobox.c
* src/gtk/combobox.h
* src/gtk/gtkutils.c
* src/gtk/gtkutils.h
* src/plugins/bogofilter/bogofilter_gtk.c
* src/plugins/spamassassin/spamassassin_gtk.c
Removed all remaining instances of GtkCombo
old API, patch by Pawel Pekala <c0rn@o2.pl>, with
few visual and code cleanup from Colin.

15 files changed:
ChangeLog
PATCHSETS
configure.ac
src/gtk/combobox.c
src/gtk/combobox.h
src/gtk/gtkutils.c
src/gtk/gtkutils.h
src/plugins/bogofilter/bogofilter_gtk.c
src/plugins/spamassassin/spamassassin_gtk.c
src/prefs_customheader.c
src/prefs_ext_prog.c
src/prefs_filtering_action.c
src/prefs_matcher.c
src/prefs_other.c
src/prefs_toolbar.c

index ca0a45b..f50504e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2007-10-17 [wwp]       3.0.2cvs78
+
+       * src/prefs_customheader.c
+       * src/prefs_ext_prog.c
+       * src/prefs_filtering_action.c
+       * src/prefs_matcher.c
+       * src/prefs_other.c
+       * src/prefs_toolbar.c
+       * src/gtk/combobox.c
+       * src/gtk/combobox.h
+       * src/gtk/gtkutils.c
+       * src/gtk/gtkutils.h
+       * src/plugins/bogofilter/bogofilter_gtk.c
+       * src/plugins/spamassassin/spamassassin_gtk.c
+               Removed all remaining instances of GtkCombo
+               old API, patch by Pawel Pekala <c0rn@o2.pl>, with
+               few visual and code cleanup from Colin.
+
 2007-10-16 [wwp]       3.0.2cvs77
        * src/gtk/pluginwindow.c
                Reworked the plugin window layouts, patch by Pawel Pekala <c0rn@o2.pl>.
index 4006e5d..248482b 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.75.2.50 -r 1.75.2.51 src/matcher.c;  ) > 3.0.2cvs75.patchset
 ( cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/edittags.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/edittags.h;  cvs diff -u -r 1.60.2.39 -r 1.60.2.40 src/filtering.c;  cvs diff -u -r 1.21.2.15 -r 1.21.2.16 src/filtering.h;  cvs diff -u -r 1.4.12.17 -r 1.4.12.18 src/importmutt.c;  cvs diff -u -r 1.1.14.17 -r 1.1.14.18 src/importpine.c;  cvs diff -u -r 1.115.2.172 -r 1.115.2.173 src/main.c;  cvs diff -u -r 1.94.2.161 -r 1.94.2.162 src/messageview.c;  cvs diff -u -r 1.19.2.17 -r 1.19.2.18 src/messageview.h;  cvs diff -u -r 1.83.2.119 -r 1.83.2.120 src/mimeview.c;  cvs diff -u -r 1.20.2.22 -r 1.20.2.23 src/mimeview.h;  cvs diff -u -r 1.56.2.58 -r 1.56.2.59 src/pop.c;  cvs diff -u -r 1.17.2.19 -r 1.17.2.20 src/pop.h;  cvs diff -u -r 1.204.2.149 -r 1.204.2.150 src/prefs_common.c;  cvs diff -u -r 1.103.2.95 -r 1.103.2.96 src/prefs_common.h;  cvs diff -u -r 1.16.2.29 -r 1.16.2.30 src/prefs_customheader.c;  cvs diff -u -r 1.2.16.5 -r 1.2.16.6 src/prefs_customheader.h;  cvs diff -u -r 1.16.2.31 -r 1.16.2.32 src/prefs_display_header.c;  cvs diff -u -r 1.1.16.5 -r 1.1.16.6 src/prefs_display_header.h;  cvs diff -u -r 1.1.4.41 -r 1.1.4.42 src/prefs_filtering_action.c;  cvs diff -u -r 1.1.4.4 -r 1.1.4.5 src/prefs_filtering_action.h;  cvs diff -u -r 1.1.2.12 -r 1.1.2.13 src/prefs_folder_column.c;  cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/prefs_folder_column.h;  cvs diff -u -r 1.52.2.52 -r 1.52.2.53 src/prefs_folder_item.c;  cvs diff -u -r 1.17.2.5 -r 1.17.2.6 src/prefs_folder_item.h;  cvs diff -u -r 1.10.2.35 -r 1.10.2.36 src/prefs_gtk.c;  cvs diff -u -r 1.5.2.15 -r 1.5.2.16 src/prefs_gtk.h;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/prefs_logging.h;  cvs diff -u -r 1.43.2.62 -r 1.43.2.63 src/prefs_matcher.c;  cvs diff -u -r 1.4.2.7 -r 1.4.2.8 src/prefs_matcher.h;  cvs diff -u -r 1.10.2.21 -r 1.10.2.22 src/prefs_summary_column.c;  cvs diff -u -r 1.1.16.5 -r 1.1.16.6 src/prefs_summary_column.h;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/prefs_summary_open.c;  cvs diff -u -r 1.47.2.45 -r 1.47.2.46 src/procheader.c;  cvs diff -u -r 1.11.2.9 -r 1.11.2.10 src/procheader.h;  cvs diff -u -r 1.49.2.100 -r 1.49.2.101 src/procmime.c;  cvs diff -u -r 1.17.2.20 -r 1.17.2.21 src/procmime.h;  cvs diff -u -r 1.17.2.12 -r 1.17.2.13 src/recv.c;  cvs diff -u -r 1.6.12.6 -r 1.6.12.7 src/recv.h;  cvs diff -u -r 1.9.2.21 -r 1.9.2.22 src/sourcewindow.c;  cvs diff -u -r 1.1.1.1.16.6 -r 1.1.1.1.16.7 src/sourcewindow.h;  cvs diff -u -r 1.395.2.331 -r 1.395.2.332 src/summaryview.c;  cvs diff -u -r 1.68.2.40 -r 1.68.2.41 src/summaryview.h;  cvs diff -u -r 1.96.2.187 -r 1.96.2.188 src/textview.c;  cvs diff -u -r 1.12.2.21 -r 1.12.2.22 src/textview.h;  cvs diff -u -r 1.43.2.89 -r 1.43.2.90 src/toolbar.c;  cvs diff -u -r 1.19.2.24 -r 1.19.2.25 src/toolbar.h;  cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/common/mgutils.c;  cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/common/mgutils.h;  cvs diff -u -r 1.6.2.14 -r 1.6.2.15 src/common/nntp.c;  cvs diff -u -r 1.4.2.5 -r 1.4.2.6 src/common/nntp.h;  cvs diff -u -r 1.5.2.9 -r 1.5.2.10 src/common/prefs.c;  cvs diff -u -r 1.3.2.5 -r 1.3.2.6 src/common/prefs.h;  cvs diff -u -r 1.13.2.35 -r 1.13.2.36 src/common/socket.c;  cvs diff -u -r 1.13.2.15 -r 1.13.2.16 src/common/socket.h;  cvs diff -u -r 1.2.2.6 -r 1.2.2.7 src/common/stringtable.c;  cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/common/stringtable.h;  cvs diff -u -r 1.2.4.22 -r 1.2.4.23 src/common/template.c;  cvs diff -u -r 1.1.4.6 -r 1.1.4.7 src/common/template.h;  cvs diff -u -r 1.1.4.2 -r 1.1.4.3 src/common/uuencode.c;  cvs diff -u -r 1.1.4.2 -r 1.1.4.3 src/common/uuencode.h;  cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/gtk/gtkshruler.c;  cvs diff -u -r 1.1.4.4 -r 1.1.4.5 src/gtk/gtkshruler.h;  cvs diff -u -r 1.5.2.25 -r 1.5.2.26 src/gtk/menu.c;  cvs diff -u -r 1.4.2.11 -r 1.4.2.12 src/gtk/menu.h;  cvs diff -u -r 1.1.4.21 -r 1.1.4.22 src/gtk/progressdialog.c;  cvs diff -u -r 1.1.4.11 -r 1.1.4.12 src/gtk/progressdialog.h;  ) > 3.0.2cvs76.patchset
 ( cvs diff -u -r 1.5.2.50 -r 1.5.2.51 src/gtk/pluginwindow.c; ) > 3.0.2cvs77.patchset
+( cvs diff -u -r 1.16.2.30 -r 1.16.2.31 src/prefs_customheader.c;  cvs diff -u -r 1.3.2.17 -r 1.3.2.18 src/prefs_ext_prog.c;  cvs diff -u -r 1.1.4.42 -r 1.1.4.43 src/prefs_filtering_action.c;  cvs diff -u -r 1.43.2.63 -r 1.43.2.64 src/prefs_matcher.c;  cvs diff -u -r 1.1.2.24 -r 1.1.2.25 src/prefs_other.c;  cvs diff -u -r 1.30.2.45 -r 1.30.2.46 src/prefs_toolbar.c;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/gtk/combobox.c;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/gtk/combobox.h;  cvs diff -u -r 1.5.2.69 -r 1.5.2.70 src/gtk/gtkutils.c;  cvs diff -u -r 1.4.2.38 -r 1.4.2.39 src/gtk/gtkutils.h;  cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/plugins/bogofilter/bogofilter_gtk.c;  cvs diff -u -r 1.23.2.42 -r 1.23.2.43 src/plugins/spamassassin/spamassassin_gtk.c;  ) > 3.0.2cvs78.patchset
index 9dfc3fc..4175305 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=77
+EXTRA_VERSION=78
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 9390b68..d242eb2 100644 (file)
@@ -33,6 +33,32 @@ typedef struct _combobox_sel_by_data_ctx {
        gint data;
 } ComboboxSelCtx;
 
+GtkWidget *combobox_text_new(const gboolean with_entry, const gchar *text, ...)
+{
+       GtkWidget *combo;
+       va_list args;
+       gchar *string;
+       
+       if(text == NULL)
+               return NULL;
+       
+       if (with_entry)
+               combo = gtk_combo_box_entry_new_text();
+       else
+               combo = gtk_combo_box_new_text();
+       gtk_widget_show(combo);
+
+       gtk_combo_box_append_text(GTK_COMBO_BOX(combo), text);
+       va_start(args, text);
+       while ((string = va_arg(args, gchar*)) != NULL)
+               gtk_combo_box_append_text(GTK_COMBO_BOX(combo), string);
+       va_end(args);
+               
+       gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+       
+       return combo;
+}
+
 static gboolean _select_by_data_func(GtkTreeModel *model,      GtkTreePath *path,
                GtkTreeIter *iter, ComboboxSelCtx *ctx)
 {
index 70d7c30..e69f52c 100644 (file)
@@ -53,6 +53,8 @@ enum {
        g_free(tmp_esc);                                         \
 }
 
+GtkWidget *combobox_text_new(const gboolean with_entry, const gchar *text, ...);
+
 void combobox_select_by_data   (GtkComboBox            *combobox,
                                 gint            data);
 
index 3ffa0d7..7bf39da 100644 (file)
@@ -369,28 +369,6 @@ void gtkut_clist_set_focus_row(GtkCList *clist, gint row)
        GTKUT_CTREE_REFRESH(clist);
 }
 
-void gtkut_combo_set_items(GtkCombo *combo, const gchar *str1, ...)
-{
-       va_list args;
-       gchar *s;
-       GList *combo_items = NULL;
-
-       g_return_if_fail(str1 != NULL);
-
-       combo_items = g_list_append(combo_items, (gpointer)str1);
-       va_start(args, str1);
-       s = va_arg(args, gchar*);
-       while (s) {
-               combo_items = g_list_append(combo_items, (gpointer)s);
-               s = va_arg(args, gchar*);
-       }
-       va_end(args);
-
-       gtk_combo_set_popdown_strings(combo, combo_items);
-
-       g_list_free(combo_items);
-}
-
 void gtkut_container_remove(GtkContainer *container, GtkWidget *widget)
 {
        gtk_container_remove(container, widget);
index 240eb4e..a782806 100644 (file)
@@ -150,9 +150,6 @@ void gtkut_ctree_set_focus_row              (GtkCTree       *ctree,
 void gtkut_clist_set_focus_row         (GtkCList       *clist,
                                         gint            row);
 
-void gtkut_combo_set_items             (GtkCombo       *combo,
-                                        const gchar    *str1, ...);
-
 void gtkut_container_remove            (GtkContainer   *container,
                                         GtkWidget      *widget);
 
index 12493d2..b152b1b 100644 (file)
@@ -41,6 +41,7 @@
 #include "bogofilter.h"
 #include "menu.h"
 #include "addressbook.h"
+#include "combobox.h"
 
 struct BogofilterPage
 {
@@ -61,13 +62,6 @@ struct BogofilterPage
        GtkWidget *mark_as_read;
 };
 
-/*!
- *\brief       Preset addressbook book/folder items
- */
-static const gchar *whitelist_ab_folder_text [] = {
-       N_("Any")
-};
-
 static void foldersel_cb(GtkWidget *widget, gpointer data)
 {
        GtkWidget *entry = (GtkWidget *) data;
@@ -89,10 +83,10 @@ static void bogofilter_whitelist_ab_select_cb(GtkWidget *widget, gpointer data)
        gchar *folderpath = NULL;
        gboolean ret = FALSE;
 
-       folderpath = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(page->whitelist_ab_folder_combo)->entry));
+       folderpath = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_BIN(page->whitelist_ab_folder_combo)->child));
        ret = addressbook_folder_selection(&folderpath);
        if ( ret != FALSE && folderpath != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(page->whitelist_ab_folder_combo)->entry), folderpath);
+               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(page->whitelist_ab_folder_combo)->child), folderpath);
 }
 
 static void bogofilter_create_widget_func(PrefsPage * _page,
@@ -134,8 +128,6 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
 
        GtkWidget *whitelist_ab_folder_combo;
        GtkWidget *whitelist_ab_select_btn;
-       GList *combo_items;
-       gint i;
 
        tooltips = gtk_tooltips_new();
 
@@ -237,20 +229,8 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
        gtk_tooltips_set_tip(tooltips, whitelist_ab_checkbtn,
                        _("Messages coming from your address book contacts will be received in the normal folder even if detected as spam"), NULL);
 
-       whitelist_ab_folder_combo = gtk_combo_new();
-       gtk_widget_show(whitelist_ab_folder_combo);
+       whitelist_ab_folder_combo = combobox_text_new(TRUE, _("Any"), NULL);
        gtk_widget_set_size_request(whitelist_ab_folder_combo, 100, -1);
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(whitelist_ab_folder_combo)->entry),
-                              TRUE);
-
-       combo_items = NULL;
-       for (i = 0; i < (gint) (sizeof(whitelist_ab_folder_text) / sizeof(gchar *)); i++) {
-               combo_items = g_list_append(combo_items,
-                                           (gpointer) _(whitelist_ab_folder_text[i]));
-       }
-       gtk_combo_set_popdown_strings(GTK_COMBO(whitelist_ab_folder_combo), combo_items);
-       g_list_free(combo_items);
-
        gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_folder_combo, TRUE, TRUE, 0);
 
        whitelist_ab_select_btn = gtk_button_new_with_label(_("Select ..."));
@@ -307,7 +287,7 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(insert_header_checkbtn), config->insert_header);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), config->whitelist_ab);
        if (config->whitelist_ab_folder != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(whitelist_ab_folder_combo)->entry),
+               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
                                config->whitelist_ab_folder);
        if (config->save_folder != NULL)
                gtk_entry_set_text(GTK_ENTRY(save_spam_folder_entry), config->save_folder);
@@ -376,7 +356,7 @@ static void bogofilter_save_func(PrefsPage *_page)
        config->whitelist_ab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->whitelist_ab));
        g_free(config->whitelist_ab_folder);
        config->whitelist_ab_folder = gtk_editable_get_chars(
-                               GTK_EDITABLE(GTK_COMBO(page->whitelist_ab_folder_combo)->entry), 0, -1);
+                               GTK_EDITABLE(GTK_BIN(page->whitelist_ab_folder_combo)->child), 0, -1);
 
        /* bogopath */
        g_free(config->bogopath);
index bf6abe2..e164fe7 100644 (file)
@@ -40,6 +40,7 @@
 #include "statusbar.h"
 #include "menu.h"
 #include "addressbook.h"
+#include "combobox.h"
 
 struct SpamAssassinPage
 {
@@ -66,13 +67,6 @@ struct SpamAssassinPage
        SpamAssassinTransport   trans;
 };
 
-/*!
- *\brief       Preset addressbook book/folder items
- */
-static const gchar *whitelist_ab_folder_text [] = {
-       N_("Any")
-};
-
 struct Transport
 {
        gchar                   *name;
@@ -104,10 +98,10 @@ static void spamassassin_whitelist_ab_select_cb(GtkWidget *widget, gpointer data
        gchar *folderpath = NULL;
        gboolean ret = FALSE;
 
-       folderpath = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(page->whitelist_ab_folder_combo)->entry));
+       folderpath = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_BIN(page->whitelist_ab_folder_combo)->child));
        ret = addressbook_folder_selection(&folderpath);
        if ( ret != FALSE && folderpath != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(page->whitelist_ab_folder_combo)->entry), folderpath);
+               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(page->whitelist_ab_folder_combo)->child), folderpath);
 }
 
 static void foldersel_cb(GtkWidget *widget, gpointer data)
@@ -214,7 +208,6 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        GtkWidget *whitelist_ab_checkbtn;
        GtkWidget *whitelist_ab_folder_combo;
        GtkWidget *whitelist_ab_select_btn;
-       GList *combo_items;
 
        GtkWidget *enable_sa_checkbtn;
 
@@ -436,20 +429,8 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        gtk_tooltips_set_tip(tooltips, whitelist_ab_checkbtn,
                        _("Messages coming from your address book contacts will be received in the normal folder even if detected as spam"), NULL);
 
-       whitelist_ab_folder_combo = gtk_combo_new();
-       gtk_widget_show(whitelist_ab_folder_combo);
+       whitelist_ab_folder_combo = combobox_text_new(TRUE, _("Any"), NULL);
        gtk_widget_set_size_request(whitelist_ab_folder_combo, 100, -1);
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(whitelist_ab_folder_combo)->entry),
-                              TRUE);
-
-       combo_items = NULL;
-       for (i = 0; i < (gint) (sizeof(whitelist_ab_folder_text) / sizeof(gchar *)); i++) {
-               combo_items = g_list_append(combo_items,
-                                           (gpointer) _(whitelist_ab_folder_text[i]));
-       }
-       gtk_combo_set_popdown_strings(GTK_COMBO(whitelist_ab_folder_combo), combo_items);
-       g_list_free(combo_items);
-
        gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_folder_combo, TRUE, TRUE, 0);
 
        whitelist_ab_select_btn = gtk_button_new_with_label(_("Select ..."));
@@ -485,7 +466,7 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        if (config->socket != NULL)
                gtk_entry_set_text(GTK_ENTRY(spamd_socket_entry), config->socket);
        if (config->whitelist_ab_folder != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(whitelist_ab_folder_combo)->entry),
+               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
                                config->whitelist_ab_folder);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(spamd_port_spinbtn), (float) config->port);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size_spinbtn), (float) config->max_size);
@@ -603,7 +584,7 @@ static void spamassassin_save_func(PrefsPage *_page)
        config->whitelist_ab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->whitelist_ab));
        g_free(config->whitelist_ab_folder);
        config->whitelist_ab_folder = gtk_editable_get_chars(
-                               GTK_EDITABLE(GTK_COMBO(page->whitelist_ab_folder_combo)->entry), 0, -1);
+                               GTK_EDITABLE(GTK_BIN(page->whitelist_ab_folder_combo)->child), 0, -1);
 
        if (config->process_emails) {
                spamassassin_register_hook();
index 056f13a..e3b4da0 100644 (file)
@@ -47,6 +47,7 @@
 #include "alertpanel.h"
 #include "base64.h"
 #include "filesel.h"
+#include "combobox.h"
 
 enum {
        CUSTHDR_STRING,         /*!< display string managed by list store */
@@ -209,15 +210,12 @@ static void prefs_custom_header_create(void)
                          0, 0, 0);
        gtk_misc_set_alignment (GTK_MISC (hdr_label), 0, 0.5);
        
-       hdr_combo = gtk_combo_new ();
-       gtk_widget_show (hdr_combo);
+       hdr_combo = combobox_text_new(TRUE, "User-Agent", "Face", "X-Face",
+                                     "X-Operating-System", NULL);
        gtk_table_attach (GTK_TABLE (table1), hdr_combo, 0, 1, 1, 2,
                          GTK_EXPAND | GTK_SHRINK | GTK_FILL,
                          0, 0, 0);
        gtk_widget_set_size_request (hdr_combo, 150, -1);
-       gtkut_combo_set_items (GTK_COMBO (hdr_combo),
-                              "User-Agent", "Face", "X-Face", "X-Operating-System",
-                              NULL);
 
        val_label = gtk_label_new (_("Value"));
        gtk_widget_show (val_label);
@@ -311,7 +309,7 @@ static void prefs_custom_header_create(void)
        customhdr.cancel_btn = cancel_btn;
 
        customhdr.hdr_combo  = hdr_combo;
-       customhdr.hdr_entry  = GTK_COMBO (hdr_combo)->entry;
+       customhdr.hdr_entry  = GTK_BIN (hdr_combo)->child;
        customhdr.val_entry  = val_entry;
 
        customhdr.list_view   = list_view;
index f90c95a..28e02bd 100644 (file)
@@ -32,6 +32,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #include "utils.h"
+#include "combobox.h"
 #include "prefs_common.h"
 #include "prefs_gtk.h"
 
@@ -125,14 +126,7 @@ static void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_label_set_justify(GTK_LABEL (uri_label), GTK_JUSTIFY_RIGHT);
        gtk_misc_set_alignment(GTK_MISC (uri_label), 1, 0.5);
 
-       uri_combo = gtk_combo_new ();
-       gtk_widget_show (uri_combo);
-#ifdef MAEMO
-       gtk_widget_set_sensitive(uri_combo, FALSE);
-#endif
-       gtk_table_attach (GTK_TABLE (table2), uri_combo, 1, 2, 0, 1,
-                         GTK_EXPAND | GTK_FILL, 0, 0, 0);
-       gtkut_combo_set_items (GTK_COMBO (uri_combo),
+       uri_combo = combobox_text_new(TRUE,
                               DEFAULT_BROWSER_CMD,
                               "galeon --new-tab '%s'",
                               "galeon '%s'",
@@ -145,7 +139,13 @@ static void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
                               "rxvt -e w3m '%s'",
                               "rxvt -e lynx '%s'",
                               NULL);
-       uri_entry = GTK_COMBO (uri_combo)->entry;
+#ifdef MAEMO
+       gtk_widget_set_sensitive(uri_combo, FALSE);
+#endif
+       gtk_table_attach (GTK_TABLE (table2), uri_combo, 1, 2, 0, 1,
+                         GTK_EXPAND | GTK_FILL, 0, 0, 0);
+
+       uri_entry = GTK_BIN (uri_combo)->child;
        gtk_entry_set_text(GTK_ENTRY(uri_entry), prefs_common.uri_cmd ? prefs_common.uri_cmd : "");
        
        exteditor_label = gtk_label_new (_("Text editor"));
@@ -157,22 +157,21 @@ static void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_label_set_justify(GTK_LABEL (exteditor_label), GTK_JUSTIFY_RIGHT);
        gtk_misc_set_alignment(GTK_MISC (exteditor_label), 1, 0.5);
 
-       exteditor_combo = gtk_combo_new ();
-       gtk_widget_show (exteditor_combo);
+       exteditor_combo = combobox_text_new(TRUE,
+                                       "gedit %s",
+                                       "kedit %s",
+                                       "mousepad %s",
+                                       "nedit %s",
+                                       "mgedit --no-fork %s",
+                                       "emacs %s",
+                                       "xemacs %s",
+                                       "kterm -e jed %s",
+                                       "kterm -e vi %s",
+                                       NULL);
        gtk_table_attach (GTK_TABLE (table2), exteditor_combo, 1, 2, 1, 2,
                          GTK_EXPAND | GTK_FILL, 0, 0, 0);
-       gtkut_combo_set_items (GTK_COMBO (exteditor_combo),
-                              "gedit %s",
-                              "kedit %s",
-                              "mousepad %s",
-                              "nedit %s",
-                              "mgedit --no-fork %s",
-                              "emacs %s",
-                              "xemacs %s",
-                              "kterm -e jed %s",
-                              "kterm -e vi %s",
-                              NULL);
-       exteditor_entry = GTK_COMBO (exteditor_combo)->entry;
+
+       exteditor_entry = GTK_BIN (exteditor_combo)->child;
        gtk_entry_set_text(GTK_ENTRY(exteditor_entry), 
                           prefs_common.ext_editor_cmd ? prefs_common.ext_editor_cmd : "");
 
index 0bd6513..322ed83 100644 (file)
@@ -50,6 +50,7 @@
 #include "tags.h"
 #include "matcher_parser.h"
 #include "colorlabel.h"
+#include "combobox.h"
 
 enum {
        PFA_ACTION,
@@ -69,10 +70,8 @@ static void prefs_filtering_action_cancel(void);
 static void prefs_filtering_action_ok(void);
 static gint prefs_filtering_action_deleted(GtkWidget *widget,
     GdkEventAny *event, gpointer data);
-static void prefs_filtering_action_type_selection_changed(GtkList *list,
+static void prefs_filtering_action_type_selection_changed(GtkWidget *widget,
     gpointer user_data);
-static void prefs_filtering_action_type_select(GtkList *list,
-    GtkWidget *widget, gpointer user_data);
 static void prefs_filtering_action_select_dest(void);
 static void prefs_filtering_action_select_addressbook(void);
 static void prefs_filtering_action_up(void);
@@ -104,10 +103,8 @@ static struct FilteringAction_ {
        GtkWidget *ok_btn;
 
        GtkWidget *action_list_view;
-       GtkWidget *action_type_list;
        GtkWidget *action_combo;
        GtkWidget *account_label;
-       GtkWidget *account_list;
        GtkWidget *account_combo;
        GtkWidget *dest_entry;
        GtkWidget *dest_btn;
@@ -124,7 +121,6 @@ static struct FilteringAction_ {
        GtkWidget *addressbook_label;
        GtkWidget *addressbook_btn;
        GtkWidget *tags_label;
-       GtkWidget *tags_list;
        GtkWidget *tags_combo;
 
        gint current_action;
@@ -199,32 +195,6 @@ static struct {
  */
 static PrefsFilteringActionSignal *filtering_action_callback;
 
-/*!
- *\brief       Find index of list selection 
- *
- *\param       list GTK list widget
- *
- *\return      gint Selection index
- */
-static gint get_sel_from_list(GtkList *list)
-{
-       gint row = 0;
-       void * sel;
-       GList * child;
-
-       if (list->selection == NULL) 
-               return -1;
-
-       sel = list->selection->data;
-       for (child = list->children; child != NULL; child = g_list_next(child)) {
-               if (child->data == sel)
-                       return row;
-               row ++;
-       }
-       
-       return row;
-}
-
 /*!
  *\brief       Opens the filtering action dialog with a list of actions
  *
@@ -285,8 +255,6 @@ static void prefs_filtering_action_create(void)
        GtkWidget *action_label;
        GtkWidget *recip_label;
        GtkWidget *action_combo;
-       GtkWidget *action_type_list;
-       GtkWidget *account_list;
        GtkWidget *dest_label;
        GtkWidget *exec_label;
        GtkWidget *score_label;
@@ -301,9 +269,7 @@ static void prefs_filtering_action_create(void)
        GtkWidget *dest_entry;
        GtkWidget *dest_btn;
        GtkWidget *tags_label;
-       GtkWidget *tags_list;
        GtkWidget *tags_combo;
-        GList * cur;
 
        GtkWidget *reg_hbox;
        GtkWidget *btn_hbox;
@@ -324,7 +290,6 @@ static void prefs_filtering_action_create(void)
 
        GtkWidget *color_optmenu;
 
-       GList *combo_items;
        gint i;
        static GdkGeometry geometry;
 
@@ -382,27 +347,16 @@ static void prefs_filtering_action_create(void)
        gtk_misc_set_alignment (GTK_MISC (action_label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox1), action_label, FALSE, FALSE, 0);
 
-       action_combo = gtk_combo_new ();
+       action_combo = gtk_combo_box_new_text ();
        gtk_widget_show (action_combo);
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(action_combo)->entry),
-                              FALSE);
 
-       combo_items = NULL;
        for (i = 0; i < sizeof action_text / sizeof action_text[0]; i++)
-               combo_items = g_list_append
-                       (combo_items, (gpointer) _(action_text[i].text));
-       gtk_combo_set_popdown_strings(GTK_COMBO(action_combo), combo_items);
-
-       g_list_free(combo_items);
-
+               gtk_combo_box_append_text(GTK_COMBO_BOX(action_combo),
+                                       (gpointer) _(action_text[i].text));
+       gtk_combo_box_set_active(GTK_COMBO_BOX(action_combo), 0);
        gtk_box_pack_start (GTK_BOX (hbox1), action_combo,
                            TRUE, TRUE, 0);
-       action_type_list = GTK_COMBO(action_combo)->list;
-       g_signal_connect (G_OBJECT(action_type_list), "select-child",
-                         G_CALLBACK(prefs_filtering_action_type_select),
-                         NULL);
-
-       g_signal_connect(G_OBJECT(action_type_list), "selection-changed",
+       g_signal_connect(G_OBJECT(action_combo), "changed",
                         G_CALLBACK(prefs_filtering_action_type_selection_changed),
                         NULL);
 
@@ -418,11 +372,10 @@ static void prefs_filtering_action_create(void)
        gtk_misc_set_alignment (GTK_MISC (account_label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox1), account_label, FALSE, FALSE, 0);
 
-       account_combo = gtk_combo_new ();
+       account_combo = gtk_combo_box_new_text ();
        gtk_widget_set_size_request (account_combo, 150, -1);
        gtk_widget_show (account_combo);
 
-       combo_items = NULL;
        for (accounts = account_get_list() ; accounts != NULL;
             accounts = accounts->next) {
                PrefsAccount *ac = (PrefsAccount *)accounts->data;
@@ -431,21 +384,13 @@ static void prefs_filtering_action_create(void)
                name = g_strdup_printf("%s <%s> (%s)",
                                       ac->name, ac->address,
                                       ac->account_name);
-               combo_items = g_list_append(combo_items, (gpointer) name);
+               gtk_combo_box_append_text(GTK_COMBO_BOX(account_combo), (gpointer) name);
+               g_free(name);
        }
 
-       gtk_combo_set_popdown_strings(GTK_COMBO(account_combo), combo_items);
-
-       for(cur = g_list_first(combo_items) ; cur != NULL ;
-           cur = g_list_next(cur))
-               g_free(cur->data);
-       g_list_free(combo_items);
-
+       gtk_combo_box_set_active(GTK_COMBO_BOX(account_combo), 0);
        gtk_box_pack_start (GTK_BOX (hbox1), account_combo,
                            TRUE, TRUE, 0);
-       account_list = GTK_COMBO(account_combo)->list;
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(account_combo)->entry),
-                              FALSE);
 
        /* header */
 
@@ -454,16 +399,11 @@ static void prefs_filtering_action_create(void)
        gtk_misc_set_alignment(GTK_MISC(header_label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox1), header_label, FALSE, FALSE, 0);
 
-       header_combo = gtk_combo_new();
-       gtk_widget_show(header_combo);
+       header_combo = combobox_text_new(TRUE, "From", "To", "Cc", "Reply-To", "Sender", NULL);
        gtk_widget_set_size_request(header_combo, 120, -1);
-       gtkut_combo_set_items(GTK_COMBO (header_combo),
-                             "From", "To", "Cc", "Reply-To", "Sender",
-                             NULL);
        gtk_box_pack_start (GTK_BOX (hbox1), header_combo,
                            TRUE, TRUE, 0);
-       header_entry = GTK_COMBO(header_combo)->entry;
-       gtk_entry_set_editable(GTK_ENTRY(header_entry), TRUE);
+       header_entry = GTK_BIN(header_combo)->child;
 
        /* destination */
 
@@ -517,31 +457,22 @@ static void prefs_filtering_action_create(void)
                                 colorlabel_create_color_menu());
        gtk_box_pack_start(GTK_BOX(hbox1), color_optmenu, TRUE, TRUE, 0);
 
-       tags_combo = gtk_combo_new ();
+       tags_combo = gtk_combo_box_new_text ();
        gtk_widget_set_size_request (tags_combo, 150, -1);
        gtk_widget_show (tags_combo);
 
-       combo_items = NULL;
        for (tmp = tags = tags_get_list() ; tmp != NULL;
             tmp = tmp->next) {
                gchar *name = g_strdup(tags_get_tag(GPOINTER_TO_INT(tmp->data)));
 
-               combo_items = g_list_append(combo_items, (gpointer) name);
+               gtk_combo_box_append_text(GTK_COMBO_BOX(tags_combo), (gpointer) name);
+               g_free(name);
        }
 
-       gtk_combo_set_popdown_strings(GTK_COMBO(tags_combo), combo_items);
-
-       for(cur = g_list_first(combo_items) ; cur != NULL ;
-           cur = g_list_next(cur))
-               g_free(cur->data);
-       g_list_free(combo_items);
-       g_slist_free(tags);
-
+       gtk_combo_box_set_active(GTK_COMBO_BOX(tags_combo), 0);
        gtk_box_pack_start (GTK_BOX (hbox1), tags_combo,
                            TRUE, TRUE, 0);
-       tags_list = GTK_COMBO(tags_combo)->list;
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(tags_combo)->entry),
-                              FALSE);
+
        dest_btn = gtk_button_new_with_label (_("Select ..."));
        gtk_widget_show (dest_btn);
        gtk_box_pack_start (GTK_BOX (hbox1), dest_btn, FALSE, FALSE, 0);
@@ -647,13 +578,10 @@ static void prefs_filtering_action_create(void)
        gtk_widget_show_all(window);
 
        filtering_action.window    = window;
-       filtering_action.action_type_list = action_type_list;
        filtering_action.action_combo = action_combo;
        filtering_action.account_label = account_label;
-       filtering_action.account_list = account_list;
        filtering_action.account_combo = account_combo;
        filtering_action.tags_label = tags_label;
-       filtering_action.tags_list = tags_list;
        filtering_action.tags_combo = tags_combo;
        filtering_action.dest_entry = dest_entry;
        filtering_action.dest_btn = dest_btn;
@@ -671,6 +599,8 @@ static void prefs_filtering_action_create(void)
        filtering_action.addressbook_btn = addressbook_btn;
        filtering_action.ok_btn = ok_btn;
        filtering_action.action_list_view = action_list_view;
+       
+       prefs_filtering_action_type_selection_changed(NULL, NULL);
 }
 
 /*!
@@ -899,9 +829,9 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
         gint score;
        gchar * header = NULL;
         
-       action_id = get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
+       action_id = gtk_combo_box_get_active(GTK_COMBO_BOX(filtering_action.action_combo));
        action_type = prefs_filtering_action_get_matching_from_action(action_id);
-       list_id = get_sel_from_list(GTK_LIST(filtering_action.account_list));
+       list_id = gtk_combo_box_get_active(GTK_COMBO_BOX(filtering_action.account_combo));
        account_id = get_account_id_from_list_id(list_id);
         score = 0;
         destination = NULL;
@@ -965,7 +895,7 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
                break;
        case ACTION_SET_TAG:
        case ACTION_UNSET_TAG:
-               destination = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(filtering_action.tags_combo)->entry), 0, -1);
+               destination = gtk_editable_get_chars(GTK_EDITABLE(GTK_BIN(filtering_action.tags_combo)->child), 0, -1);
                if (*destination == '\0') {
                        if (alert)
                                 alertpanel_error(_("Tag name is empty."));
@@ -1018,8 +948,8 @@ static void prefs_filtering_action_register_cb(void)
         * what seems to be a bug. this causes any other 
         * list items to be unselectable)
         * prefs_filtering_action_reset_dialog(); */
-       gtk_list_select_item(GTK_LIST(filtering_action.account_list), 0);
-       gtk_list_select_item(GTK_LIST(filtering_action.tags_list), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.tags_combo), 0);
        gtk_entry_set_text(GTK_ENTRY(filtering_action.dest_entry), "");
 }
 
@@ -1292,12 +1222,12 @@ static void prefs_filtering_action_select_addressbook(void)
        g_free(prev);
 }
 
-static void prefs_filtering_action_type_selection_changed(GtkList *list,
-    gpointer user_data)
+static void prefs_filtering_action_type_selection_changed(GtkWidget *combo,
+                                                         gpointer user_data)
 {
        gint value;
 
-       value = get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
+       value = gtk_combo_box_get_active(GTK_COMBO_BOX(filtering_action.action_combo));
 
        if (filtering_action.current_action != value) {
                if (filtering_action.current_action == ACTION_FORWARD 
@@ -1317,14 +1247,6 @@ static void prefs_filtering_action_type_selection_changed(GtkList *list,
                }
                filtering_action.current_action = value;
        }
-}
-
-static void prefs_filtering_action_type_select(GtkList *list,
-    GtkWidget *widget, gpointer user_data)
-{
-       Action value;
-
-       value = (Action) get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
 
        switch (value) {
        case ACTION_MOVE:
@@ -1690,8 +1612,8 @@ static void prefs_filtering_action_type_select(GtkList *list,
 
 static void prefs_filtering_action_reset_dialog(void)
 {
-       gtk_list_select_item(GTK_LIST(filtering_action.action_type_list), 0);
-       gtk_list_select_item(GTK_LIST(filtering_action.account_list), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo), 0);
        gtk_entry_set_text(GTK_ENTRY(filtering_action.dest_entry), "");
 }
 
@@ -1811,101 +1733,101 @@ static gboolean prefs_filtering_actions_selected
 
        switch(action->type) {
        case MATCHACTION_MOVE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MOVE);
                break;
        case MATCHACTION_COPY:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_COPY);
                break;
        case MATCHACTION_DELETE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_DELETE);
                break;
        case MATCHACTION_MARK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK);
                break;
        case MATCHACTION_UNMARK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_UNMARK);
                break;
        case MATCHACTION_LOCK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_LOCK);
                break;
        case MATCHACTION_UNLOCK:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_UNLOCK);
                break;
        case MATCHACTION_MARK_AS_READ:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK_AS_READ);
                break;
        case MATCHACTION_MARK_AS_UNREAD:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK_AS_UNREAD);
                break;
        case MATCHACTION_MARK_AS_SPAM:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK_AS_SPAM);
                break;
        case MATCHACTION_MARK_AS_HAM:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_MARK_AS_HAM);
                break;
        case MATCHACTION_FORWARD:
                list_id = get_list_id_from_account_id(action->account_id);
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_FORWARD);
-               gtk_list_select_item(GTK_LIST(filtering_action.account_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo),
                                     list_id);
                break;
        case MATCHACTION_FORWARD_AS_ATTACHMENT:
                list_id = get_list_id_from_account_id(action->account_id);
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_FORWARD_AS_ATTACHMENT);
-               gtk_list_select_item(GTK_LIST(filtering_action.account_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo),
                                     list_id);
                break;
        case MATCHACTION_REDIRECT:
                list_id = get_list_id_from_account_id(action->account_id);
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_REDIRECT);
-               gtk_list_select_item(GTK_LIST(filtering_action.account_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.account_combo),
                                     list_id);
                break;
        case MATCHACTION_EXECUTE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_EXECUTE);
                break;
        case MATCHACTION_COLOR:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_COLOR);
                gtk_option_menu_set_history(GTK_OPTION_MENU(filtering_action.color_optmenu), action->labelcolor);     
                break;
        case MATCHACTION_CHANGE_SCORE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_CHANGE_SCORE);
                break;
        case MATCHACTION_SET_SCORE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_SET_SCORE);
                break;
        case MATCHACTION_STOP:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_STOP);
                break;
        case MATCHACTION_HIDE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_HIDE);
                break;
        case MATCHACTION_IGNORE:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_IGNORE);
                break;
        case MATCHACTION_WATCH:
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_WATCH);
                break;
        case MATCHACTION_ADD_TO_ADDRESSBOOK:
@@ -1913,7 +1835,7 @@ static gboolean prefs_filtering_actions_selected
                        gtk_entry_set_text(GTK_ENTRY(filtering_action.header_entry), action->header);
                else
                        gtk_entry_set_text(GTK_ENTRY(filtering_action.header_entry), "");
-               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(filtering_action.action_combo),
                                     ACTION_ADD_TO_ADDRESSBOOK);
        }
 
index bdf2e6e..e3a02d0 100644 (file)
@@ -46,6 +46,7 @@
 #include "alertpanel.h"
 #include "folder.h"
 #include "description_window.h"
+#include "combobox.h"
 
 #include "matcher_parser.h"
 #include "colorlabel.h"
@@ -71,14 +72,10 @@ static struct Matcher {
        GtkWidget *predicate_flag_combo;
        GtkWidget *header_combo;
        GtkWidget *header_addr_combo;
+       GtkWidget *bool_op_combo;
+       GtkWidget *criteria_combo;
 
-       GtkWidget *criteria_list;
-
-       GtkWidget *predicate_list;
        GtkWidget *predicate_label;
-       GtkWidget *predicate_flag_list;
-
-       GtkWidget *bool_op_list;
 
        GtkWidget *header_entry;
        GtkWidget *header_label;
@@ -212,64 +209,22 @@ static struct_criteria_text criteria_text [] = {
        { NULL, FALSE }
 };
 
-/*!
- *\brief       Boolean / predicate constants
- *
- *\warning     Same order as #bool_op_text!
- */
-enum {
-       BOOL_OP_OR = 0,
-       BOOL_OP_AND = 1
-};
-
-/*!
- *\brief       Descriptive text in UI
- */
-static const gchar *bool_op_text [] = {
-       N_("or"), N_("and")
-};
-
 /*!
  *\brief       Contains predicate      
- *
- *\warning     Same order as in #predicate_text
  */
 enum {
        PREDICATE_CONTAINS = 0,
        PREDICATE_DOES_NOT_CONTAIN = 1
 };
 
-/*!
- *\brief       Descriptive text in UI for predicate
- */
-static const gchar *predicate_text [] = {
-       N_("contains"), N_("does not contain")
-};
-
-/*!
- *\brief       Preset addressbook book/folder items
- */
-static const gchar *addressbook_folder_text [] = {
-       N_("Any")
-};
-
 /*!
  *\brief       Enabled predicate
- *
- *\warning     Same order as in #predicate_flag_text
  */
 enum {
        PREDICATE_FLAG_ENABLED = 0,
        PREDICATE_FLAG_DISABLED = 1
 };
 
-/*!
- *\brief       Descriptive text in UI for enabled flag
- */
-static const gchar *predicate_flag_text [] = {
-       N_("yes"), N_("no")
-};
-
 /*!
  *\brief       Hooks
  */
@@ -296,8 +251,7 @@ static void prefs_matcher_ok                (void);
 static void prefs_matcher_cancel       (void);
 static gint prefs_matcher_deleted      (GtkWidget *widget, GdkEventAny *event,
                                         gpointer data);
-static void prefs_matcher_criteria_select      (GtkList   *list,
-                                                GtkWidget *widget,
+static void prefs_matcher_criteria_select      (GtkWidget *widget,
                                                 gpointer   user_data);
 static MatcherList *prefs_matcher_get_list     (void);
 
@@ -318,29 +272,6 @@ static gboolean prefs_matcher_selected                     (GtkTreeSelection *selector,
                                                         gboolean currently_selected,
                                                         gpointer data);
 
-/*!
- *\brief       Find index of list selection 
- *
- *\param       list GTK list widget
- *
- *\return      gint Selection index
- */
-static gint get_sel_from_list(GtkList *list)
-{
-       gint row = 0;
-       void * sel;
-       GList * child;
-
-       sel = list->selection->data;
-       for (child = list->children; child != NULL; child = g_list_next(child)) {
-               if (child->data == sel)
-                       return row;
-               row ++;
-       }
-       
-       return row;
-}
-
 /*!
  *\brief       Opens the matcher dialog with a list of conditions
  *
@@ -396,6 +327,8 @@ static void prefs_matcher_create(void)
        GtkWidget *vbox1;
        GtkWidget *vbox2;
        GtkWidget *vbox3;
+       GtkWidget *vbox_pred;
+       GtkWidget *hbox_pred;
        GtkWidget *criteria_table;
 
        GtkWidget *hbox1;
@@ -407,19 +340,15 @@ static void prefs_matcher_create(void)
        GtkWidget *header_addr_entry;
        GtkWidget *header_addr_label;
        GtkWidget *criteria_combo;
-       GtkWidget *criteria_list;
        GtkWidget *criteria_label;
        GtkWidget *value_label;
        GtkWidget *value_entry;
        GtkWidget *addressbook_folder_label;
        GtkWidget *addressbook_folder_combo;
        GtkWidget *predicate_combo;
-       GtkWidget *predicate_list;
        GtkWidget *predicate_flag_combo;
-       GtkWidget *predicate_flag_list;
        GtkWidget *predicate_label;
        GtkWidget *bool_op_combo;
-       GtkWidget *bool_op_list;
        GtkWidget *bool_op_label;
 
        GtkWidget *regexp_checkbtn;
@@ -445,7 +374,6 @@ static void prefs_matcher_create(void)
 
        GtkWidget *color_optmenu;
 
-       GList *combo_items;
        gint i;
        static GdkGeometry geometry;
 
@@ -501,34 +429,24 @@ static void prefs_matcher_create(void)
        gtk_table_attach(GTK_TABLE(criteria_table), criteria_label, 0, 1, 0, 1,
                         GTK_FILL, 0, 0, 0);
 
-       criteria_combo = gtk_combo_new();
+       criteria_combo = gtk_combo_box_new_text();
        gtk_widget_show(criteria_combo);
 
-       combo_items = NULL;
-
        for (i = 0; criteria_text[i].text != NULL; i++) {
-               if (criteria_text[i].contains_header_name)
-                       combo_items = g_list_append(combo_items,
-                                           (gpointer) prefs_common_translated_header_name(criteria_text[i].text));
-               else
-                       combo_items = g_list_append(combo_items,
-                                           (gpointer) gettext(criteria_text[i].text));
+               gtk_combo_box_append_text(GTK_COMBO_BOX(criteria_combo),
+                       criteria_text[i].contains_header_name ?
+                                   (gpointer) prefs_common_translated_header_name(criteria_text[i].text) :
+                                   (gpointer) gettext(criteria_text[i].text));
        }
-       gtk_combo_set_popdown_strings(GTK_COMBO(criteria_combo), combo_items);
-
-       g_list_free(combo_items);
 
+       gtk_combo_box_set_active(GTK_COMBO_BOX(criteria_combo), CRITERIA_ALL);
        gtk_widget_set_size_request(criteria_combo, 190, -1);
        gtk_table_attach(GTK_TABLE(criteria_table), criteria_combo, 0, 1, 1, 2,
                          0, 0, 0, 0);
-       criteria_list = GTK_COMBO(criteria_combo)->list;
-       g_signal_connect(G_OBJECT(criteria_list), "select-child",
+       g_signal_connect(G_OBJECT(criteria_combo), "changed",
                         G_CALLBACK(prefs_matcher_criteria_select),
                         NULL);
 
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(criteria_combo)->entry),
-                              FALSE);
-
        /* header name */
 
        header_label = gtk_label_new(_("Header name"));
@@ -537,18 +455,14 @@ static void prefs_matcher_create(void)
        gtk_table_attach(GTK_TABLE(criteria_table), header_label, 1, 2, 0, 1,
                         GTK_FILL, 0, 0, 0);
 
-       header_combo = gtk_combo_new();
-       gtk_widget_show(header_combo);
-       gtk_widget_set_size_request(header_combo, 120, -1);
-       gtkut_combo_set_items(GTK_COMBO (header_combo),
+       header_combo = combobox_text_new(TRUE,
                              "Subject", "From", "To", "Cc", "Reply-To",
                              "Sender", "X-ML-Name", "X-List", "X-Sequence",
-                             "X-Mailer","X-BeenThere",
-                             NULL);
+                             "X-Mailer","X-BeenThere", NULL);
+       gtk_widget_set_size_request(header_combo, 120, -1);
        gtk_table_attach(GTK_TABLE(criteria_table), header_combo, 1, 2, 1, 2,
                         0, 0, 0, 0);
-       header_entry = GTK_COMBO(header_combo)->entry;
-       gtk_entry_set_editable(GTK_ENTRY(header_entry), TRUE);
+       header_entry = GTK_BIN (header_combo)->child;
 
        /* address header name */
 
@@ -557,16 +471,13 @@ static void prefs_matcher_create(void)
        gtk_table_attach(GTK_TABLE(criteria_table), header_addr_label, 1, 2, 0, 1,
                         GTK_FILL, 0, 0, 0);
 
-       header_addr_combo = gtk_combo_new();
-       gtk_widget_set_size_request(header_addr_combo, 120, -1);
-       gtkut_combo_set_items(GTK_COMBO (header_addr_combo),
+       header_addr_combo = combobox_text_new(TRUE,
                              Q_("Filtering Matcher Menu|All"),
-                             _("Any"), "From", "To", "Cc", "Reply-To", "Sender",
-                             NULL);
+                             _("Any"), "From", "To", "Cc", "Reply-To", "Sender", NULL);
+       gtk_widget_set_size_request(header_addr_combo, 120, -1);
        gtk_table_attach(GTK_TABLE(criteria_table), header_addr_combo, 1, 2, 1, 2,
                         0, 0, 0, 0);
-       header_addr_entry = GTK_COMBO(header_addr_combo)->entry;
-       gtk_entry_set_editable(GTK_ENTRY(header_addr_entry), TRUE);
+       header_addr_entry = GTK_BIN(header_addr_combo)->child;
 
        /* value */
 
@@ -589,20 +500,8 @@ static void prefs_matcher_create(void)
        gtk_table_attach(GTK_TABLE(criteria_table), addressbook_folder_label, 2, 3, 0, 1,
                         GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
 
-       addressbook_folder_combo = gtk_combo_new();
-       gtk_widget_show(addressbook_folder_combo);
+       addressbook_folder_combo = combobox_text_new(TRUE, _("Any"), NULL);
        gtk_widget_set_size_request(addressbook_folder_combo, 200, -1);
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(addressbook_folder_combo)->entry),
-                              TRUE);
-
-       combo_items = NULL;
-       for (i = 0; i < (gint) (sizeof(addressbook_folder_text) / sizeof(gchar *)); i++) {
-               combo_items = g_list_append(combo_items,
-                                           (gpointer) _(addressbook_folder_text[i]));
-       }
-       gtk_combo_set_popdown_strings(GTK_COMBO(addressbook_folder_combo), combo_items);
-       g_list_free(combo_items);
-
        gtk_table_attach(GTK_TABLE(criteria_table), addressbook_folder_combo, 2, 3, 1, 2,
                         GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
 
@@ -631,6 +530,12 @@ static void prefs_matcher_create(void)
 
        /* predicate */
 
+       vbox_pred = gtk_vbox_new(TRUE, VSPACING);
+       gtk_widget_show(vbox_pred);
+
+       hbox_pred = gtk_hbox_new(FALSE, VSPACING);
+       gtk_widget_show(hbox_pred);
+
        vbox2 = gtk_vbox_new(FALSE, VSPACING);
        gtk_widget_show(vbox2);
        gtk_box_pack_start(GTK_BOX(vbox1), vbox2, FALSE, FALSE, 0);
@@ -638,51 +543,26 @@ static void prefs_matcher_create(void)
        hbox1 = gtk_hbox_new(FALSE, 8);
        gtk_widget_show(hbox1);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox1, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox1), hbox_pred, FALSE, FALSE, 0);
+
 
        predicate_label = gtk_label_new(_("Predicate"));
        gtk_widget_show(predicate_label);
-       gtk_box_pack_start(GTK_BOX(hbox1), predicate_label,
+       gtk_box_pack_start(GTK_BOX(hbox_pred), predicate_label,
                           FALSE, FALSE, 0);
 
-       predicate_combo = gtk_combo_new();
-       gtk_widget_show(predicate_combo);
+       predicate_combo = combobox_text_new(FALSE, _("contains"),
+                                           _("does not contain"), NULL);
        gtk_widget_set_size_request(predicate_combo, 120, -1);
-       predicate_list = GTK_COMBO(predicate_combo)->list;
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(predicate_combo)->entry),
-                              FALSE);
-
-       combo_items = NULL;
-
-       for (i = 0; i < (gint) (sizeof(predicate_text) / sizeof(gchar *)); i++) {
-               combo_items = g_list_append(combo_items,
-                                           (gpointer) _(predicate_text[i]));
-       }
-       gtk_combo_set_popdown_strings(GTK_COMBO(predicate_combo), combo_items);
-
-       g_list_free(combo_items);
-
-       gtk_box_pack_start(GTK_BOX(hbox1), predicate_combo,
+       gtk_box_pack_start(GTK_BOX(vbox_pred), predicate_combo,
                           FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox_pred), vbox_pred, FALSE, FALSE, 0);
 
        /* predicate flag */
 
-       predicate_flag_combo = gtk_combo_new();
-       gtk_widget_hide(predicate_flag_combo);
+       predicate_flag_combo = combobox_text_new(FALSE, _("yes"), _("no"), NULL);
        gtk_widget_set_size_request(predicate_flag_combo, 120, -1);
-       predicate_flag_list = GTK_COMBO(predicate_flag_combo)->list;
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(predicate_flag_combo)->entry), FALSE);
-
-       combo_items = NULL;
-
-       for (i = 0; i < (gint) (sizeof(predicate_text) / sizeof(gchar *)); i++) {
-               combo_items = g_list_append(combo_items, (gpointer) _(predicate_flag_text[i]));
-       }
-       gtk_combo_set_popdown_strings(GTK_COMBO(predicate_flag_combo),
-                                     combo_items);
-
-       g_list_free(combo_items);
-
-       gtk_box_pack_start(GTK_BOX(hbox1), predicate_flag_combo,
+       gtk_box_pack_start(GTK_BOX(vbox_pred), predicate_flag_combo,
                           FALSE, FALSE, 0);
 
        vbox3 = gtk_vbox_new(FALSE, 0);
@@ -734,23 +614,8 @@ static void prefs_matcher_create(void)
        gtk_box_pack_start(GTK_BOX(btn_hbox), bool_op_label,
                           FALSE, FALSE, 0);
 
-       bool_op_combo = gtk_combo_new();
-       gtk_widget_show(bool_op_combo);
+       bool_op_combo = combobox_text_new(FALSE, _("or"), _("and"), NULL);
        gtk_widget_set_size_request(bool_op_combo, 60, -1);
-       bool_op_list = GTK_COMBO(bool_op_combo)->list;
-       gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(bool_op_combo)->entry),
-                              FALSE);
-
-       combo_items = NULL;
-
-       for (i = 0; i < (gint) (sizeof(bool_op_text) / sizeof(gchar *)); i++) {
-               combo_items = g_list_append(combo_items,
-                                           (gpointer) _(bool_op_text[i]));
-       }
-       gtk_combo_set_popdown_strings(GTK_COMBO(bool_op_combo), combo_items);
-
-       g_list_free(combo_items);
-
        gtk_box_pack_start(GTK_BOX(btn_hbox), bool_op_combo,
                           FALSE, FALSE, 0);
 
@@ -807,7 +672,7 @@ static void prefs_matcher_create(void)
 
        matcher.ok_btn = ok_btn;
 
-       matcher.criteria_list = criteria_list;
+       matcher.criteria_combo = criteria_combo;
        matcher.header_combo = header_combo;
        matcher.header_entry = header_entry;
        matcher.header_label = header_label;
@@ -819,13 +684,11 @@ static void prefs_matcher_create(void)
        matcher.addressbook_folder_label = addressbook_folder_label;
        matcher.addressbook_folder_combo = addressbook_folder_combo;
        matcher.predicate_label = predicate_label;
-       matcher.predicate_list = predicate_list;
        matcher.predicate_combo = predicate_combo;
-       matcher.predicate_flag_list = predicate_flag_list;
        matcher.predicate_flag_combo = predicate_flag_combo;
        matcher.case_checkbtn = case_checkbtn;
        matcher.regexp_checkbtn = regexp_checkbtn;
-       matcher.bool_op_list = bool_op_list;
+       matcher.bool_op_combo = bool_op_combo;
        matcher.test_btn = test_btn;
        matcher.addressbook_select_btn = addressbook_select_btn;
        matcher.color_optmenu = color_optmenu;
@@ -834,7 +697,7 @@ static void prefs_matcher_create(void)
        matcher.cond_list_view = cond_list_view;
 
        matcher.selected_criteria = -1;
-       prefs_matcher_criteria_select(GTK_LIST(criteria_list), NULL, NULL);
+       prefs_matcher_criteria_select(criteria_combo, NULL);
 }
 
 /*!
@@ -872,12 +735,12 @@ static void prefs_matcher_list_view_set_row(GtkTreeIter *row, MatcherProp *prop)
  */
 static void prefs_matcher_reset_condition(void)
 {
-       gtk_list_select_item(GTK_LIST(matcher.criteria_list), 0);
-       gtk_list_select_item(GTK_LIST(matcher.predicate_list), 0);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.criteria_combo), CRITERIA_ALL);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.predicate_combo), PREDICATE_CONTAINS);
        gtk_entry_set_text(GTK_ENTRY(matcher.header_entry), "");
        gtk_entry_set_text(GTK_ENTRY(matcher.header_addr_entry), "");
        gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), "");
-       gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(matcher.addressbook_folder_combo)->entry), "");
+       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(matcher.addressbook_folder_combo)->child), "");
 }
 
 /*!
@@ -906,7 +769,7 @@ static void prefs_matcher_set_dialog(MatcherList *matchers)
                bool_op = matchers->bool_and;
        }
        
-       gtk_list_select_item(GTK_LIST(matcher.bool_op_list), bool_op);
+       gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.bool_op_combo), bool_op);
 
        prefs_matcher_reset_condition();
 }
@@ -952,7 +815,7 @@ static MatcherList *prefs_matcher_get_list(void)
                }
        } while (gtk_tree_model_iter_next(model, &iter));
 
-       bool_and = get_sel_from_list(GTK_LIST(matcher.bool_op_list));
+       bool_and = gtk_combo_box_get_active(GTK_COMBO_BOX(matcher.bool_op_combo));
 
        matchers = matcherlist_new(matcher_list, bool_and);
 
@@ -1261,12 +1124,12 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void)
        gint value;
        const gchar *value_str;
 
-       value_criteria = get_sel_from_list(GTK_LIST(matcher.criteria_list));
+       value_criteria = gtk_combo_box_get_active(GTK_COMBO_BOX(matcher.criteria_combo));
 
        criteria = prefs_matcher_get_matching_from_criteria(value_criteria);
 
-       value_pred = get_sel_from_list(GTK_LIST(matcher.predicate_list));
-       value_pred_flag = get_sel_from_list(GTK_LIST(matcher.predicate_flag_list));
+       value_pred = gtk_combo_box_get_active(GTK_COMBO_BOX(matcher.predicate_combo));
+       value_pred_flag = gtk_combo_box_get_active(GTK_COMBO_BOX(matcher.predicate_flag_combo));
 
        use_regexp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(matcher.regexp_checkbtn));
        case_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(matcher.case_checkbtn));
@@ -1395,7 +1258,7 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void)
 
        case CRITERIA_FOUND_IN_ADDRESSBOOK:
                header = gtk_entry_get_text(GTK_ENTRY(matcher.header_addr_entry));
-               expr = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(matcher.addressbook_folder_combo)->entry));
+               expr = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(matcher.addressbook_folder_combo)->child));
 
                if (*header == '\0') {
                    alertpanel_error(_("Header name is not set."));
@@ -1633,19 +1496,17 @@ static void prefs_matcher_enable_widget(GtkWidget* widget)
 /*!
  *\brief       Change widgets depending on the selected condition
  *
- *\param       list List widget
- *\param       widget Not used
+ *\param       criteria combo widget
  *\param       user_data Not used      
  */
-static void prefs_matcher_criteria_select(GtkList *list,
-                                         GtkWidget *widget,
+static void prefs_matcher_criteria_select(GtkWidget *widget,
                                          gpointer user_data)
 {
        gint value, old_value;
 
        old_value = matcher.selected_criteria;
-       matcher.selected_criteria = value = get_sel_from_list
-               (GTK_LIST(matcher.criteria_list));
+       matcher.selected_criteria = value = gtk_combo_box_get_active
+               (GTK_COMBO_BOX(matcher.criteria_combo));
 
        if (old_value == matcher.selected_criteria)
                return;
@@ -1985,10 +1846,10 @@ static void prefs_matcher_addressbook_select(void)
        gchar *folderpath = NULL;
        gboolean ret = FALSE;
 
-       folderpath = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(matcher.addressbook_folder_combo)->entry));
+       folderpath = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_BIN(matcher.addressbook_folder_combo)->child));
        ret = addressbook_folder_selection(&folderpath);
        if ( ret != FALSE && folderpath != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(matcher.addressbook_folder_combo)->entry), folderpath);
+               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(matcher.addressbook_folder_combo)->child), folderpath);
 }
 
 
@@ -2104,7 +1965,7 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
 
        criteria = prefs_matcher_get_criteria_from_matching(prop->criteria);
        if (criteria != -1)
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
+               gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.criteria_combo),
                                     criteria);
 
        switch(prop->criteria) {
@@ -2194,7 +2055,7 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
                        expr = prop->expr;
 
                gtk_entry_set_text(GTK_ENTRY(matcher.header_addr_entry), header);
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(matcher.addressbook_folder_combo)->entry), expr);
+               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(matcher.addressbook_folder_combo)->child), expr);
                break;
        }
 
@@ -2223,11 +2084,15 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
        }
 
        if (negative_cond) {
-               gtk_list_select_item(GTK_LIST(matcher.predicate_list), 1);
-               gtk_list_select_item(GTK_LIST(matcher.predicate_flag_list), 1);
+               gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.predicate_combo),
+                                        PREDICATE_DOES_NOT_CONTAIN);
+               gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.predicate_flag_combo),
+                                        PREDICATE_FLAG_DISABLED);
        } else {
-               gtk_list_select_item(GTK_LIST(matcher.predicate_list), 0);
-               gtk_list_select_item(GTK_LIST(matcher.predicate_flag_list), 0);
+               gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.predicate_combo),
+                                        PREDICATE_CONTAINS);
+               gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.predicate_flag_combo),
+                                        PREDICATE_FLAG_ENABLED);
        }
        
        switch(prop->matchtype) {
index bbc452a..f78d0f8 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "gtk/gtkutils.h"
 #include "gtk/prefswindow.h"
+#include "combobox.h"
 
 #include "manage_window.h"
 #ifdef HAVE_LIBETPAN
@@ -106,15 +107,13 @@ static void prefs_keybind_select(void)
        gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
        gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
 
-       combo = gtk_combo_new ();
-       gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
-       gtkut_combo_set_items (GTK_COMBO (combo),
+       combo = combobox_text_new(FALSE,
                               _("Default"),
                               "Mew / Wanderlust",
                               "Mutt",
                               _("Old Sylpheed"),
                               NULL);
-       gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO (combo)->entry), FALSE);
+       gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
@@ -198,7 +197,7 @@ static void prefs_keybind_apply(struct KeyBind keybind[], gint num)
 
 static void prefs_keybind_apply_clicked(GtkWidget *widget)
 {
-       GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry);
+       GtkEntry *entry = GTK_ENTRY(GTK_BIN(keybind.combo)->child);
        const gchar *text;
        struct KeyBind *menurc;
        gint n_menurc;
index e203f05..feaa4d8 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "stock_pixmap.h"
 #include "manage_window.h"
+#include "combobox.h"
 #include "gtkutils.h"
 #include "mainwindow.h"
 #include "alertpanel.h"
@@ -334,28 +335,17 @@ static void prefs_toolbar_set_displayed(ToolbarPage *prefs_toolbar)
 
 static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
 {
-       GList *cur;
-       GSList *cur2;
+       GSList *cur;
        gchar *act, *act_name;
 
-       gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_type_combo),
-                                 _("Internal Function"));      
-       gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_type_combo),
-                                 _("User Action"));
-       gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_type_combo),
-                                 _("Separator"));
-       
        prefs_toolbar->combo_action_list = toolbar_get_action_items(prefs_toolbar->source);
-       for(cur = prefs_toolbar->combo_action_list; cur != NULL; cur = cur->next) {
-               act = (gchar *)cur->data;
-               gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_func_combo),
-                                         act);
-       }
-
+       combobox_set_popdown_strings(GTK_COMBO_BOX(prefs_toolbar->item_func_combo),
+                                    prefs_toolbar->combo_action_list);
+       
        /* get currently defined sylpheed actions */
        if (prefs_common.actions_list != NULL) {
-               for (cur2 = prefs_common.actions_list; cur2 != NULL; cur2 = cur2->next) {
-                       act = (gchar *)cur2->data;
+               for (cur = prefs_common.actions_list; cur != NULL; cur = cur->next) {
+                       act = (gchar *)cur->data;
                        get_action_name(act, &act_name);
                        
                        gtk_combo_box_append_text(
@@ -367,7 +357,6 @@ static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
 
        }
        
-       gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_toolbar->item_type_combo), 0);
        gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_toolbar->item_func_combo), 0);
        gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_toolbar->item_action_combo), 0);
        
@@ -828,7 +817,8 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0); 
        
-       item_type_combo = gtk_combo_box_new_text();
+       item_type_combo = combobox_text_new(FALSE, _("Internal Function"),
+                               _("User Action"), _("Separator"), NULL);
        gtk_widget_set_size_request(item_type_combo, 200, -1);
        gtk_table_attach(GTK_TABLE(table), item_type_combo, 1, 3, 0, 1,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
@@ -1224,6 +1214,9 @@ static gboolean set_list_selected(GtkTreeSelection *selector,
                        }
                }
                
+               gtk_widget_show(prefs_toolbar->item_action_combo);
+               gtk_widget_hide(prefs_toolbar->item_func_combo);
+               
                g_free(icon_text);
                g_free(descr);
 
@@ -1247,6 +1240,8 @@ static gboolean set_list_selected(GtkTreeSelection *selector,
 
        gtk_combo_box_set_active(GTK_COMBO_BOX(
                        prefs_toolbar->item_type_combo),ITEM_FUNCTION);
+       gtk_widget_hide(prefs_toolbar->item_action_combo);
+       gtk_widget_show(prefs_toolbar->item_func_combo);
 
        g_free(icon_text);
        g_free(descr);