summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-11-03 10:53:47 -0700
committerAntónio Fernandes <antoniof@gnome.org>2023-01-09 11:06:43 +0000
commitbd631946b7656dc1096a3ee9956505bf6f0dc4e3 (patch)
treeeb16c42cf788a46313dca7e66b3d9d96c7c86ba5 /src
parent191a1787b6a9a413a47b8edf0e661cc16f2f197f (diff)
downloadnautilus-bd631946b7656dc1096a3ee9956505bf6f0dc4e3.tar.gz
window: Add restore closed tab to tab menu
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1620
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-window.c5
-rw-r--r--src/resources/ui/nautilus-window.ui4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index eaa297db2..e0b235013 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -488,6 +488,7 @@ tab_view_setup_menu_cb (AdwTabView *tab_view,
{
GAction *move_tab_left_action;
GAction *move_tab_right_action;
+ GAction *restore_tab_action;
int position, n_pages;
window->menu_page = page;
@@ -504,11 +505,15 @@ tab_view_setup_menu_cb (AdwTabView *tab_view,
"tab-move-left");
move_tab_right_action = g_action_map_lookup_action (G_ACTION_MAP (window),
"tab-move-right");
+ restore_tab_action = g_action_map_lookup_action (G_ACTION_MAP (window),
+ "restore-tab");
g_simple_action_set_enabled (G_SIMPLE_ACTION (move_tab_left_action),
page == NULL || position > 0);
g_simple_action_set_enabled (G_SIMPLE_ACTION (move_tab_right_action),
page == NULL || position < n_pages - 1);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (restore_tab_action),
+ g_queue_get_length (window->tab_data_queue) > 0);
}
static void
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index e7ae95809..5dd2e4b88 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -7,6 +7,10 @@
<attribute name="label" translatable="yes">_New Tab</attribute>
<attribute name="action">win.new-tab</attribute>
</item>
+ <item>
+ <attribute name="label" translatable="yes">Re_store Closed Tab</attribute>
+ <attribute name="action">win.restore-tab</attribute>
+ </item>
</section>
<section>
<item>