[PATCH] Display hostname in copy/move progress dialog for non-local URIs



I've noticed that moving data from/to my ssh machine to/from localhost
with Nautilus may cause confusion, since I use the same login on both
computers. Sometimes it isn't obvious whether I copy from or to the ssh
machine. The attached patch fixes this by telling the user what machine
he moves/copies from/to in the progress dialog, at least if the URI is
not local.

-- 
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-operations.c,v
retrieving revision 1.191
diff -u -p -r1.191 nautilus-file-operations.c
--- libnautilus-private/nautilus-file-operations.c	1 Jul 2005 15:39:07 -0000	1.191
+++ libnautilus-private/nautilus-file-operations.c	4 Jul 2005 14:49:54 -0000
@@ -326,7 +326,9 @@ progress_dialog_set_to_from_item_text (N
 {
 	char *item;
 	char *from_path;
+	char *from_text;
 	char *to_path;
+	char *to_text;
 	char *progress_label_text;
 	const char *from_prefix;
 	const char *to_prefix;
@@ -334,8 +336,8 @@ progress_dialog_set_to_from_item_text (N
 	int length;
 
 	item = NULL;
-	from_path = NULL;
-	to_path = NULL;
+	from_text = NULL;
+	to_text = NULL;
 	from_prefix = "";
 	to_prefix = "";
 	progress_label_text = NULL;
@@ -350,6 +352,14 @@ progress_dialog_set_to_from_item_text (N
 		if (from_path [length - 1] == '/') {
 			from_path [length - 1] = '\0';
 		}
+
+		if (gnome_vfs_uri_is_local (uri)) {
+			from_text = from_path;
+		} else {
+			from_text = g_strdup_printf (_("%s on %s"),
+				from_path, gnome_vfs_uri_get_host_name (uri));
+			g_free (from_path);
+		}
 		
 		gnome_vfs_uri_unref (uri);
 		g_assert (progress_verb);
@@ -368,6 +378,14 @@ progress_dialog_set_to_from_item_text (N
 			to_path [length - 1] = '\0';
 		}
 
+		if (gnome_vfs_uri_is_local (uri)) {
+			to_text = to_path;
+		} else {
+			to_text = g_strdup_printf (_("%s on %s"),
+				to_path, gnome_vfs_uri_get_host_name (uri));
+			g_free (to_path);
+		}
+
 		gnome_vfs_uri_unref (uri);
 		/* "To" dialog label, source path gets placed next to it in the dialog */
 		to_prefix = _("To:");
@@ -377,14 +395,14 @@ progress_dialog_set_to_from_item_text (N
 		(dialog,
 		 progress_label_text != NULL ? progress_label_text : "",
 		 item != NULL ? item : "",
-		 from_path != NULL ? from_path : "",
-		 to_path != NULL ? to_path : "",
+		 from_text != NULL ? from_text : "",
+		 to_text != NULL ? to_text : "",
 		 from_prefix, to_prefix, index, size);
 
 	g_free (progress_label_text);
 	g_free (item);
-	g_free (from_path);
-	g_free (to_path);
+	g_free (from_text);
+	g_free (to_text);
 }
 
 static int

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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