diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-06-08 12:47:05 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-06-08 12:47:05 +0000 |
commit | bb6b1f152f7f9b46a3e25151f170b242fb6f6af0 (patch) | |
tree | 322f368534a0789305e6fb6524ec98ed5ad6bebf /gtk/gtkbutton.c | |
parent | fd3b835e297f1ce565faebcc997f4a86e847efa1 (diff) | |
download | gtk+-bb6b1f152f7f9b46a3e25151f170b242fb6f6af0.tar.gz |
Don't call construct_child here, since some apps make assumptions about
2006-06-08 Matthias Clasen <mclasen@redhat.com>
* 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.
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r-- | gtk/gtkbutton.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 980dd31bc3..9b7d78b195 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -1005,10 +1005,39 @@ gtk_button_unmap (GtkWidget *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 |