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

Package: nautilus
Version: 2.14.3-11
Severity: wishlist

Description: Add smb:// and burn:// support on the previous patch.

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

iD8DBQFGKNbUIFidKwVyW+IRAtQgAJ9gCSJVp6/TcOp7Ne9NV9s8nWz/4ACdEmt7
QY+ARILW+EQs/DOeHmNhW6k=
=FT28
-----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	2007-03-05 05:03:53.000000000 +0100
+++ nautilus-2.14.3/libnautilus-private/apps_nautilus_preferences.schemas.in	2007-03-05 01:26:30.000000000 +0100
@@ -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	2007-03-05 05:03:53.000000000 +0100
+++ nautilus-2.14.3/libnautilus-private/nautilus-global-preferences.c	2007-03-05 01:20:19.000000000 +0100
@@ -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	2007-03-05 05:03:53.000000000 +0100
+++ nautilus-2.14.3/libnautilus-private/nautilus-global-preferences.h	2007-03-05 01:18:45.000000000 +0100
@@ -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	2007-03-05 05:03:53.000000000 +0100
+++ nautilus-2.14.3/src/nautilus-navigation-window.c	2007-03-05 01:11:16.000000000 +0100
@@ -813,15 +813,16 @@
 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;
+
+		full_title = g_strdup_printf (_("%s - File Browser"), nautilus_window_set_location_in_titlebar (window, title));
 
 		window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
 		gtk_window_set_title (GTK_WINDOW (window), window_title);
Index: nautilus-2.14.3/src/nautilus-spatial-window.c
===================================================================
--- nautilus-2.14.3.orig/src/nautilus-spatial-window.c	2007-03-05 05:03:53.000000000 +0100
+++ nautilus-2.14.3/src/nautilus-spatial-window.c	2007-03-05 01:27:57.000000000 +0100
@@ -407,7 +407,7 @@
 	} else if (changed) {
 		char *window_title;
 
-		window_title = eel_str_middle_truncate (title, MAX_TITLE_LENGTH);
+		window_title = eel_str_middle_truncate (nautilus_window_set_location_in_titlebar (window, title), MAX_TITLE_LENGTH);
 		gtk_window_set_title (GTK_WINDOW (window), window_title);
 		g_free (window_title);
 	}
Index: nautilus-2.14.3/src/nautilus-window.c
===================================================================
--- nautilus-2.14.3.orig/src/nautilus-window.c	2007-03-05 05:03:53.000000000 +0100
+++ nautilus-2.14.3/src/nautilus-window.c	2007-03-05 05:01:21.000000000 +0100
@@ -1638,3 +1638,75 @@
 {
 	return (nautilus_window_get_window_type (window) != NAUTILUS_WINDOW_DESKTOP);
 }
+
+char *
+nautilus_window_set_location_in_titlebar (NautilusWindow *window, const char *title)
+{
+	char *uri;
+	char *home_dir = NULL;
+	char *location;
+	char *location_title;
+	int home_dir_length;
+	int location_length;
+
+	location_title = g_strdup (title);
+
+	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR) != TRUE
+	    || (uri = nautilus_window_get_location (window)) == NULL)
+		return (location_title);
+
+	if ((location = gnome_vfs_format_uri_for_display (uri)) == NULL) {
+		g_free (uri);
+		return (location_title);
+	}
+
+	location_length = strlen (location);
+
+	if (location_length < 2
+           || strcmp (location, "burn:///") == 0
+           || strcmp (location, "smb:///") == 0) {
+		goto done;
+       }
+
+       if (eel_str_has_prefix (location, "smb://") == TRUE
+           || eel_str_has_prefix (location, "burn://") == TRUE) {
+               location_title = g_strdup_printf ("%s (%s)", title, location);
+               goto done;
+       }
+
+       if (eel_str_has_prefix (location, GNOME_VFS_URI_PATH_STR) == FALSE) {
+               goto done;
+       }
+
+	home_dir = g_strdup (g_get_home_dir ());
+
+	if (eel_strcmp (location, home_dir) == 0) {
+		location_title = g_strconcat (location_title, " (~)", NULL);
+		goto done;
+	}
+
+	home_dir = g_strconcat (home_dir, GNOME_VFS_URI_PATH_STR, NULL);
+
+	if (eel_str_has_prefix (location, home_dir) == FALSE) {
+		location_title = g_strdup_printf ("%s (%s)", location_title, location);
+		goto done;
+	}
+
+	g_free (location_title);
+
+	home_dir_length = strlen (home_dir);
+
+	location_title = g_malloc (location_length - home_dir_length + 1);
+	strncpy (location_title, location + home_dir_length, location_length - home_dir_length + 1);
+
+	location_title = g_strdup_printf ("%s (~%s%s)", title, GNOME_VFS_URI_PATH_STR, location_title);
+
+	done:
+		g_free (uri);
+		g_free (location);
+
+		if(home_dir != NULL)
+			g_free (home_dir);
+
+		return (location_title);
+}
Index: nautilus-2.14.3/src/nautilus-window.h
===================================================================
--- nautilus-2.14.3.orig/src/nautilus-window.h	2007-03-05 05:03:53.000000000 +0100
+++ nautilus-2.14.3/src/nautilus-window.h	2007-03-05 02:44:24.000000000 +0100
@@ -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