summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-07-25 03:38:51 +0200
committerZenWalker <[email protected]>2018-07-28 00:10:34 +0200
commit98edfd338d1248d386fc211f27252d5fb9053dc9 (patch)
tree17a1d1202d869c4d9fd7e633ed23fd7a3303e6ce
parent9fa364980a154864e7217b0160ac7d570cd76d79 (diff)
downloadpluma-98edfd338d1248d386fc211f27252d5fb9053dc9.tar.bz2
pluma-98edfd338d1248d386fc211f27252d5fb9053dc9.tar.xz
add the abbility to switch tabs using [ctrl+tab] and [ctrl+shift+tab]
If true the gsettings key "ctrl-tab-switch-tabs" into "org.mate.pluma" Closes https://github.com/mate-desktop/pluma/issues/211
-rw-r--r--data/org.mate.pluma.gschema.xml.in5
-rw-r--r--pluma/pluma-window.c29
2 files changed, 34 insertions, 0 deletions
diff --git a/data/org.mate.pluma.gschema.xml.in b/data/org.mate.pluma.gschema.xml.in
index 536211d5..3305283f 100644
--- a/data/org.mate.pluma.gschema.xml.in
+++ b/data/org.mate.pluma.gschema.xml.in
@@ -11,6 +11,11 @@
<summary>Editor Font</summary>
<description>A custom font that will be used for the editing area. This will only take effect if the "Use Default Font" option is turned off.</description>
</key>
+ <key name="ctrl-tab-switch-tabs" type="b">
+ <default>false</default>
+ <summary>Switch tabs with [ctrl] + [tab]</summary>
+ <description>If true, it enables the ability to switch tabs using [ctrl + tab] and [ctrl + shift + tab].</description>
+ </key>
<key name="color-scheme" type="s">
<default>'tango'</default>
<summary>Style Scheme</summary>
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index 261c09c6..6c908bfc 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -338,6 +338,35 @@ pluma_window_key_press_event (GtkWidget *widget,
if (!g_settings_get_boolean (settings, "use-default-font") && (nsize > 5))
g_settings_set_string (settings, "editor-font", g_strconcat (tempfont, tempsize, NULL));
}
+
+ if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs"))
+ {
+ GtkNotebook *notebook = GTK_NOTEBOOK (_pluma_window_get_notebook (PLUMA_WINDOW (window)));
+
+ int pages = gtk_notebook_get_n_pages (notebook);
+ int page_num = gtk_notebook_get_current_page (notebook);
+
+ if (event->keyval == GDK_KEY_ISO_Left_Tab)
+ {
+ if (page_num != 0)
+ gtk_notebook_prev_page (notebook);
+ else
+ gtk_notebook_set_current_page (notebook, (pages - 1));
+ return TRUE;
+ }
+
+ if (event->keyval == GDK_KEY_Tab)
+ {
+ if (page_num != (pages -1))
+ gtk_notebook_next_page (notebook);
+ else
+ gtk_notebook_set_current_page (notebook, 0);
+ return TRUE;
+ }
+ }
+ g_object_unref (settings);
+ g_free (font);
+ g_free (tempsize);
}
if (grand_parent_class == NULL)