middle click on a tab: add the gsettings key to enable the feature

Closes https://github.com/mate-desktop/mate-terminal/issues/184
master-1.22
Pablo Barciela 2017-12-26 01:37:17 +01:00
parent 26ded92d74
commit 294ce367b2
2 changed files with 10 additions and 1 deletions

View File

@ -74,6 +74,11 @@
<summary>Whether to ask for confirmation when closing terminal windows</summary> <summary>Whether to ask for confirmation when closing terminal windows</summary>
<description>Whether to ask for confirmation when closing a terminal window which has more than one open tab.</description> <description>Whether to ask for confirmation when closing a terminal window which has more than one open tab.</description>
</key> </key>
<key name="middle-click-closes-tabs" type="b">
<default>false</default>
<summary>Close tabs with middle click</summary>
<description>If true, it enables the ability to close tabs using middle click.</description>
</key>
<key name="ctrl-tab-switch-tabs" type="b"> <key name="ctrl-tab-switch-tabs" type="b">
<default>false</default> <default>false</default>
<summary>Switch tabs with [Ctrl]+[Tab]</summary> <summary>Switch tabs with [Ctrl]+[Tab]</summary>

View File

@ -2941,8 +2941,12 @@ notebook_button_press_cb (GtkWidget *widget,
int page_num; int page_num;
int before_pages; int before_pages;
int later_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); tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root);
if (tab_clicked >= 0) if (tab_clicked >= 0)