From ad8995b0d674d63a0a6898b0879dc3c9bb55dab2 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 31 Aug 2015 14:05:51 +0100 Subject: [PATCH] Stop using GtkAlignment in GTK 3. We were using it in the main config box to ensure everything expanded on window resize, but in GTK3 that's the default anyway. And we were using it to put padding around the edges of the font selector, which is now done using the "margin" property. --- unix/gtkdlg.c | 6 ++++++ unix/gtkfont.c | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 8f6641d8..f5218c51 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -2958,6 +2958,10 @@ void set_dialog_action_area(GtkDialog *dlg, GtkWidget *w) * GTKHButtonBox and go it alone.) */ +#if GTK_CHECK_VERSION(3,0,0) + gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(dlg)), + w, FALSE, TRUE, 0); +#else GtkWidget *align; align = gtk_alignment_new(0, 0, 1, 1); gtk_container_add(GTK_CONTAINER(align), w); @@ -2974,6 +2978,8 @@ void set_dialog_action_area(GtkDialog *dlg, GtkWidget *w) gtk_widget_show(align); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(dlg)), align, FALSE, TRUE, 0); +#endif + w = gtk_hseparator_new(); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(dlg)), w, FALSE, TRUE, 0); diff --git a/unix/gtkfont.c b/unix/gtkfont.c index 54e412f6..8302ac69 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -3058,15 +3058,23 @@ unifontsel *unifontsel_new(const char *wintitle) gtk_table_set_col_spacings(GTK_TABLE(table), 8); #endif gtk_widget_show(table); -#if GTK_CHECK_VERSION(2,4,0) + +#if GTK_CHECK_VERSION(3,0,0) + /* GtkAlignment has become deprecated and we use the "margin" + * property */ + w = table; + g_object_set(G_OBJECT(w), "margin", 8, (const char *)NULL); +#elif GTK_CHECK_VERSION(2,4,0) /* GtkAlignment seems to be the simplest way to put padding round things */ w = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(w), 8, 8, 8, 8); gtk_container_add(GTK_CONTAINER(w), table); gtk_widget_show(w); #else + /* In GTK < 2.4, even that isn't available */ w = table; #endif + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area (GTK_DIALOG(fs->u.window))), w, TRUE, TRUE, 0); @@ -3256,7 +3264,12 @@ unifontsel *unifontsel_new(const char *wintitle) w = gtk_frame_new(NULL); gtk_container_add(GTK_CONTAINER(w), ww); gtk_widget_show(w); -#if GTK_CHECK_VERSION(2,4,0) + +#if GTK_CHECK_VERSION(3,0,0) + /* GtkAlignment has become deprecated and we use the "margin" + * property */ + g_object_set(G_OBJECT(w), "margin", 8, (const char *)NULL); +#elif GTK_CHECK_VERSION(2,4,0) ww = w; /* GtkAlignment seems to be the simplest way to put padding round things */ w = gtk_alignment_new(0, 0, 1, 1); @@ -3264,6 +3277,7 @@ unifontsel *unifontsel_new(const char *wintitle) gtk_container_add(GTK_CONTAINER(w), ww); gtk_widget_show(w); #endif + ww = w; w = gtk_frame_new("Preview of font"); gtk_container_add(GTK_CONTAINER(w), ww);