Jens Axboe | f762cef | 2012-03-26 13:51:11 +0200 | [diff] [blame] | 1 | #include <gtk/gtk.h> |
| 2 | |
| 3 | #include "gcompat.h" |
| 4 | |
| 5 | #if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 24 |
| 6 | |
| 7 | GtkWidget *gtk_combo_box_text_new(void) |
| 8 | { |
| 9 | return gtk_combo_box_new(); |
| 10 | } |
| 11 | |
| 12 | void gtk_combo_box_text_append_text(GtkComboBoxText *combo_box, |
| 13 | const gchar *text) |
| 14 | { |
| 15 | gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text); |
| 16 | } |
| 17 | |
| 18 | void gtk_combo_box_text_insert_text(GtkComboBoxText *combo_box, gint position, |
| 19 | const gchar *text) |
| 20 | { |
| 21 | gtk_combo_box_insert_text(GTK_COMBO_BOX(combo_box), position, text); |
| 22 | } |
| 23 | |
| 24 | void gtk_combo_box_text_prepend_text(GtkComboBoxText *combo_box, |
| 25 | const gchar *text) |
| 26 | { |
| 27 | gtk_combo_box_prepend_text(GTK_COMBO_BOX(combo_box), text); |
| 28 | } |
| 29 | |
| 30 | gchar *gtk_combo_box_text_get_active_text(GtkComboBoxText *combo_box) |
| 31 | { |
| 32 | return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box)); |
| 33 | } |
| 34 | |
| 35 | #endif |
Jens Axboe | cd0d2db | 2012-03-26 19:30:24 +0200 | [diff] [blame] | 36 | |
| 37 | #if GTK_MAJOR_VERSION < 3 |
| 38 | |
| 39 | guint gtk_widget_get_allocated_width(GtkWidget *w) |
| 40 | { |
| 41 | return w->allocation.width; |
| 42 | } |
| 43 | |
| 44 | guint gtk_widget_get_allocated_height(GtkWidget *w) |
| 45 | { |
| 46 | return w->allocation.height; |
| 47 | } |
| 48 | |
| 49 | #endif |
Jens Axboe | cf8d54c | 2012-03-26 20:31:32 +0200 | [diff] [blame] | 50 | |
| 51 | #if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 18 |
| 52 | void gtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus) |
| 53 | { |
| 54 | if (can_focus) |
| 55 | GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); |
| 56 | else |
| 57 | GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS); |
| 58 | } |
| 59 | #endif |