Skip to content

Commit 98edfd3

Browse files
committed
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 #211
1 parent 9fa3649 commit 98edfd3

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

‎data/org.mate.pluma.gschema.xml.in‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
<summary>Editor Font</summary>
1212
<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>
1313
</key>
14+
<key name="ctrl-tab-switch-tabs" type="b">
15+
<default>false</default>
16+
<summary>Switch tabs with [ctrl] + [tab]</summary>
17+
<description>If true, it enables the ability to switch tabs using [ctrl + tab] and [ctrl + shift + tab].</description>
18+
</key>
1419
<key name="color-scheme" type="s">
1520
<default>'tango'</default>
1621
<summary>Style Scheme</summary>

‎pluma/pluma-window.c‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,35 @@ pluma_window_key_press_event (GtkWidget *widget,
338338
if (!g_settings_get_boolean (settings, "use-default-font") && (nsize > 5))
339339
g_settings_set_string (settings, "editor-font", g_strconcat (tempfont, tempsize, NULL));
340340
}
341+
342+
if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs"))
343+
{
344+
GtkNotebook *notebook = GTK_NOTEBOOK (_pluma_window_get_notebook (PLUMA_WINDOW (window)));
345+
346+
int pages = gtk_notebook_get_n_pages (notebook);
347+
int page_num = gtk_notebook_get_current_page (notebook);
348+
349+
if (event->keyval == GDK_KEY_ISO_Left_Tab)
350+
{
351+
if (page_num != 0)
352+
gtk_notebook_prev_page (notebook);
353+
else
354+
gtk_notebook_set_current_page (notebook, (pages - 1));
355+
return TRUE;
356+
}
357+
358+
if (event->keyval == GDK_KEY_Tab)
359+
{
360+
if (page_num != (pages -1))
361+
gtk_notebook_next_page (notebook);
362+
else
363+
gtk_notebook_set_current_page (notebook, 0);
364+
return TRUE;
365+
}
366+
}
367+
g_object_unref (settings);
368+
g_free (font);
369+
g_free (tempsize);
341370
}
342371

343372
if (grand_parent_class == NULL)

0 commit comments

Comments
 (0)