diff options
author | Milan Crha <mcrha@redhat.com> | 2010-10-27 21:41:37 +0200 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2011-05-11 01:42:12 +0100 |
commit | 26ff15a20e4ffd3f6e02777431a2d86db406f86d (patch) | |
tree | 2897522cb1ce6c960fb01351fb8a76dc29eb09c8 | |
parent | 3b146b852d2620aa8632afa539adad3c31870764 (diff) | |
download | evolution-data-server-26ff15a20e4ffd3f6e02777431a2d86db406f86d.tar.gz |
Workaround GtkComboBoxText in .ui file
(cherry picked from commit fec059d9e81cb3966c360b2e7115cbe224f50b9a)
-rw-r--r-- | libedataserverui/e-name-selector-dialog.c | 9 | ||||
-rw-r--r-- | libedataserverui/e-name-selector-dialog.ui | 2 | ||||
-rw-r--r-- | libedataserverui/gtk-compat.h | 22 |
3 files changed, 29 insertions, 4 deletions
diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c index 72a99edcd..c7e4f9fe3 100644 --- a/libedataserverui/e-name-selector-dialog.c +++ b/libedataserverui/e-name-selector-dialog.c @@ -43,6 +43,10 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_NAME_SELECTOR_DIALOG, ENameSelectorDialogPrivate)) +#if !GTK_CHECK_VERSION (2,23,0) + ENSURE_GTK_COMBO_BOX_TEXT_TYPE +#endif + typedef struct { gchar *name; @@ -125,9 +129,8 @@ e_name_selector_dialog_populate_categories (ENameSelectorDialog *name_selector_d continue; gtk_combo_box_text_append_text ( - GTK_COMBO_BOX (combo_box), iter->data); + GTK_COMBO_BOX_TEXT (combo_box), iter->data); } - g_list_free (category_list); g_signal_connect_swapped ( @@ -891,7 +894,7 @@ search_changed (ENameSelectorDialog *name_selector_dialog) if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)) == -1) gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0); - category = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX (combo_box)); + category = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo_box)); category_escaped = escape_sexp_string (category); text = gtk_entry_get_text (name_selector_dialog->priv->search_entry); diff --git a/libedataserverui/e-name-selector-dialog.ui b/libedataserverui/e-name-selector-dialog.ui index 58b98d923..85f281e9d 100644 --- a/libedataserverui/e-name-selector-dialog.ui +++ b/libedataserverui/e-name-selector-dialog.ui @@ -224,7 +224,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="combobox-category"> + <object class="GtkComboBoxText" id="combobox-category"> <property name="visible">True</property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> diff --git a/libedataserverui/gtk-compat.h b/libedataserverui/gtk-compat.h index cbc8cdc3d..e444ffb08 100644 --- a/libedataserverui/gtk-compat.h +++ b/libedataserverui/gtk-compat.h @@ -25,6 +25,28 @@ #define gtk_combo_box_text_new gtk_combo_box_new_text #define gtk_combo_box_text_append_text gtk_combo_box_append_text #define gtk_combo_box_text_get_active_text gtk_combo_box_get_active_text +#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX + +/* The below can be used only once in sources */ +#define ENSURE_GTK_COMBO_BOX_TEXT_TYPE \ + GType gtk_combo_box_text_get_type (void); \ + typedef struct _GtkComboBoxText GtkComboBoxText; \ + typedef struct _GtkComboBoxTextClass GtkComboBoxTextClass; \ + \ + struct _GtkComboBoxText { \ + GtkComboBox parent; \ + }; \ + \ + struct _GtkComboBoxTextClass { \ + GtkComboBoxClass parent_class; \ + }; \ + \ + \ + G_DEFINE_TYPE (GtkComboBoxText, gtk_combo_box_text, GTK_TYPE_COMBO_BOX) \ + \ + static void gtk_combo_box_text_init (GtkComboBoxText *cbt) {} \ + static void gtk_combo_box_text_class_init (GtkComboBoxTextClass *kl) {} + #endif #if GTK_CHECK_VERSION (2,90,5) |