summaryrefslogtreecommitdiff
path: root/gtk/compat.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-04-11 15:20:52 +0100
committerVincent Sanders <vince@kyllikki.org>2015-04-11 15:20:52 +0100
commitdf4e9e322dc8c64af1fc8aabc26c8d4ddab32574 (patch)
treea4b4b0d8553fcf1cbee0f0ba0439b1d301694105 /gtk/compat.c
parente193566de41d65e055db306b9ca28b35daa8bc43 (diff)
downloadnetsurf-df4e9e322dc8c64af1fc8aabc26c8d4ddab32574.tar.gz
netsurf-df4e9e322dc8c64af1fc8aabc26c8d4ddab32574.tar.bz2
Add widget alignment gtk compatability interface.
Diffstat (limited to 'gtk/compat.c')
-rw-r--r--gtk/compat.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gtk/compat.c b/gtk/compat.c
index 14284fc57..8484c02fd 100644
--- a/gtk/compat.c
+++ b/gtk/compat.c
@@ -543,3 +543,43 @@ gboolean nsgtk_icon_size_lookup_for_settings(GtkSettings *settings,
return gtk_icon_size_lookup_for_settings(settings, size, width, height);
#endif
}
+
+/* exported interface documented in gtk/compat.h */
+void nsgtk_widget_set_alignment(GtkWidget *widget, GtkAlign halign, GtkAlign valign)
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_set_halign(widget, halign);
+ gtk_widget_set_valign(widget, valign);
+#else
+ gfloat x, y;
+ switch(halign) {
+ case GTK_ALIGN_START:
+ x = 0.0;
+ break;
+
+ case GTK_ALIGN_END:
+ x = 1.0;
+ break;
+
+ default:
+ x = 0.5;
+ break;
+ }
+
+ switch(valign) {
+ case GTK_ALIGN_START:
+ y = 0.0;
+ break;
+
+ case GTK_ALIGN_END:
+ y = 1.0;
+ break;
+
+ default:
+ y = 0.5;
+ break;
+ }
+
+ gtk_misc_set_alignment(GTK_MISC(widget), x, y);
+#endif
+}