[gtk+/treeview-refactor] Changed GtkCellRendererText to request less than wrap-width if the text is smaller than the wrap-wid
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/treeview-refactor] Changed GtkCellRendererText to request less than wrap-width if the text is smaller than the wrap-wid
- Date: Thu, 25 Nov 2010 13:41:51 +0000 (UTC)
commit 7fc7bd613b1a045a79ce9b1c0b8968c3e7df1d24
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Fri Nov 19 15:01:07 2010 +0900
Changed GtkCellRendererText to request less than wrap-width if the text is smaller than the wrap-width (or width-chars).
gtk/gtkcellrenderertext.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index f7df6b1..120100a 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 +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]