[nautilus/middle-click-tab-close: 3/3] notebook: Add middle click tab close support



commit 49680278cf2d343b55773ee14c96b828158b7321
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Feb 13 11:46:16 2018 +0100

    notebook: Add middle click tab close support
    
    It was requested for some time given that browsers do it. It's also
    quite harmless.
    
    Closes https://gitlab.gnome.org/GNOME/nautilus/issues/47

 src/nautilus-notebook.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c
index 70eae9109..202182fd5 100644
--- a/src/nautilus-notebook.c
+++ b/src/nautilus-notebook.c
@@ -160,6 +160,14 @@ button_press_cb (NautilusNotebook *notebook,
         /* switch to the page the mouse is over, but don't consume the event */
         gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), tab_clicked);
     }
+    else if (event->type == GDK_BUTTON_PRESS &&
+             event->button == GDK_BUTTON_MIDDLE)
+    {
+        GtkWidget *slot;
+
+        slot = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), tab_clicked);
+        g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, slot);
+    }
 
     return FALSE;
 }


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