]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Stop using GtkAlignment in GTK 3.
authorSimon Tatham <anakin@pobox.com>
Mon, 31 Aug 2015 13:05:51 +0000 (14:05 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 31 Aug 2015 13:13:26 +0000 (14:13 +0100)
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
unix/gtkfont.c

index 8f6641d8e331ab083abeba93abdd45a085be4340..f5218c512ef5c29f859499de1de8a4983cb74763 100644 (file)
@@ -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);
index 54e412f68f2978a0790357820c89182dd3472051..8302ac69c7f0b4db8e2d45ca03025c518b069368 100644 (file)
@@ -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);