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



Am Mittwoch, den 06.07.2005, 13:18 +0200 schrieb Alexander Larsson:
> On Mon, 2005-07-04 at 16:56 +0200, Christian Neumair wrote:
> > 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.
> 
> gnome_vfs_uri_is_local() doesn't do what you think it does. You need to
> check for file:/// uris.

Proposed patch #2 attached.

-- 
Christian Neumair <chris gnome-de org>
? libnautilus-private/nautilus-file-operations.loT
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-operations.c,v
retrieving revision 1.193
diff -u -p -r1.193 nautilus-file-operations.c
--- libnautilus-private/nautilus-file-operations.c	6 Jul 2005 12:18:27 -0000	1.193
+++ libnautilus-private/nautilus-file-operations.c	6 Jul 2005 12:42:14 -0000
@@ -328,7 +328,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;
@@ -336,8 +338,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;
@@ -352,6 +354,14 @@ progress_dialog_set_to_from_item_text (N
 		if (from_path [length - 1] == '/') {
 			from_path [length - 1] = '\0';
 		}
+
+		if (g_str_has_prefix (from_uri, "file://")) {
+			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);
@@ -370,6 +380,14 @@ progress_dialog_set_to_from_item_text (N
 			to_path [length - 1] = '\0';
 		}
 
+		if (g_str_has_prefix (to_uri, "file://")) {
+			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:");
@@ -379,14 +397,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]