Re: Getting patches looked at



Alexander Larsson wrote:
What you want to do is use the ellipsize functions in pango (like
pango_layout_set_ellipsize) that do all the complicated work for you.

(I've just commented this on the bug itself, but also copying here)

Thanks for the comments. I started looking at the Pango docs, and then worked out there's an easier way to do this... get the GtkLabel to do it for us. This patch sets the ellipsize property on the location label to PANGO_ELLIPSIZE_END, and then sets the maximum requested characters for the label to MAX_SHORTNAME_PATH.

Thanks!

Tom
--
palfrey tevp net - http://tevp.net
Illegitimus non carborundum
Index: src/nautilus-spatial-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-spatial-window.c,v
retrieving revision 1.462
diff -u -r1.462 nautilus-spatial-window.c
--- src/nautilus-spatial-window.c	27 Jul 2006 21:58:42 -0000	1.462
+++ src/nautilus-spatial-window.c	23 Nov 2006 16:38:38 -0000
@@ -85,6 +85,7 @@
 #include <sys/time.h>
 
 #define MAX_TITLE_LENGTH 180
+#define MAX_SHORTNAME_PATH 16
 
 #define SPATIAL_ACTION_PLACES               "Places"
 #define SPATIAL_ACTION_GO_TO_LOCATION       "Go to Location"
@@ -939,6 +940,8 @@
 	gtk_widget_show (window->details->location_icon);
 	
 	window->details->location_label = gtk_label_new ("");
+	g_object_set(window->details->location_label, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_label_set_max_width_chars(GTK_LABEL(window->details->location_label), MAX_SHORTNAME_PATH);
 	gtk_box_pack_start (GTK_BOX (hbox), window->details->location_label,
 			    FALSE, FALSE, 0);
 	gtk_widget_show (window->details->location_label);


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