ref: 7000b0c70a409afc427b3012d55366577dc0418e
parent: 346584bf6e38232be8773c24fd7dedcbd7b3d9ed
author: Simon Tatham <anakin@pobox.com>
date: Sun Dec 6 11:00:10 EST 2015
Implement align_label for GTK 3.[14,16). gtk_misc_set_alignment was deprecated in GTK 3.14. But my replacement code using gtk_label_set_{x,y}align doesn't work there, because that function wasn't introduced until GTK 3.16, so there are two minor versions in the middle where a third strategy is needed. (That middle strategy doesn't permit arbitrary float alignments, but that's OK, bceause we only actually use multiples of 0.5.)
--- a/gtk.c
+++ b/gtk.c
@@ -1398,6 +1398,13 @@
#if GTK_CHECK_VERSION(3,16,0)
gtk_label_set_xalign(label, x);
gtk_label_set_yalign(label, y);
+#elif GTK_CHECK_VERSION(3,14,0)
+ gtk_widget_set_halign(GTK_WIDGET(label),
+ x == 0 ? GTK_ALIGN_START :
+ x == 1 ? GTK_ALIGN_END : GTK_ALIGN_CENTER);
+ gtk_widget_set_valign(GTK_WIDGET(label),
+ y == 0 ? GTK_ALIGN_START :
+ y == 1 ? GTK_ALIGN_END : GTK_ALIGN_CENTER);
#else
gtk_misc_set_alignment(GTK_MISC(label), x, y);
#endif