Patch for window titles



Hi guys

I use nautilus quite a lot for managing remote filesystems using 
SFTP. Unfortunately, the window title doesn't include any obvious 
indication of what server the folder is on. This is particularly 
confusing when you are trying copy a file from "etc" on one server
to another server - which window is which?

My solution is to, for directories on remote gnome-vfs URIs, display
the window title as "etc on tartarus" rather than just "etc". The 
patch seems to work well - comments?

I have CVS access, so if this patch is OK for commit let me know.

Cheers
Grahame

? libnautilus-extension/Makefile
? libnautilus-extension/Makefile.in
? libnautilus-extension/libnautilus-extension.pc
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.6181
diff -u -r1.6181 ChangeLog
--- ChangeLog	22 Apr 2004 06:29:02 -0000	1.6181
+++ ChangeLog	27 Apr 2004 15:35:07 -0000
@@ -1,3 +1,8 @@
+2004-04-27  Grahame Bowland  <grahame angrygoats net>
+
+	* src/nautilus-window.c (compute_default_title):
+	Display server name in window title for remote URIs.
+
 2004-04-22  Martin Wehner  <martin wehner epost de>
 
 	* libnautilus-private/nautilus-icon-factory.c (cache_icon_unref):
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.433
diff -u -r1.433 nautilus-window.c
--- src/nautilus-window.c	14 Apr 2004 16:07:25 -0000	1.433
+++ src/nautilus-window.c	27 Apr 2004 15:35:16 -0000
@@ -1140,11 +1140,26 @@
 compute_default_title (const char *text_uri)
 {
 	NautilusFile *file;
-	char *title;
+	GnomeVFSURI *uri;
+	char *title, *displayname;
+	const gchar *hostname;
+
+	hostname = NULL;
 
 	if (text_uri) {
 		file = nautilus_file_get (text_uri);
-		title = nautilus_file_get_display_name (file);
+		uri = gnome_vfs_uri_new (text_uri);
+		if (uri && !gnome_vfs_uri_is_local (uri)) {
+			hostname = gnome_vfs_uri_get_host_name (uri);
+		}
+		displayname = nautilus_file_get_display_name (file);
+		if (hostname) {
+			title = g_strdup_printf (_("%s on %s"), displayname, hostname);
+			gnome_vfs_uri_unref (uri);
+			free (displayname);
+		} else {
+			title = displayname;
+		}
 		nautilus_file_unref (file);
 	} else {
 		title = g_strdup ("");


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