From bb6b1f152f7f9b46a3e25151f170b242fb6f6af0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 8 Jun 2006 12:47:05 +0000 Subject: [PATCH] Don't call construct_child here, since some apps make assumptions about 2006-06-08 Matthias Clasen * gtk/gtkbutton.c (gtk_button_style_set): Don't call construct_child here, since some apps make assumptions about the lifecycle of the constructed label. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ gtk/gtkbutton.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ea0e3ce35..31cb9c38c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-06-08 Matthias Clasen + + * gtk/gtkbutton.c (gtk_button_style_set): Don't call + construct_child here, since some apps make assumptions + about the lifecycle of the constructed label. + 2006-06-08 Alexander Larsson * gtk/gtkprintoperation-unix.c (finish_print): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ea0e3ce35..31cb9c38c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2006-06-08 Matthias Clasen + + * gtk/gtkbutton.c (gtk_button_style_set): Don't call + construct_child here, since some apps make assumptions + about the lifecycle of the constructed label. + 2006-06-08 Alexander Larsson * gtk/gtkprintoperation-unix.c (finish_print): diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 980dd31bc..9b7d78b19 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -1004,11 +1004,40 @@ gtk_button_unmap (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_button_parent_class)->unmap (widget); } +static void +gtk_button_update_image_spacing (GtkButton *button) +{ + GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button); + GtkWidget *child; + gint spacing; + + /* Keep in sync with gtk_button_construct_child, + * we only want to update the spacing if the box + * was constructed there. + */ + if (!button->constructed || !priv->image) + return; + + child = GTK_BIN (button)->child; + if (GTK_IS_ALIGNMENT (child)) + { + child = GTK_BIN (child)->child; + if (GTK_IS_BOX (child)) + { + gtk_widget_style_get (GTK_WIDGET (button), + "image-spacing", &spacing, + NULL); + + gtk_box_set_spacing (GTK_BOX (child), spacing); + } + } +} + static void gtk_button_style_set (GtkWidget *widget, GtkStyle *prev_style) { - gtk_button_construct_child (GTK_BUTTON (widget)); + gtk_button_update_image_spacing (GTK_BUTTON (widget)); } static void -- 2.43.2