Fixed GtkAssistant to not access ->requisition of children directly.

This was causing a 0 height action-area because a GtkBox does not
generally update ->requisition with anything useful
(call gtk_widget_get_child_requisition() here instead).
This commit is contained in:
Tristan Van Berkom 2010-04-18 20:11:43 -04:00
parent 3cbd9e9313
commit fe257d23dd

View File

@ -1145,13 +1145,14 @@ gtk_assistant_size_request (GtkWidget *widget,
requisition->height = height; requisition->height = height;
} }
static void static void
gtk_assistant_size_allocate (GtkWidget *widget, gtk_assistant_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkAssistant *assistant = GTK_ASSISTANT (widget); GtkAssistant *assistant = GTK_ASSISTANT (widget);
GtkAssistantPrivate *priv = assistant->priv; GtkAssistantPrivate *priv = assistant->priv;
GtkRequisition header_requisition; GtkRequisition header_requisition, action_requisition, sidebar_requisition;
GtkAllocation child_allocation, header_allocation; GtkAllocation child_allocation, header_allocation;
gint header_padding, content_padding; gint header_padding, content_padding;
gboolean rtl; gboolean rtl;
@ -1178,24 +1179,28 @@ gtk_assistant_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (priv->header_image, &header_allocation); gtk_widget_size_allocate (priv->header_image, &header_allocation);
/* Action area */ /* Action area */
gtk_widget_get_child_requisition (priv->action_area, &action_requisition);
child_allocation.x = GTK_CONTAINER (widget)->border_width; child_allocation.x = GTK_CONTAINER (widget)->border_width;
child_allocation.y = allocation->height - child_allocation.y = allocation->height -
GTK_CONTAINER (widget)->border_width - priv->action_area->requisition.height; GTK_CONTAINER (widget)->border_width - action_requisition.height;
child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width; child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width;
child_allocation.height = priv->action_area->requisition.height; child_allocation.height = action_requisition.height;
gtk_widget_size_allocate (priv->action_area, &child_allocation); gtk_widget_size_allocate (priv->action_area, &child_allocation);
/* Sidebar */ /* Sidebar */
gtk_widget_get_child_requisition (priv->sidebar_image, &sidebar_requisition);
if (rtl) if (rtl)
child_allocation.x = allocation->width - child_allocation.x = allocation->width -
GTK_CONTAINER (widget)->border_width - priv->sidebar_image->requisition.width; GTK_CONTAINER (widget)->border_width - sidebar_requisition.width;
else else
child_allocation.x = GTK_CONTAINER (widget)->border_width; child_allocation.x = GTK_CONTAINER (widget)->border_width;
child_allocation.y = GTK_CONTAINER (widget)->border_width + child_allocation.y = GTK_CONTAINER (widget)->border_width +
priv->header_image->allocation.height + 2 * header_padding; priv->header_image->allocation.height + 2 * header_padding;
child_allocation.width = priv->sidebar_image->requisition.width; child_allocation.width = sidebar_requisition.width;
child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width - child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
priv->header_image->allocation.height - 2 * header_padding - priv->action_area->allocation.height; priv->header_image->allocation.height - 2 * header_padding - priv->action_area->allocation.height;