From 29dc10f3637b0ad777df2bb2575ca5f15c7da34b Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 28 Jan 2018 08:48:18 +0100 Subject: [PATCH] Offer more compatibility code --- include/Desktop/compat.h | 8 ++++++++ src/compat.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/Desktop/compat.h b/include/Desktop/compat.h index 9e09bf0..8ce17d4 100644 --- a/include/Desktop/compat.h +++ b/include/Desktop/compat.h @@ -125,6 +125,14 @@ GtkWidget * gtk_scale_new_with_range(GtkOrientation orientation, GtkWidget * gtk_separator_new(GtkOrientation orientation); +# if !GTK_CHECK_VERSION(2, 18, 0) +GtkAllocation gtk_widget_get_allocation(GtkWidget * widget); +# endif + +# if !GTK_CHECK_VERSION(2, 12, 0) +void gtk_widget_set_tooltip_text(GtkWidget * widget, const gchar * text); +# endif + void gtk_widget_override_font(GtkWidget * widget, const PangoFontDescription * desc); # endif diff --git a/src/compat.c b/src/compat.c index 7b33ce7..90d32ce 100644 --- a/src/compat.c +++ b/src/compat.c @@ -137,6 +137,25 @@ GtkWidget * gtk_separator_new(GtkOrientation orientation) } +# if !GTK_CHECK_VERSION(2, 18, 0) +/* gtk_widget_get_allocation */ +GtkAllocation gtk_widget_get_allocation(GtkWidget * widget) +{ + return widget->allocation; +} +# endif + + +# if !GTK_CHECK_VERSION(2, 12, 0) +/* gtk_widget_set_tooltip_text */ +void gtk_widget_set_tooltip_text(GtkWidget * widget, const gchar * text) +{ + (void) widget; + (void) text; +} +# endif + + /* gtk_widget_override_font */ void gtk_widget_override_font(GtkWidget * widget, const PangoFontDescription * desc)