summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrenderertext.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-11-19 15:01:07 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-11-25 22:46:55 +0900
commit7fc7bd613b1a045a79ce9b1c0b8968c3e7df1d24 (patch)
tree35e68c9688ff918c8a396573c092e68ca64e3933 /gtk/gtkcellrenderertext.c
parent2dd2c7ce054313a3e31b162ce78507c295926e0b (diff)
downloadgtk+-7fc7bd613b1a045a79ce9b1c0b8968c3e7df1d24.tar.gz
Changed GtkCellRendererText to request less than wrap-width if the text is smaller than the wrap-width (or width-chars).
Diffstat (limited to 'gtk/gtkcellrenderertext.c')
-rw-r--r--gtk/gtkcellrenderertext.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index f7df6b140c..120100a52e 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -2153,12 +2153,14 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->width_chars > 0)
min_width =
- xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars));
+ xpad * 2 +
+ MIN (PANGO_PIXELS (text_width),
+ (PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars)));
/* If no width-chars set, minimum for wrapping text will be the wrap-width */
else if (priv->wrap_width > -1)
- min_width = xpad * 2 + rect.x + priv->wrap_width;
+ min_width = xpad * 2 + rect.x + MIN (PANGO_PIXELS (text_width), priv->wrap_width);
else
- min_width = xpad * 2 + rect.x + guess_width;
+ min_width = xpad * 2 + rect.x + PANGO_PIXELS (text_width);
if (priv->width_chars > 0)
nat_width = xpad * 2 +