aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-21 04:10:15 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-21 04:10:15 +0800
commit4a08257b83512cc32b73d732ccc53266a22b917c (patch)
treef4bd68280af53cc696626055fb792795bc7628cc /e-util
parent8da37ea812d5b784dade3dc0f05df54fdc60fc7a (diff)
downloadgsoc2013-evolution-4a08257b83512cc32b73d732ccc53266a22b917c.tar.gz
gsoc2013-evolution-4a08257b83512cc32b73d732ccc53266a22b917c.tar.zst
gsoc2013-evolution-4a08257b83512cc32b73d732ccc53266a22b917c.zip
Deal with GtkComboBoxEntry removal in gtk+-3.0.
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-datetime-format.c24
-rw-r--r--e-util/gtk-compat.h7
2 files changed, 26 insertions, 5 deletions
diff --git a/e-util/e-datetime-format.c b/e-util/e-datetime-format.c
index 05630d2ec7..fa0d0f23f6 100644
--- a/e-util/e-datetime-format.c
+++ b/e-util/e-datetime-format.c
@@ -338,7 +338,7 @@ fill_combo_formats (GtkWidget *combo, const gchar *key, DTFormatKind kind)
gint i, idx = 0;
const gchar *fmt;
- g_return_if_fail (GTK_IS_COMBO_BOX_ENTRY (combo));
+ g_return_if_fail (GTK_IS_COMBO_BOX (combo));
switch (kind) {
case DTFormatKindDate:
@@ -388,8 +388,7 @@ update_preview_widget (GtkWidget *combo)
gchar *value;
time_t now;
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX_ENTRY (combo));
+ g_return_if_fail (GTK_IS_COMBO_BOX (combo));
preview = g_object_get_data (G_OBJECT (combo), "preview-label");
g_return_if_fail (preview != NULL);
@@ -412,8 +411,7 @@ format_combo_changed_cb (GtkWidget *combo, gpointer user_data)
DTFormatKind kind;
GKeyFile *keyfile;
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX_ENTRY (combo));
+ g_return_if_fail (GTK_IS_COMBO_BOX (combo));
key = g_object_get_data (G_OBJECT (combo), "format-key");
g_return_if_fail (key != NULL);
@@ -509,7 +507,23 @@ e_datetime_format_add_setup_widget (GtkWidget *table, gint row, const gchar *com
key = gen_key (component, part, kind);
label = gtk_label_new_with_mnemonic (caption ? caption : _("Format:"));
+#if GTK_CHECK_VERSION(2,23,0)
+ /* FIXME Rewrite this when removing the version check. */
+ {
+ GtkListStore *store;
+
+ store = gtk_list_store_new (1, G_TYPE_STRING);
+ combo = g_object_new (
+ GTK_TYPE_COMBO_BOX,
+ "model", store,
+ "has-entry", TRUE,
+ "entry-text-column", 0,
+ NULL);
+ g_object_unref (store);
+ }
+#else
combo = gtk_combo_box_entry_new_text ();
+#endif
fill_combo_formats (combo, key, kind);
gtk_label_set_mnemonic_widget ((GtkLabel *)label, combo);
diff --git a/e-util/gtk-compat.h b/e-util/gtk-compat.h
index cc27e0e7ec..3b9c7ef2e9 100644
--- a/e-util/gtk-compat.h
+++ b/e-util/gtk-compat.h
@@ -14,6 +14,13 @@
#define GtkComboBoxText GtkComboBox
#endif
+#if GTK_CHECK_VERSION (2,23,0)
+#define GTK_COMBO_BOX_ENTRY GTK_COMBO_BOX
+#else
+#define gtk_combo_box_set_entry_text_column \
+ gtk_combo_box_entry_set_text_column
+#endif
+
#if GTK_CHECK_VERSION (2,90,5)
/* Recreate GdkRegion until we drop GTK2 compatibility. */