Josselin Mouette wrote:
tag 413018 + pending
thanks
I have added the patch to our SVN - without making the new behavior the
default - and forwarded it upstream. However, I think it still needs
work, especially for not displaying the URI when it is not needed (like
computer:///).
Cheers,
I have added not displaying the URI when it is not needed (like
computer:///, network:///)
I have added the support on local filesystems with ~
I have copy your description for the schema.
For these improvements, I create a function.
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/
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,64 @@
{
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 = g_utf8_strlen (location, -1);
+
+ if(location_length < 2 || 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 = g_utf8_strlen (home_dir, -1);
+
+ location_title = g_malloc (location_length + home_dir_length);
+ strcpy (location_title, &location[home_dir_length]);
+
+ location_title = g_strdup_printf ("%s (~%s%s)", title, GNOME_VFS_URI_PATH_STR, location_title);
+ goto done;
+
+ 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