[evolution-data-server/gnome-2-32] Workaround GtkComboBoxText in .ui file (cherry picked from commit fec059d9e81cb3966c360b2e7115cbe224
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-32] Workaround GtkComboBoxText in .ui file (cherry picked from commit fec059d9e81cb3966c360b2e7115cbe224
- Date: Wed, 11 May 2011 00:45:24 +0000 (UTC)
commit 26ff15a20e4ffd3f6e02777431a2d86db406f86d
Author: Milan Crha <mcrha redhat com>
Date: Wed Oct 27 21:41:37 2010 +0200
Workaround GtkComboBoxText in .ui file
(cherry picked from commit fec059d9e81cb3966c360b2e7115cbe224f50b9a)
libedataserverui/e-name-selector-dialog.c | 9 ++++++---
libedataserverui/e-name-selector-dialog.ui | 2 +-
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 72a99ed..c7e4f9f 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 58b98d9..85f281e 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 cbc8cdc..e444ffb 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]