diff options
Diffstat (limited to 'unix/utils/align_label_left.c')
-rw-r--r-- | unix/utils/align_label_left.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/unix/utils/align_label_left.c b/unix/utils/align_label_left.c new file mode 100644 index 00000000..eaae01ab --- /dev/null +++ b/unix/utils/align_label_left.c @@ -0,0 +1,20 @@ +/* + * Helper function to align the text in a GtkLabel to the left, which + * has to be done in several different ways depending on GTK version. + */ + +#include <gtk/gtk.h> +#include "putty.h" +#include "gtkcompat.h" +#include "gtkmisc.h" + +void align_label_left(GtkLabel *label) +{ +#if GTK_CHECK_VERSION(3,16,0) + gtk_label_set_xalign(label, 0.0); +#elif GTK_CHECK_VERSION(3,14,0) + gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START); +#else + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); +#endif +} |