[Xfce4-commits] [xfce/thunar] 01/01: Allow tabs switch with Ctrl + PgUp/PgDown (Bug #9585)
noreply at xfce.org
noreply at xfce.org
Mon Sep 24 23:57:44 CEST 2018
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h x f c e - 4 . 1 4
in repository xfce/thunar.
commit 18f61de6071a4e5486326bb7da72f269a63e1794
Author: Pablo Barciela <scow at riseup.net>
Date: Mon Sep 24 18:54:41 2018 -0300
Allow tabs switch with Ctrl + PgUp/PgDown (Bug #9585)
---
thunar/thunar-window-ui.xml | 2 ++
thunar/thunar-window.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/thunar/thunar-window-ui.xml b/thunar/thunar-window-ui.xml
index 198f1c5..d251a70 100644
--- a/thunar/thunar-window-ui.xml
+++ b/thunar/thunar-window-ui.xml
@@ -119,6 +119,8 @@
<menuitem action="new-tab" />
<separator />
<menuitem action="detach-tab" />
+ <menuitem action="switch-next-tab" />
+ <menuitem action="switch-previous-tab" />
<separator />
<menuitem action="close-tab" />
</popup>
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 016d383..df24b90 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -167,6 +167,10 @@ static void thunar_window_action_preferences (GtkAction
ThunarWindow *window);
static void thunar_window_action_reload (GtkAction *action,
ThunarWindow *window);
+static void switch_next_tab (GtkAction *action,
+ ThunarWindow *window);
+static void switch_previous_tab (GtkAction *action,
+ ThunarWindow *window);
static void thunar_window_action_pathbar_changed (GtkToggleAction *action,
ThunarWindow *window);
static void thunar_window_action_toolbar_changed (GtkToggleAction *action,
@@ -350,6 +354,8 @@ static GtkActionEntry action_entries[] =
{ "sendto-menu", NULL, N_ ("_Send To"), NULL, },
{ "empty-trash", NULL, N_ ("_Empty Trash"), NULL, N_ ("Delete all files and folders in the Trash"), G_CALLBACK (thunar_window_action_empty_trash), },
{ "detach-tab", NULL, N_ ("Detac_h Tab"), NULL, N_ ("Open current folder in a new window"), G_CALLBACK (thunar_window_action_detach_tab), },
+ { "switch-previous-tab", "go-previous", N_ ("_Previous Tab"), "<control>Page_Up", N_ ("Switch to Previous Tab"), G_CALLBACK (switch_previous_tab), },
+ { "switch-next-tab", "go-next", N_ ("_Next Tab"), "<control>Page_Down", N_ ("Switch to Next Tab"), G_CALLBACK (switch_next_tab), },
{ "close-all-windows", NULL, N_ ("Close _All Windows"), "<control><shift>W", N_ ("Close all Thunar windows"), G_CALLBACK (thunar_window_action_close_all_windows), },
{ "close-tab", "window-close", N_ ("C_lose Tab"), "<control>W", N_ ("Close this folder"), G_CALLBACK (thunar_window_action_close_tab), },
{ "close-window", "application-exit", N_ ("_Close Window"), "<control>Q", N_ ("Close this window"), G_CALLBACK (thunar_window_action_close_window), },
@@ -1360,6 +1366,44 @@ thunar_window_tab_change (ThunarWindow *window,
static void
+switch_next_tab (GtkAction *action,
+ ThunarWindow *window)
+{
+ gint current_page;
+ gint new_page;
+ gint pages;
+
+ _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
+
+ current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (window->notebook));
+ pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook));
+ new_page = (current_page + 1) % pages;
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), new_page);
+}
+
+
+
+static void
+switch_previous_tab (GtkAction *action,
+ ThunarWindow *window)
+{
+ gint current_page;
+ gint new_page;
+ gint pages;
+
+ _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
+
+ current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (window->notebook));
+ pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook));
+ new_page = (current_page - 1) % pages;
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), new_page);
+}
+
+
+
+static void
thunar_window_realize (GtkWidget *widget)
{
ThunarWindow *window = THUNAR_WINDOW (widget);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list