summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-04-04 16:37:06 -0400
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-04-04 16:37:06 -0400
commit75b8f7d3ae093dfdd8a41a66a9ec1cac65870ded (patch)
tree2e441d1b28e4bd0183ee50503d0371b6f7239e56
parent1212f263c3bf51a5358143b7a61d3d205901fc6f (diff)
downloadgdk-pixbuf-75b8f7d3ae093dfdd8a41a66a9ec1cac65870ded.tar.gz
Fixed GtkBox to not call get_desired_size() on a child when no child is present.
-rw-r--r--gtk/gtkbin.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index e141529e5..069158819 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -42,6 +42,9 @@ static GType gtk_bin_child_type (GtkContainer *container);
static void gtk_bin_extended_layout_interface_init (GtkExtendedLayoutIface *iface);
+
+static GtkExtendedLayoutIface *parent_extended_layout_iface;
+
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER,
G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_LAYOUT,
gtk_bin_extended_layout_interface_init))
@@ -156,11 +159,13 @@ gtk_bin_extended_layout_get_desired_size (GtkExtendedLayout *layout,
GtkRequisition *minimum_size,
GtkRequisition *natural_size)
{
- GtkWidget *child;
+ GtkBin *bin = GTK_BIN (layout);
- child = gtk_bin_get_child (GTK_BIN (layout));
-
- gtk_widget_get_desired_size (child, minimum_size, natural_size);
+ if (bin->child && gtk_widget_get_visible (bin->child))
+ gtk_widget_get_desired_size (bin->child, minimum_size, natural_size);
+ else
+ /* Just let GtkWidgetClass clear the values */
+ parent_extended_layout_iface->get_desired_size (layout, minimum_size, natural_size);
}
static void
@@ -194,7 +199,9 @@ gtk_bin_extended_layout_get_height_for_width (GtkExtendedLayout *layout,
static void
gtk_bin_extended_layout_interface_init (GtkExtendedLayoutIface *iface)
{
- iface->get_desired_size = gtk_bin_extended_layout_get_desired_size;
+ parent_extended_layout_iface = g_type_interface_peek_parent (iface);
+
+ iface->get_desired_size = gtk_bin_extended_layout_get_desired_size;
iface->get_height_for_width = gtk_bin_extended_layout_get_height_for_width;
iface->get_width_for_height = gtk_bin_extended_layout_get_width_for_height;
}