[PATCH] Extra mouse button navigates back but not in list view of nautilus

Nelson Benítez León <[email protected]>
Newsgroups gmane.comp.gnome.nautilus
Message-ID <CAAUd641UiFFCS5F5dXMuophPgNY9p=06i0RRky_bWCtKf8TXvg@mail.gmail.com>
Hi, I'm resending[1] this as I've seen recently action in nautilus git..

I've attached two patches in http://bugs.gnome.org/660006 , one to fix
"back navigation" when over an icon, and other patch to make that to
work for list view. Please see the bug for details.

Thank you!

[1] http://mail.gnome.org/archives/nautilus-list/2012-January/msg00007.html

-- 
nautilus-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/nautilus-list
0001-Icon-view-Make-forward-and-backward-mouse-buttons-wo.patch (application/octet-stream, 1.7 KB)
From e198709e33a05d4ab917ff23d23d3a93b45a3794 Mon Sep 17 00:00:00 2001
From: Nelson Benitez Leon <[email protected]>
Date: Fri, 16 Dec 2011 14:03:51 +0100
Subject: [PATCH] [Icon view] Make forward and backward mouse buttons work
 over icons Make forward and backward mouse buttons to work
 when pressed over an icon in icon view.

Part of bug 660006
---
 libnautilus-private/nautilus-icon-container.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 942d17a..3322a31 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -4261,6 +4261,7 @@ button_press_event (GtkWidget *widget,
 
 	container = NAUTILUS_ICON_CONTAINER (widget);
         container->details->button_down_time = event->time;
+        clicked_on_icon = FALSE;
 	
         /* Forget about the old keyboard selection now that we've started mousing. */
         clear_keyboard_focus (container);
@@ -4271,8 +4272,10 @@ button_press_event (GtkWidget *widget,
 		return TRUE;
 	}
 
-	/* Invoke the canvas event handler and see if an item picks up the event. */
-	clicked_on_icon = GTK_WIDGET_CLASS (nautilus_icon_container_parent_class)->button_press_event (widget, event);
+	if (event->button < 6) { /* Don't let the eel canvas consume extra button events, see bug 660006 */
+		/* Invoke the canvas event handler and see if an item picks up the event. */
+		clicked_on_icon = GTK_WIDGET_CLASS (nautilus_icon_container_parent_class)->button_press_event (widget, event);
+	}
 	
 	/* Move focus to icon container, unless we're still renaming (to avoid exiting
 	 * renaming mode)
-- 
1.7.7.3
0001-List-view-Fix-forward-and-backward-mouse-buttons.patch (application/octet-stream, 3.4 KB)
From ae1583122f2262053f29d97f4f95884dd6741092 Mon Sep 17 00:00:00 2001
From: Nelson Benitez Leon <[email protected]>
Date: Fri, 16 Dec 2011 15:21:29 +0100
Subject: [PATCH] [List view] Fix forward and backward mouse buttons Make list
 view hook to nautilus window handling of forward and mouse
 buttons, when pressed both over rows and over blank space.

---
 src/nautilus-list-view.c |   18 ++++++++++++++----
 src/nautilus-window.c    |    2 +-
 src/nautilus-window.h    |    2 ++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 4dd9a14..6638b90 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -633,6 +633,7 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
 	NautilusListView *view;
 	GtkTreeView *tree_view;
 	GtkTreePath *path;
+	GtkWidget *nautilus_window;
 	gboolean call_parent;
 	GtkTreeSelection *selection;
 	GtkWidgetClass *tree_view_class;
@@ -789,6 +790,10 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
 				}
 			}
 		
+			if (event->button > 5) {
+				nautilus_window = GTK_WIDGET (nautilus_view_get_nautilus_window (NAUTILUS_VIEW (view)));
+				call_parent = !nautilus_window_button_press_event (nautilus_window, event);
+			}
 			if (call_parent) {
 				g_signal_handlers_block_by_func (tree_view,
 								 row_activated_callback,
@@ -829,10 +834,15 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
 			view->details->double_click_path[1] = view->details->double_click_path[0];
 			view->details->double_click_path[0] = NULL;
 		}
-		/* Deselect if people click outside any row. It's OK to
-		   let default code run; it won't reselect anything. */
-		gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view));
-		tree_view_class->button_press_event (widget, event);
+		if (event->button > 5) {
+			nautilus_window = GTK_WIDGET (nautilus_view_get_nautilus_window (NAUTILUS_VIEW (view)));
+			call_parent = !nautilus_window_button_press_event (nautilus_window, event);
+		} else {
+			/* Deselect if people click outside any row. It's OK to
+		   	let default code run; it won't reselect anything. */
+			gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view));
+			tree_view_class->button_press_event (widget, event);
+		}
 
 		if (event->button == 3) {
 			do_popup_menu (widget, view, event);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index bd58cfc..47c6dda 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1921,7 +1921,7 @@ nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
 	gtk_action_set_sensitive (action, allow);
 }
 
-static gboolean
+gboolean
 nautilus_window_button_press_event (GtkWidget *widget,
 				    GdkEventButton *event)
 {
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index ba43138..0d32d69 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -166,5 +166,7 @@ gboolean nautilus_window_split_view_showing   (NautilusWindow *window);
 gboolean nautilus_window_disable_chrome_mapping (GValue *value,
                                                  GVariant *variant,
                                                  gpointer user_data);
+gboolean nautilus_window_button_press_event (GtkWidget *widget,
+                                             GdkEventButton *event);
 
 #endif
-- 
1.7.7.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.