[nautilus] toolbar: Open new tab on back/forward middle click
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] toolbar: Open new tab on back/forward middle click
- Date: Sat, 16 Jul 2022 15:38:11 +0000 (UTC)
commit aa1f6d50c4b620a92e6eb70dc446b451c9e3d80e
Author: Corey Berla <corey berla me>
Date: Mon Jul 11 19:37:39 2022 -0700
toolbar: Open new tab on back/forward middle click
Middle click should open a new tab. This is consistent with
the main view, sidebar, and pathbar. When opening the new tab
set the location preemptively to either one location forward or
back.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1490
src/nautilus-toolbar.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 365cb4721..81af953eb 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -222,11 +222,31 @@ navigation_button_press_cb (GtkGestureClick *gesture,
{
NautilusToolbar *self;
GtkWidget *widget;
+ guint button;
self = NAUTILUS_TOOLBAR (user_data);
+ button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
- show_menu (self, widget);
+ if (button == GDK_BUTTON_PRIMARY)
+ {
+ /* Don't do anything, primary click is handled through activate */
+ gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
+ return;
+ }
+ else if (button == GDK_BUTTON_MIDDLE)
+ {
+ NautilusNavigationDirection direction;
+
+ direction = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget),
+ "nav-direction"));
+
+ nautilus_window_back_or_forward_in_new_tab (self->window, direction);
+ }
+ else if (button == GDK_BUTTON_SECONDARY)
+ {
+ show_menu (self, widget);
+ }
}
static void
@@ -837,13 +857,13 @@ nautilus_toolbar_constructed (GObject *object)
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
gtk_widget_add_controller (self->back_button, controller);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), GDK_BUTTON_SECONDARY);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
g_signal_connect (controller, "pressed",
G_CALLBACK (navigation_button_press_cb), self);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
gtk_widget_add_controller (self->forward_button, controller);
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), GDK_BUTTON_SECONDARY);
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
g_signal_connect (controller, "pressed",
G_CALLBACK (navigation_button_press_cb), self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]