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
This commit is contained in:
Carlos Soriano 2018-02-13 11:46:16 +01:00 committed by Carlos Soriano
parent ad95c95be3
commit c01dda9483

View file

@ -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;
}