Don't assume statusbar->label is the statusbar's frame's child when

2006-12-25  Christian Persch  <chpe@cvs.gnome.org>

	* gtk/gtkstatusbar.c: (gtk_statusbar_size_allocate):
	Don't assume statusbar->label is the statusbar's frame's child when
	shrinking the size allocation when the grip is shown. Bug #372452.
This commit is contained in:
Christian Persch 2006-12-25 12:12:10 +00:00 committed by Christian Persch
parent fca708fb0e
commit a20da20873
2 changed files with 18 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2006-12-25 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkstatusbar.c: (gtk_statusbar_size_allocate):
Don't assume statusbar->label is the statusbar's frame's child when
shrinking the size allocation when the grip is shown. Bug #372452.
2006-12-25 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkpagesetupunixdialog.c: (printer_status_cb),

View File

@ -802,15 +802,23 @@ gtk_statusbar_size_allocate (GtkWidget *widget,
}
else
{
if (statusbar->label->allocation.width + rect.width > statusbar->frame->allocation.width)
GtkWidget *child;
/* Use the frame's child instead of statusbar->label directly, in case
* the label has been replaced by a container as the frame's child
* (and the label reparented into that container).
*/
child = gtk_bin_get_child (GTK_BIN (statusbar->frame));
if (child->allocation.width + rect.width > statusbar->frame->allocation.width)
{
/* shrink the label to make room for the grip */
*allocation = statusbar->label->allocation;
*allocation = child->allocation;
allocation->width = MAX (1, allocation->width - rect.width);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
allocation->x += statusbar->label->allocation.width - allocation->width;
allocation->x += child->allocation.width - allocation->width;
gtk_widget_size_allocate (statusbar->label, allocation);
gtk_widget_size_allocate (child, allocation);
}
}
}