[PATCH] don't display directories above home dir in location button when displaying home



From bug 136712 [1]:

"Use ~ as a root: when you are in a subdir of $HOME, or $HOME itself,
don't display path prior to $HOME, but just display a [Home] icon in the
button. See spec page for more details."

This proposed behavior is consistent with the sidebar, the filechooser
et al.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=136712 

-- 
Christian Neumair <chris gnome-de org>
Index: src/nautilus-spatial-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-spatial-window.c,v
retrieving revision 1.445
diff -u -p -r1.445 nautilus-spatial-window.c
--- src/nautilus-spatial-window.c	23 Jun 2005 14:16:58 -0000	1.445
+++ src/nautilus-spatial-window.c	2 Jul 2005 11:22:15 -0000
@@ -553,6 +553,8 @@ location_button_clicked_callback (GtkWid
 	GtkWidget *popup, *menu_item, *first_item = NULL;
 	GnomeVFSURI *uri;
 	GnomeVFSURI *child_uri;
+	GnomeVFSURI *home_uri;
+	char *home_uri_str;
 	char *name;
 	GMainLoop *loop;
 
@@ -563,6 +565,9 @@ location_button_clicked_callback (GtkWid
 	first_item = NULL;
 	uri = gnome_vfs_uri_ref (window->details->location);
 	child_uri = NULL;
+	home_uri_str = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
+	home_uri = gnome_vfs_uri_new (home_uri_str);
+	g_free (home_uri_str);
 	while (uri != NULL) {
 		NautilusFile *file;
 		char *uri_string;
@@ -593,7 +598,12 @@ location_button_clicked_callback (GtkWid
 		gtk_menu_shell_prepend (GTK_MENU_SHELL (popup), menu_item);
 
 		child_uri = gnome_vfs_uri_ref (uri);
-		uri = gnome_vfs_uri_get_parent (uri);
+
+		if (gnome_vfs_uri_equal (home_uri, uri)) {
+			uri = NULL;
+		} else {
+			uri = gnome_vfs_uri_get_parent (uri);
+		}
 	}
 	gtk_menu_set_screen (GTK_MENU (popup), gtk_widget_get_screen (widget));
 
@@ -610,6 +620,7 @@ location_button_clicked_callback (GtkWid
 	gtk_grab_remove (popup);
 	g_main_loop_unref (loop);
  	gtk_object_sink (GTK_OBJECT (popup));
+	gnome_vfs_uri_unref (home_uri);
 }
 
 static int

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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