[evolution-data-server] Workaround GtkComboBoxText in .ui file
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Workaround GtkComboBoxText in .ui file
- Date: Wed, 27 Oct 2010 19:42:16 +0000 (UTC)
commit fec059d9e81cb3966c360b2e7115cbe224f50b9a
Author: Milan Crha <mcrha redhat com>
Date: Wed Oct 27 21:41:37 2010 +0200
Workaround GtkComboBoxText in .ui file
libedataserverui/e-name-selector-dialog.c | 8 ++++++--
libedataserverui/e-name-selector-dialog.ui | 2 +-
libedataserverui/gtk-compat.h | 22 ++++++++++++++++++++++
3 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c
index 6fb38a8..b759a5e 100644
--- a/libedataserverui/e-name-selector-dialog.c
+++ b/libedataserverui/e-name-selector-dialog.c
@@ -42,6 +42,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;
@@ -120,7 +124,7 @@ e_name_selector_dialog_populate_categories (ENameSelectorDialog *name_selector_d
category_list = e_categories_get_list ();
for (iter = category_list; iter != NULL; iter = iter->next)
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 (
@@ -884,7 +888,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 86afa64..21d861b 100644
--- a/libedataserverui/gtk-compat.h
+++ b/libedataserverui/gtk-compat.h
@@ -9,6 +9,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]