summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-11-01 13:57:12 -0700
committerAntónio Fernandes <antoniof@gnome.org>2023-01-09 11:06:43 +0000
commitc2103f77387d3de7d530d7396a30a5e01bd44f87 (patch)
tree50e373fb6ed26787efd7ed6cf5824eec261aa43b
parent2282fa5a57b082abcd38312a3e3085f18362b6f3 (diff)
downloadnautilus-c2103f77387d3de7d530d7396a30a5e01bd44f87.tar.gz
window: Add close-other-tabs action
Add the ability from the tab menu to close all other tabs.
-rw-r--r--src/nautilus-window.c12
-rw-r--r--src/resources/ui/nautilus-window.ui4
2 files changed, 16 insertions, 0 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index cdc187dc9..dbbc4889d 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -191,6 +191,17 @@ action_close_current_view (GSimpleAction *action,
}
static void
+action_close_other_tabs (GSimpleAction *action,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ NautilusWindow *window = user_data;
+ AdwTabPage *page = get_current_page (window);
+
+ adw_tab_view_close_other_pages (window->tab_view, page);
+}
+
+static void
action_go_home (GSimpleAction *action,
GVariant *state,
gpointer user_data)
@@ -1457,6 +1468,7 @@ const GActionEntry win_entries[] =
{ "redo", action_redo },
/* Only accesible by shorcuts */
{ "close-current-view", action_close_current_view },
+ { "close-other-tabs", action_close_other_tabs },
{ "go-home", action_go_home },
{ "go-starred", action_go_starred },
{ "tab-move-left", action_tab_move_left },
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index e25a5067e..c0b46c53b 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -23,6 +23,10 @@
<attribute name="label" translatable="yes">_Close Tab</attribute>
<attribute name="action">win.close-current-view</attribute>
</item>
+ <item>
+ <attribute name="label" translatable="yes">Close _Other Tabs</attribute>
+ <attribute name="action">win.close-other-tabs</attribute>
+ </item>
</section>
</menu>
<template class="NautilusWindow" parent="AdwApplicationWindow">