[Nautilus-list] other ellipsizing issues in nautilus



Hi,

I looked at the output of a grep for "ellipsize" and examined what
needs fixing. There are only three places. 

 - nautilus-news.c and nautilus-file-operations.c need to use 
   a reasonably simple "truncate to max char length" function
   which should be stuck in eel. Look at the get_log_attrs() 
   code in eel_pango_layout_set_text_ellipsized() for how 
   to get the is_cursor_position() flag for deciding where 
   breaks can occur.

 - nautilus-sidebar-tabs.c needs to pass a max width arg to
   draw_one_tab_* and then pass that width to
   eel_pango_layout_set_text_ellipsized(). I am having 
   trouble figuring out what the max width is but once 
   that's done it should be trivial.

Appended is a "commentary patch" ;-)

I don't expect to have time to fix these soon but it's a nice simple
task if someone's interested.

Havoc


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4921
diff -u -p -u -r1.4921 ChangeLog
--- ChangeLog	2002/01/16 08:33:09	1.4921
+++ ChangeLog	2002/01/16 20:31:07
@@ -1,3 +1,12 @@
+2002-01-16  Havoc Pennington  <hp redhat com>
+
+	* libnautilus-private/nautilus-file-operations.c
+	(ellipsize_string_for_dialog): add comment about how this should
+	be fixed
+
+	* components/news/nautilus-news.c (ellipsize_string): add comment
+	about how this should be fixed
+
 === nautilus 1.1.2 ===
 
 2002-01-16  Darin Adler  <darin bentspoon com>
Index: components/news/nautilus-news.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/news/nautilus-news.c,v
retrieving revision 1.52
diff -u -p -u -r1.52 nautilus-news.c
--- components/news/nautilus-news.c	2002/01/08 22:37:48	1.52
+++ components/news/nautilus-news.c	2002/01/16 20:31:07
@@ -1139,7 +1139,15 @@ ellipsize_string (const char *raw_text)
 {
 	char *result, *last_char_ptr;
 	int truncated_length;
-	
+
+#ifdef GNOME2_CONVERSION_COMPLETE
+        /* FIXME this is in no way UTF-8 safe. It should share code with
+         * nautilus-file-operations.c to ellipsize a string to a max char length
+         * (different from ellipsizing to a max pixel width as with
+         * eel_pango_layout_set_text_ellipsized)
+         */
+#endif
+        
 	if (raw_text == NULL) {
 		return NULL;
 	}
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-operations.c,v
retrieving revision 1.141
diff -u -p -u -r1.141 nautilus-file-operations.c
--- libnautilus-private/nautilus-file-operations.c	2002/01/08 09:41:15	1.141
+++ libnautilus-private/nautilus-file-operations.c	2002/01/16 20:31:08
@@ -227,6 +227,20 @@ ellipsize_string_for_dialog (const char 
 	GdkFont *font;
 	int maximum_width;
 
+	/* I believe the most appropriate fix here is to change it to be based on
+	 * some number of characters, rather than on a pixel width.
+	 * We just can't do anything sane with the pixel width since
+	 * we don't have all the PangoLayout information.
+	 *
+	 * So in brief we want an ellipsize function in eel which
+	 * takes a number of chars, computes log attrs for the string,
+	 * and chops the string at one of the is_cursor_position points,
+	 * such that the string has fewer chars than the given number.
+	 *
+	 * Code in nautilus-news.c implements this in a UTF-8-unsafe way,
+	 * should be moved to Eel and used here as well.
+	 */
+	
 	/* get a nice length to ellipsize to, based on the font */
 	font = get_label_font ();
 	maximum_width = gdk_string_width (font, "MMMMMMMMMMMMMMMMMMMMMM");







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