label: Request more natural size for ellipsizing wrapping labels

This commit is contained in:
Benjamin Otte 2011-04-18 04:24:12 +02:00
parent 484e04aed2
commit 38676ef718

View File

@ -3487,6 +3487,7 @@ get_size_for_allocation (GtkLabel *label,
gint *minimum_size,
gint *natural_size)
{
GtkLabelPrivate *priv = label->priv;
PangoLayout *layout;
gint text_height;
@ -3498,7 +3499,15 @@ get_size_for_allocation (GtkLabel *label,
*minimum_size = text_height;
if (natural_size)
*natural_size = text_height;
{
if (priv->ellipsize && priv->wrap)
{
layout = gtk_label_get_measuring_layout (label, layout, allocation * PANGO_SCALE, G_MAXINT);
pango_layout_get_pixel_size (layout, NULL, &text_height);
}
*natural_size = text_height;
}
g_object_unref (layout);
}