Package: nautilus
Version: 2.6.30.1-3
Severity: normal
Tags: patch
Hello !
        I used the "Location in titlebar" feature of Nautilus in previous
versions of debian. Since I upgraded to Squeeze and nautilus 2.30, some
monthes ago, it is no more functional : into the related source-code
package of Nautilus, the file "10_location_titlebar.patch" in the
subdirectory "debian/patches/" seems unmaintained and is  just not
applied.
    The joined patch works if applied against the 2.6.30.1-3 sources.
Could you take a look at it and reintegrate it please ?
        ( I tried to send this patch by reportbug yesterday but the program
stopped without any confirmation - Have I  misconfigured it ? -, and I
receive no return message. Sorry If this message came twice to the
website.)
    I use Debian Squeeze / gnome 2.30.
diff -ur nautilus-2.30.1/libnautilus-private/apps_nautilus_preferences.schemas.in nautilus-2.30.1-3.new/libnautilus-private/apps_nautilus_preferences.schemas.in
--- nautilus-2.30.1/libnautilus-private/apps_nautilus_preferences.schemas.in	2011-04-29 18:22:49.443597874 +0200
+++ nautilus-2.30.1-3.new/libnautilus-private/apps_nautilus_preferences.schemas.in	2011-04-27 22:08:47.819973451 +0200
@@ -979,6 +979,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>
diff -ur nautilus-2.30.1/libnautilus-private/nautilus-global-preferences.c nautilus-2.30.1-3.new/libnautilus-private/nautilus-global-preferences.c
--- nautilus-2.30.1/libnautilus-private/nautilus-global-preferences.c	2011-04-29 18:22:49.446930955 +0200
+++ nautilus-2.30.1-3.new/libnautilus-private/nautilus-global-preferences.c	2011-04-27 22:08:47.819973451 +0200
@@ -369,6 +369,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)
diff -ur nautilus-2.30.1/libnautilus-private/nautilus-global-preferences.h nautilus-2.30.1-3.new/libnautilus-private/nautilus-global-preferences.h
--- nautilus-2.30.1/libnautilus-private/nautilus-global-preferences.h	2011-04-29 18:22:49.443597874 +0200
+++ nautilus-2.30.1-3.new/libnautilus-private/nautilus-global-preferences.h	2011-04-27 22:08:47.823307212 +0200
@@ -112,6 +112,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"
diff -ur nautilus-2.30.1/src/nautilus-navigation-window.c nautilus-2.30.1-3.new/src/nautilus-navigation-window.c
--- nautilus-2.30.1/src/nautilus-navigation-window.c	2011-04-29 18:22:49.270261733 +0200
+++ nautilus-2.30.1-3.new/src/nautilus-navigation-window.c	2011-04-27 22:48:42.653896502 +0200
@@ -718,7 +718,7 @@
 	NautilusNavigationWindow *navigation_window;
 	NautilusNavigationWindowPane *pane;
 	NautilusNotebook *notebook;
-	char *full_title;
+	char *emplacement;
 	char *window_title;
 
 	navigation_window = NAUTILUS_NAVIGATION_WINDOW (window);
@@ -727,12 +727,12 @@
 			 sync_title, (window, slot));
 
 	if (slot == window->details->active_pane->active_slot) {
-		full_title = g_strdup_printf (_("%s - File Browser"), slot->title);
+		emplacement = nautilus_window_set_location_in_titlebar (window, slot);
 
-		window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
+		window_title = eel_str_middle_truncate (emplacement, MAX_TITLE_LENGTH);
+		g_free (emplacement);
 		gtk_window_set_title (GTK_WINDOW (window), window_title);
 		g_free (window_title);
-		g_free (full_title);
 	}
 
 	pane = NAUTILUS_NAVIGATION_WINDOW_PANE (slot->pane);
diff -ur nautilus-2.30.1/src/nautilus-spatial-window.c nautilus-2.30.1-3.new/src/nautilus-spatial-window.c
--- nautilus-2.30.1/src/nautilus-spatial-window.c	2011-04-29 18:22:49.270261733 +0200
+++ nautilus-2.30.1-3.new/src/nautilus-spatial-window.c	2011-04-29 18:24:12.570255617 +0200
@@ -395,10 +395,13 @@
 		gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
 	} else {
 		char *window_title;
+		char *location_titlebar;
 
-		window_title = eel_str_middle_truncate (slot->title, MAX_TITLE_LENGTH);
-		gtk_window_set_title (GTK_WINDOW (window), window_title);
-		g_free (window_title);
+		location_titlebar = nautilus_window_set_location_in_titlebar (window, slot);
+		window_title = eel_str_middle_truncate (location_titlebar, MAX_TITLE_LENGTH);
+		g_free (location_titlebar);
+ 		gtk_window_set_title (GTK_WINDOW (window), window_title);
+ 		g_free (window_title);
 	}
 }
 
diff -ur nautilus-2.30.1/src/nautilus-window.c nautilus-2.30.1-3.new//src/nautilus-window.c
--- nautilus-2.30.1/src/nautilus-window.c	2011-04-29 18:22:49.263601212 +0200
+++ nautilus-2.30.1-3.new//src/nautilus-window.c	2011-04-27 23:11:55.832924074 +0200
@@ -2061,3 +2061,66 @@
 {
 	return (nautilus_window_get_window_type (window) != NAUTILUS_WINDOW_DESKTOP);
 }
+
+char *
+nautilus_window_set_location_in_titlebar (NautilusWindow *window, const NautilusWindowSlot *slot)
+{
+	char *location_title =  nautilus_window_slot_get_title(slot);
+	char *location = g_file_get_parse_name (slot->location);
+	
+	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;
+
+	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR) != TRUE
+	    || slot->location == NULL
+	    || location == NULL
+	    || location[0] == 0
+	    || location[1] == 0)
+		return( location_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] != G_DIR_SEPARATOR) {
+		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)", slot->title, location_prefix, scheme != NULL ? " - " : "", display_location);
+
+	done:
+		if (location != NULL)
+			g_free (location);
+
+		return (location_title);
+}
+
diff -ur nautilus-2.30.1/src/nautilus-window.h nautilus-2.30.1-3.new//src/nautilus-window.h
--- nautilus-2.30.1/src/nautilus-window.h	2011-04-29 18:22:49.270261733 +0200
+++ nautilus-2.30.1-3.new//src/nautilus-window.h	2011-04-27 22:28:34.817353624 +0200
@@ -158,5 +158,7 @@
                                                        gboolean           allow);
 GtkUIManager *   nautilus_window_get_ui_manager       (NautilusWindow    *window);
 gboolean         nautilus_window_has_menubar_and_statusbar (NautilusWindow *window);
+char *           nautilus_window_set_location_in_titlebar (NautilusWindow *window,
+                                                           const NautilusWindowSlot *slot);
 
 #endif

Reply via email to