summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2023-01-10 17:49:49 +0000
committerAntónio Fernandes <antoniof@gnome.org>2023-01-10 17:49:49 +0000
commit7689859589638cf4d377881628f685ab5c6e74ef (patch)
tree7f8d9b02a981054ad08afff08bc08d01232e3073
parentd22207b4dd2adbc099f37c407189f5566e9b9b38 (diff)
downloadnautilus-7689859589638cf4d377881628f685ab5c6e74ef.tar.gz
window: Reset actions when tab menu is closed
In some cases, an action that was disabled when opening the tab menu might stay disabled when you close the tab menu because of an early return. Make sure to reenable all of the actions when the tab menu is closed.
-rw-r--r--src/nautilus-window.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 14f5db48c..285febf0a 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -491,17 +491,16 @@ tab_view_setup_menu_cb (AdwTabView *tab_view,
GAction *move_tab_right_action;
GAction *restore_tab_action;
int position, n_pages;
+ gboolean menu_is_closed = (page == NULL);
window->menu_page = page;
- if (page == NULL)
+ if (!menu_is_closed)
{
- return;
+ position = adw_tab_view_get_page_position (tab_view, page);
+ n_pages = adw_tab_view_get_n_pages (tab_view);
}
- position = adw_tab_view_get_page_position (tab_view, page);
- n_pages = adw_tab_view_get_n_pages (tab_view);
-
move_tab_left_action = g_action_map_lookup_action (G_ACTION_MAP (window),
"tab-move-left");
move_tab_right_action = g_action_map_lookup_action (G_ACTION_MAP (window),
@@ -509,12 +508,13 @@ tab_view_setup_menu_cb (AdwTabView *tab_view,
restore_tab_action = g_action_map_lookup_action (G_ACTION_MAP (window),
"restore-tab");
+ /* Re-enable all of the actions if the menu is closed */
g_simple_action_set_enabled (G_SIMPLE_ACTION (move_tab_left_action),
- page == NULL || position > 0);
+ menu_is_closed || position > 0);
g_simple_action_set_enabled (G_SIMPLE_ACTION (move_tab_right_action),
- page == NULL || position < n_pages - 1);
+ menu_is_closed || position < n_pages - 1);
g_simple_action_set_enabled (G_SIMPLE_ACTION (restore_tab_action),
- g_queue_get_length (window->tab_data_queue) > 0);
+ menu_is_closed || g_queue_get_length (window->tab_data_queue) > 0);
}
static void