[PATCH] Show computer as top-level menuitem in location button menu



From bug 165266 [1]:

"The path pop-up menu on the bottom left hand corner of Nautilus menus
terminates in several different places, when browsing the file system
the topmost level is '/' and when browsing a network place it is the top
folder in the network place. The menu should show all levels up to the
"Computer"."

Proposed patch attached. Note that it displays Computer for *all* URIs,
not only those which have a drive or volume associated.

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

-- 
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.447
diff -u -p -r1.447 nautilus-spatial-window.c
--- src/nautilus-spatial-window.c	6 Jul 2005 20:25:52 -0000	1.447
+++ src/nautilus-spatial-window.c	10 Jul 2005 13:24:39 -0000
@@ -552,15 +552,16 @@ location_button_clicked_callback (GtkWid
 	GtkWidget *popup, *menu_item, *first_item = NULL;
 	GnomeVFSURI *uri;
 	GnomeVFSURI *child_uri;
+	GnomeVFSURI *computer_uri;
 	char *name;
 	GMainLoop *loop;
-
 	
 	g_return_if_fail (window->details->location != NULL);
 
 	popup = gtk_menu_new ();
 	first_item = NULL;
 	uri = gnome_vfs_uri_ref (window->details->location);
 	child_uri = NULL;
+	computer_uri = gnome_vfs_uri_new ("computer:///");
 	while (uri != NULL) {
 		NautilusFile *file;
@@ -593,6 +594,14 @@ location_button_clicked_callback (GtkWid
 
 		child_uri = gnome_vfs_uri_ref (uri);
 		uri = gnome_vfs_uri_get_parent (uri);
+
+		if (uri == NULL) {
+			if (gnome_vfs_uri_equal (child_uri, computer_uri)) {
+				gnome_vfs_uri_unref (computer_uri);
+			} else {
+				uri = computer_uri;
+			}
+		}
 	}
 	gtk_menu_set_screen (GTK_MENU (popup), gtk_widget_get_screen (widget));
 

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



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