[evolution-patches] 41498: display elipses for overflowing text cells



? gal-1.99.3
? stamp-h1
? docs/gal-api.html
Index: gal/e-table/e-cell-text.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-text.c,v
retrieving revision 1.122
diff -u -p -w -r1.122 e-cell-text.c
--- gal/e-table/e-cell-text.c	16 Apr 2003 21:40:56 -0000	1.122
+++ gal/e-table/e-cell-text.c	17 Apr 2003 18:08:34 -0000
@@ -484,6 +484,21 @@ build_layout (ECellTextView *text_view, 
 
 	if (width > 0)
 		pango_layout_set_width (layout, width * PANGO_SCALE);
+	pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
+
+	while (pango_layout_get_line_count (layout) > 1) {
+		PangoLayoutLine *line = pango_layout_get_line (layout, 0);
+		gchar *line_text = g_strdup (pango_layout_get_text (layout));
+		gchar *last_char = g_utf8_prev_char (line_text + line->length - 1);
+		gchar *new_text;
+		while (*last_char == '.')
+			last_char = g_utf8_prev_char (last_char);
+		*last_char = '\0';
+		new_text = g_strconcat (line_text, " ...", NULL);
+		pango_layout_set_text (layout, new_text, g_utf8_strlen (new_text, -1));
+		g_free (line_text);
+		g_free (new_text);
+	}
 
 	switch (ect->justify) {
 	case GTK_JUSTIFY_RIGHT:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]