[PATCH] Middle/Shift Click in Hierarchy Popup



This patch makes it possible to close the ancestor window via
shift/middle click in the hierarchy widget (#137663).

Martin

Index: src/nautilus-spatial-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-spatial-window.c,v
retrieving revision 1.428
diff -u -p -w -r1.428 nautilus-spatial-window.c
--- src/nautilus-spatial-window.c	1 Apr 2004 21:05:51 -0000	1.428
+++ src/nautilus-spatial-window.c	2 Apr 2004 04:57:42 -0000
@@ -407,10 +407,25 @@ location_menu_item_activated_callback (G
 {
 	GnomeVFSURI *uri;
 	char *location;
+	GdkEvent *event;
 
 	uri = g_object_get_data (G_OBJECT (menu_item), "uri");
 	location = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
-	nautilus_window_go_to (NAUTILUS_WINDOW (window), location);
+	event = gtk_get_current_event();
+
+	if (event && !gnome_vfs_uri_equal (uri, window->details->location))
+	{
+		if (((GdkEventAny *) event)->type == GDK_BUTTON_RELEASE &&
+		   (((GdkEventButton *) event)->button == 2 ||
+		   (((GdkEventButton *) event)->state & GDK_SHIFT_MASK) != 0))
+		{
+			nautilus_window_open_location (NAUTILUS_WINDOW (window), location, TRUE);
+		} else {
+			nautilus_window_open_location (NAUTILUS_WINDOW (window), location, FALSE);
+		}
+		gdk_event_free (event);
+	}
+
 	g_free (location);
 	
 }
Index: src/nautilus-window-manage-views.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.c,v
retrieving revision 1.335
diff -u -p -w -r1.335 nautilus-window-manage-views.c
--- src/nautilus-window-manage-views.c	29 Mar 2004 22:40:28 -0000	1.335
+++ src/nautilus-window-manage-views.c	2 Apr 2004 04:57:43 -0000
@@ -747,11 +747,19 @@ open_location (NautilusWindow *window,
 
 void
 nautilus_window_open_location (NautilusWindow *window,
-                               const char *location)
+                               const char *location,
+                               gboolean close_behind)
 {
+	Nautilus_ViewFrame_OpenFlags flags;
+
+	flags = 0;
+	if (close_behind) {
+		flags = Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND;
+	}
+	
         open_location (window, location, 
                        Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
-                       0, NULL);
+                       flags, NULL);
 }
 
 void
Index: src/nautilus-window-manage-views.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.h,v
retrieving revision 1.26
diff -u -p -w -r1.26 nautilus-window-manage-views.h
--- src/nautilus-window-manage-views.h	12 Dec 2003 12:09:05 -0000	1.26
+++ src/nautilus-window-manage-views.h	2 Apr 2004 04:57:43 -0000
@@ -33,7 +33,8 @@
 void                    nautilus_window_manage_views_destroy         (NautilusWindow         *window);
 void                    nautilus_window_manage_views_finalize        (NautilusWindow         *window);
 void                    nautilus_window_open_location                (NautilusWindow         *window,
-                                                                      const char             *location);
+                                                                      const char             *location,
+                                                                      gboolean                close_behind);
 void                    nautilus_window_open_location_with_selection (NautilusWindow         *window,
                                                                       const char             *location,
                                                                       GList                  *selection,
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.430
diff -u -p -w -r1.430 nautilus-window.c
--- src/nautilus-window.c	1 Apr 2004 21:47:10 -0000	1.430
+++ src/nautilus-window.c	2 Apr 2004 04:57:44 -0000
@@ -350,7 +350,7 @@ nautilus_window_set_status (NautilusWind
 void
 nautilus_window_go_to (NautilusWindow *window, const char *uri)
 {
-	nautilus_window_open_location (window, uri);
+	nautilus_window_open_location (window, uri, FALSE);
 }
 
 void


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