From 294ce367b2d376bb4b53017136c82af94a15026e Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Tue, 26 Dec 2017 01:37:17 +0100 Subject: [PATCH] middle click on a tab: add the gsettings key to enable the feature Closes https://github.com/mate-desktop/mate-terminal/issues/184 --- src/org.mate.terminal.gschema.xml.in | 5 +++++ src/terminal-window.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/org.mate.terminal.gschema.xml.in b/src/org.mate.terminal.gschema.xml.in index 7696051..3deedb9 100644 --- a/src/org.mate.terminal.gschema.xml.in +++ b/src/org.mate.terminal.gschema.xml.in @@ -74,6 +74,11 @@ Whether to ask for confirmation when closing terminal windows Whether to ask for confirmation when closing a terminal window which has more than one open tab. + + false + Close tabs with middle click + If true, it enables the ability to close tabs using middle click. + false Switch tabs with [Ctrl]+[Tab] diff --git a/src/terminal-window.c b/src/terminal-window.c index 26655cb..5cdb6a4 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -2941,8 +2941,12 @@ notebook_button_press_cb (GtkWidget *widget, int page_num; int before_pages; int later_pages; + GSettings *settings; - if (event->type == GDK_BUTTON_PRESS && event->button == 2) + settings = g_settings_new ("org.mate.terminal.global"); + + if ((event->type == GDK_BUTTON_PRESS && event->button == 2) && + (g_settings_get_boolean (settings, "middle-click-closes-tabs"))) { tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root); if (tab_clicked >= 0)