-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Package: nautilus
Version: 2.14.3-11
Severity: wishlist

Description: Add full uri support like smb://, burn://, ftp:// etc...
             Fix memory leaks.
             Unescape uri.

I hope that will be all right.

Thanks ;)
- --
Adrien DELLE CAVE
Proformatique - 67 rue Voltaire - 92800 Puteaux
Tel. : 01 41 38 99 60 - Fax. : 01 41 38 99 70
[EMAIL PROTECTED] - http://www.proformatique.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGKo6bIFidKwVyW+IRAhNgAJsEvA8fhAIC+XOOY5B6wK3WfWZy2wCggaaj
xGw/msJ1PKmnN/X66nibSxY=
=ovFZ
-----END PGP SIGNATURE-----
Index: nautilus-2.14.3/libnautilus-private/apps_nautilus_preferences.schemas.in
===================================================================
--- nautilus-2.14.3.orig/libnautilus-private/apps_nautilus_preferences.schemas.in	2006-01-11 23:40:26.000000000 +0100
+++ nautilus-2.14.3/libnautilus-private/apps_nautilus_preferences.schemas.in		2007-04-21 20:42:53.000000000 +0200
@@ -704,6 +704,21 @@
       </locale>
     </schema>
          
+     <schema>
+      <key>/schemas/apps/nautilus/preferences/location_in_title_bar</key>
+      <applyto>/apps/nautilus/preferences/location_in_title_bar</applyto>
+      <owner>nautilus</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Show current location in title bar</short>
+         <long>
+             If set to true, windows will have the full location displayed
+             in their title bar. Otherwise it will only show the folder name.
+         </long>
+      </locale>
+    </schema>
+
     <schema>
       <key>/schemas/apps/nautilus/preferences/start_with_sidebar</key>
       <applyto>/apps/nautilus/preferences/start_with_sidebar</applyto>
Index: nautilus-2.14.3/libnautilus-private/nautilus-global-preferences.c
===================================================================
--- nautilus-2.14.3.orig/libnautilus-private/nautilus-global-preferences.c	2006-03-18 08:13:49.000000000 +0100
+++ nautilus-2.14.3/libnautilus-private/nautilus-global-preferences.c		2007-04-21 20:42:53.000000000 +0200
@@ -376,6 +376,10 @@
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (TRUE)
 	},
+	{ NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR,
+	  PREFERENCE_BOOLEAN,
+	  GINT_TO_POINTER (TRUE)
+	},
 	{ NAUTILUS_PREFERENCES_START_WITH_SIDEBAR,
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (TRUE)
Index: nautilus-2.14.3/libnautilus-private/nautilus-global-preferences.h
===================================================================
--- nautilus-2.14.3.orig/libnautilus-private/nautilus-global-preferences.h	2005-12-15 15:32:57.000000000 +0100
+++ nautilus-2.14.3/libnautilus-private/nautilus-global-preferences.h		2007-04-21 20:42:53.000000000 +0200
@@ -84,6 +84,7 @@
 #define NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR		"preferences/start_with_location_bar"
 #define NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY		"preferences/always_use_location_entry"
 #define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR		"preferences/start_with_status_bar"
+#define NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR            "preferences/location_in_title_bar"
 #define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR		 	"preferences/start_with_sidebar"
 #define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR			"preferences/start_with_toolbar"
 #define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW                     "preferences/side_pane_view"
Index: nautilus-2.14.3/src/nautilus-navigation-window.c
===================================================================
--- nautilus-2.14.3.orig/src/nautilus-navigation-window.c	2006-03-18 08:13:50.000000000 +0100
+++ nautilus-2.14.3/src/nautilus-navigation-window.c		2007-04-21 20:53:23.000000000 +0200
@@ -813,20 +813,25 @@
 static gboolean
 real_set_title (NautilusWindow *window, const char *title)
 {
-	char *full_title;
-	char *window_title;
 	gboolean changed;
 
 	changed = EEL_CALL_PARENT_WITH_RETURN_VALUE
 		(NAUTILUS_WINDOW_CLASS, set_title, (window, title));
 
 	if (changed) {
-		full_title = g_strdup_printf (_("%s - File Browser"), title);
+		char *full_title;
+		char *window_title;
+		char *location_titlebar;
+
+		location_titlebar = nautilus_window_set_location_in_titlebar (window, title);
+
+		full_title = g_strdup_printf (_("%s - File Browser"), location_titlebar);
 
 		window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
 		gtk_window_set_title (GTK_WINDOW (window), window_title);
 		g_free (window_title);
 		g_free (full_title);
+		g_free (location_titlebar);
 	}
 
 	return changed;
Index: nautilus-2.14.3/src/nautilus-spatial-window.c
===================================================================
--- nautilus-2.14.3.orig/src/nautilus-spatial-window.c	2006-04-14 13:57:23.000000000 +0200
+++ nautilus-2.14.3/src/nautilus-spatial-window.c	2007-04-21 20:52:36.000000000 +0200
@@ -406,10 +406,14 @@
 		gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
 	} else if (changed) {
 		char *window_title;
+		char *location_titlebar;
 
-		window_title = eel_str_middle_truncate (title, MAX_TITLE_LENGTH);
+		location_titlebar = nautilus_window_set_location_in_titlebar (window, title);
+
+		window_title = eel_str_middle_truncate (location_titlebar, MAX_TITLE_LENGTH);
 		gtk_window_set_title (GTK_WINDOW (window), window_title);
 		g_free (window_title);
+		g_free (location_titlebar);
 	}
 
 	return changed;
Index: nautilus-2.14.3/src/nautilus-window.c
===================================================================
--- nautilus-2.14.3.orig/src/nautilus-window.c	2006-03-20 19:40:38.000000000 +0100
+++ nautilus-2.14.3/src/nautilus-window.c	2007-04-21 21:17:49.000000000 +0200
@@ -1638,3 +1638,90 @@
 {
 	return (nautilus_window_get_window_type (window) != NAUTILUS_WINDOW_DESKTOP);
 }
+
+char *
+nautilus_window_set_location_in_titlebar (NautilusWindow *window, const char *title)
+{
+	char *location_title;
+	char *uri = NULL;
+	char *location = NULL;
+	GnomeVFSURI *vfs_uri = NULL;
+	const char *path;
+	const char *scheme = NULL;
+	const char *display_location;
+	const char *tmp_location;
+	const char *location_prefix;
+	int tmp_location_len;
+	int tilde = 0;
+
+	location_title = g_strdup (title);
+
+	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR) != TRUE
+	    || (uri = nautilus_window_get_location (window)) == NULL
+	    || (location = gnome_vfs_format_uri_for_display (uri)) == NULL
+	    || location[0] == 0
+	    || location[1] == 0)
+		goto done;
+
+	if (location[0] != GNOME_VFS_URI_PATH_CHR) {
+		if ((vfs_uri = gnome_vfs_uri_new (location)) == NULL
+		     || (path = gnome_vfs_uri_get_path (vfs_uri)) == NULL
+		     || (scheme = gnome_vfs_uri_get_scheme (vfs_uri)) == NULL
+		     || path[0] == 0
+		     || strcmp (path, GNOME_VFS_URI_PATH_STR) == 0)
+			goto done;
+
+		g_free(uri);
+
+		uri = gnome_vfs_unescape_string_for_display (path);
+
+		display_location = uri;
+		goto construct_title;
+	}
+
+	if ((tmp_location = g_get_home_dir()) == NULL) {
+		display_location = location;
+		goto construct_title;
+	}
+
+	if (strcmp (location, tmp_location) == 0) {
+		tilde = 1;
+		display_location = "";
+		goto construct_title;
+	}
+	
+	tmp_location_len = strlen (tmp_location);
+	if (eel_str_has_prefix (location, tmp_location) == FALSE
+	    || location[tmp_location_len] != GNOME_VFS_URI_PATH_CHR) {
+		display_location = location;
+		goto construct_title;
+	}
+
+	tilde = 1;
+	display_location = location + tmp_location_len;
+
+	construct_title:
+
+		g_free (location_title);
+
+		if(scheme != NULL)
+			location_prefix = scheme;
+		else if(tilde == 1)
+			location_prefix = "~";
+		else
+			location_prefix = "";
+
+		location_title = g_strdup_printf ("%s (%s%s%s)", title, location_prefix, scheme != NULL ? " - " : "", display_location);
+
+	done:
+		if (uri != NULL)
+			g_free (uri);
+
+		if (location != NULL)
+			g_free (location);
+
+		if (vfs_uri != NULL)
+			gnome_vfs_uri_unref (vfs_uri);
+
+		return (location_title);
+}
Index: nautilus-2.14.3/src/nautilus-window.h
===================================================================
--- nautilus-2.14.3.orig/src/nautilus-window.h	2006-03-20 19:40:38.000000000 +0100
+++ nautilus-2.14.3/src/nautilus-window.h	2007-04-21 20:42:53.000000000 +0200
@@ -151,5 +151,7 @@
 void             nautilus_window_add_extra_location_widget (NautilusWindow  *window,
                                                             GtkWidget       *widget);
 gboolean         nautilus_window_has_menubar_and_statusbar (NautilusWindow *window);
+char *         nautilus_window_set_location_in_titlebar (NautilusWindow *window,
+                                                       const char        *title);
 
 #endif

Reply via email to