Index: libnautilus-private/nautilus-icon-canvas-item.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-canvas-item.c,v
retrieving revision 1.195
diff -u -p -r1.195 nautilus-icon-canvas-item.c
--- libnautilus-private/nautilus-icon-canvas-item.c	14 Nov 2005 15:49:58 -0000	1.195
+++ libnautilus-private/nautilus-icon-canvas-item.c	11 Dec 2005 16:05:25 -0000
@@ -1588,6 +1588,8 @@ nautilus_icon_canvas_item_draw (EelCanva
 	draw_label_text (icon_item, drawable, FALSE, icon_rect);
 }
 
+#define ZERO_WIDTH_SPACE "\0xE2\0x80\0x8B"
+
 static PangoLayout *
 create_label_layout (NautilusIconCanvasItem *item,
 		     const char *text)
@@ -1597,6 +1599,8 @@ create_label_layout (NautilusIconCanvasI
 	PangoFontDescription *desc;
 	NautilusIconContainer *container;
 	EelCanvasItem *canvas_item;
+	char *zeroified_text, *p;
+	int i;
 
 	canvas_item = EEL_CANVAS_ITEM (item);
 
@@ -1604,7 +1608,24 @@ create_label_layout (NautilusIconCanvasI
 	context = gtk_widget_get_pango_context (GTK_WIDGET (canvas_item->canvas));
 	layout = pango_layout_new (context);
 
-	pango_layout_set_text (layout, text, -1);
+	if (text == NULL) {
+		zeroified_text = NULL;
+	} else {
+		zeroified_text = g_malloc ((1 + strlen (ZERO_WIDTH_SPACE)) * (strlen (text) + 1));
+		p = zeroified_text;
+
+		for (i = 0; text[i] != '\0'; i++) {
+			*(p++) = text[i];
+
+			if (text[i] == '_' || text[i] == '.') {
+				/* ensure that we allow to break after '_' or '.' characters */
+				p = strcpy (p, ZERO_WIDTH_SPACE);
+			}
+		}
+		*p = '\0';
+	}
+
+	pango_layout_set_text (layout, zeroified_text, -1);
 	pango_layout_set_width (layout, floor (nautilus_icon_canvas_item_get_max_text_width (item)) * PANGO_SCALE);
 			
 	if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
@@ -1627,6 +1648,7 @@ create_label_layout (NautilusIconCanvasI
 	}
 	pango_layout_set_font_description (layout, desc);
 	pango_font_description_free (desc);
+	g_free (zeroified_text);
 	
 	return layout;
 }
