1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

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.
This commit is contained in:
Simon Tatham 2015-08-31 14:05:51 +01:00
parent 0b5a0c4da1
commit ad8995b0d6
2 changed files with 22 additions and 2 deletions

View 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);

View 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);