window-slot: Don't access the tab view

The slot accesses the window's tab view to change the selected tab.

This is a layer violation, which is both completely unnecessary and
is getting in the way of reusing the slot widget in a tabs-less
window (such as the upcoming FileChooser window).

So, have NautilusWindow manage the selected tab directly. This is
one less NautilusWindow method being called by NautilusWindowSlot.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402
This commit is contained in:
António Fernandes 2024-04-27 21:18:26 +01:00
parent 6bd4e06faa
commit bb9231b6a0
3 changed files with 4 additions and 18 deletions

View file

@ -3240,16 +3240,8 @@ nautilus_window_slot_set_active (NautilusWindowSlot *self,
if (active)
{
AdwTabView *tab_view;
AdwTabPage *page;
window = self->window;
tab_view = nautilus_window_get_tab_view (window);
page = adw_tab_view_get_page (tab_view, GTK_WIDGET (self));
adw_tab_view_set_selected_page (tab_view, page);
/* sync window to new slot */
nautilus_window_sync_allow_stop (window, self);
nautilus_window_sync_title (window, self);

View file

@ -897,14 +897,6 @@ nautilus_window_sync_allow_stop (NautilusWindow *window,
}
}
AdwTabView *
nautilus_window_get_tab_view (NautilusWindow *window)
{
g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), NULL);
return window->tab_view;
}
/* Callback used when the places sidebar changes location; we need to change the displayed folder */
static void
open_location_cb (NautilusWindow *window,
@ -2013,6 +2005,10 @@ nautilus_window_set_active_slot (NautilusWindow *window,
/* make new slot active, if it exists */
if (new_slot)
{
AdwTabPage *page = adw_tab_view_get_page (window->tab_view,
GTK_WIDGET (new_slot));
adw_tab_view_set_selected_page (window->tab_view, page);
/* inform slot & view */
nautilus_window_slot_set_active (new_slot, TRUE);

View file

@ -85,8 +85,6 @@ void nautilus_window_sync_location_widgets (NautilusWindow *wind
void nautilus_window_reset_menus (NautilusWindow *window);
AdwTabView * nautilus_window_get_tab_view (NautilusWindow *window);
void nautilus_window_show_about_dialog (NautilusWindow *window);
/* sync window GUI with current slot. Used when changing slots,