PATCH: use local path when dropping files onto icons



Hi,

this little patch makes Nautilus use the local path (if possible) when
dropping files onto a desktop icon. Now I can use that way to open files
in legacy (non-gnomevfs) applications. 

Previously Nautilus would use a file:/// URI and that wont work in old
apps (ie: my fav editor nedit).

Ok to commit?

- Frank


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5365
diff -u -p -r1.5365 ChangeLog
--- ChangeLog	6 Jun 2002 20:02:29 -0000	1.5365
+++ ChangeLog	9 Jun 2002 01:45:07 -0000
@@ -1,3 +1,10 @@
+2002-06-08  Frank Worsley  <fworsley shaw ca>
+
+	* src/file-manager/fm-directory-view.c:
+	(fm_directory_view_move_copy_items): use local path
+	whenever possible in icon dnd. now you can drop files
+	onto legacy (non-gnomevfs) applications and it will work
+
 2002-05-29  Satyajit Kanungo  <satyajit kanungo wipro com>
 
 	* src/nautilus-bookmarks-window.c: added a help button in the
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.540
diff -u -p -r1.540 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	31 May 2002 05:41:53 -0000	1.540
+++ src/file-manager/fm-directory-view.c	9 Jun 2002 01:45:08 -0000
@@ -5666,8 +5666,7 @@ fm_directory_view_move_copy_items (const
 				   int x, int y,
 				   FMDirectoryView *view)
 {
-	char *command_string, *scanner;
-	int length;
+	char *command_string, *temp, *local_path;
 	const GList *p;
 	
 	g_assert (relative_item_points == NULL
@@ -5683,26 +5682,25 @@ fm_directory_view_move_copy_items (const
 		
 		/* strip the leading "command:" */
 		target_uri += strlen (NAUTILUS_COMMAND_SPECIFIER);
+		command_string = g_strdup (target_uri);
 
-		/* how long will the command string be? */
-		length = strlen (target_uri) + 1;
+		/* append the uris */
 		for (p = item_uris; p != NULL; p = p->next) {
-			length += strlen ((const char *) p->data) + 1;
+			/* use a local path if possible to support dnd to 
+			 * legacy X application desktop icons
+			 */
+			local_path = gnome_vfs_get_local_path_from_uri ((const char *) p->data);
+			if (local_path != NULL) {
+				temp = g_strconcat (command_string, " ", local_path, NULL);
+				g_free (local_path);
+			} else {
+				temp = g_strconcat (command_string, " ", (const char *) p->data, NULL);
+			}
+			
+			g_free (command_string);
+			command_string = temp;
 		}
-		
-		command_string = g_malloc (length);
-		scanner = command_string;
-		
-		/* copy the command string */
-		strcpy (scanner, target_uri);
-		scanner += strlen (scanner);
-		
-		/* copy the uris */
-		for (p = item_uris; p != NULL; p = p->next) {
-			sprintf (scanner, " %s", (const char *) p->data);
-			scanner += strlen (scanner);
-		}
-		
+				
 		/* execute the command */
 		eel_gnome_shell_execute (command_string);
 		


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