[Nautilus-list] Patch for custom icon



Hi

This fixes http://bugzilla.gnome.org/show_bug.cgi?id=75994

I've been trying to attach this to #75994, but bugzilla seems to be
broken, so i'm attaching it to this mail instead

(i'm not on the list so add me to cc)

--
Johan Dahlin


? stamp-h1
Index: src/nautilus-sidebar.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-sidebar.c,v
retrieving revision 1.209
diff -u -r1.209 nautilus-sidebar.c
--- src/nautilus-sidebar.c	7 Mar 2002 19:36:07 -0000	1.209
+++ src/nautilus-sidebar.c	24 Mar 2002 13:58:04 -0000
@@ -718,7 +718,7 @@
 	GtkWindow *window;
 	
 	uris = g_strsplit (selection_data->data, "\r\n", 0);
-	exactly_one = uris[0] != NULL && uris[1] == NULL;
+	exactly_one = uris[0] != NULL && *uris[1] == 0;
 	window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)));
 	
 	switch (hit_test (sidebar, x, y)) {
@@ -754,10 +754,17 @@
 		
 		if (uri_is_local_image (uris[0])) {
 			if (sidebar->details->file != NULL) {
+				gchar *escaped_name;
+				
+				/* use escape_host_and_path_string, instead of escape_string since we
+				 * don't want to escape / and : 
+				 */
+				escaped_name = gnome_vfs_escape_host_and_path_string (uris[0]);
 				nautilus_file_set_metadata (sidebar->details->file,
 							    NAUTILUS_METADATA_KEY_CUSTOM_ICON,
 							    NULL,
-							    uris[0]);
+							    escaped_name);
+				g_free (escaped_name);
 				nautilus_file_set_metadata (sidebar->details->file,
 							    NAUTILUS_METADATA_KEY_ICON_SCALE,
 							    NULL,
Index: src/file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.149
diff -u -r1.149 fm-properties-window.c
--- src/file-manager/fm-properties-window.c	22 Mar 2002 13:23:38 -0000	1.149
+++ src/file-manager/fm-properties-window.c	24 Mar 2002 13:58:05 -0000
@@ -2419,6 +2419,7 @@
 {
 	NautilusFile *file;
 	char *icon_uri;
+	char *escaped_name;
 	
 	g_return_if_fail (properties_window != NULL);
 	g_return_if_fail (FM_IS_PROPERTIES_WINDOW (properties_window));
@@ -2426,8 +2427,16 @@
 	if (icon_path != NULL) {
 		file = properties_window->details->original_file;
 		icon_uri = gnome_vfs_get_uri_from_local_path (icon_path);
-		nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL, icon_uri);
+		
+		/* use escape_host_and_path_string, instead of escape_string since we
+		 * don't want to escape / and :
+		 */
+		escaped_name = gnome_vfs_escape_host_and_path_string (icon_uri);
 		g_free (icon_uri);
+		
+		nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL, escaped_name);
+		g_free (escaped_name);
+
 		nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_ICON_SCALE, NULL, NULL);
 
 		/* re-enable the property window's clear image button */ 


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