summaryrefslogtreecommitdiff
path: root/gtk/gtkbbox.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-11-03 23:00:05 -0400
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-11-05 22:19:50 +0900
commita83b0b68ce3164f47e1e16d3202b4abbdd5286c4 (patch)
tree38b32ea1ee64424bd517d4ca84ab94b1dc44d1f7 /gtk/gtkbbox.c
parent7ca240916f0000c44812d41468b9e1f9fb343636 (diff)
downloadgtk+-a83b0b68ce3164f47e1e16d3202b4abbdd5286c4.tar.gz
Handle empty button boxes gracefully
https://bugzilla.gnome.org/show_bug.cgi?id=633915
Diffstat (limited to 'gtk/gtkbbox.c')
-rw-r--r--gtk/gtkbbox.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index ad31d3f779..5fdf837a15 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -774,13 +774,19 @@ gtk_button_box_size_allocate (GtkWidget *widget,
x = allocation->x;
secondary_x = x + primary_size + n_primaries * childspacing;
}
- else
+ else if (nvis_children == 1)
{
- /* one or zero children, just center */
+ /* one child, just center */
childspacing = width;
x = secondary_x = allocation->x
+ (allocation->width - widths[0]) / 2;
}
+ else
+ {
+ /* zero children, meh */
+ childspacing = width;
+ x = secondary_x = allocation->x + allocation->width / 2;
+ }
}
else
{
@@ -790,12 +796,18 @@ gtk_button_box_size_allocate (GtkWidget *widget,
y = allocation->y;
secondary_y = y + primary_size + n_primaries * childspacing;
}
- else
+ else if (nvis_children == 1)
{
- /* one or zero children, just center */
+ /* one child, just center */
childspacing = height;
y = secondary_y = allocation->y
- + (allocation->height - heights[0]) / 2;
+ + (allocation->height - heights[0]) / 2;
+ }
+ else
+ {
+ /* zero children, meh */
+ childspacing = height;
+ y = secondary_y = allocation->y + allocation->height / 2;
}
}