1
0
mirror of https://gitlab.gnome.org/GNOME/nautilus synced 2024-06-30 23:46:35 +00:00

window-slot: Stop sync'ing location widgets

Like the previous commit, this resolves a layer violation and paves the
way for NautilusWindowSlot to be reusable in future FileChooser dialog,
by not using NautilusWindow methods.

On this particular case, we have been updating window widgets which
depend of current location whenever the active lot changes or the the
location of the active slot changes.

On the first case, the window is in charge of setting the active slot,
and in the second case it is already listening to the locatio change.
In both cases, on_location_changed() in nautilus-window.c is called.

So, sync the location widgets from on_location_changed() and stop
exposing it in the header.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402
This commit is contained in:
António Fernandes 2024-04-27 23:52:27 +01:00
parent 22d214e818
commit 3efa7fa6e8
3 changed files with 5 additions and 12 deletions

View File

@ -1385,11 +1385,6 @@ nautilus_window_slot_set_location (NautilusWindowSlot *self,
old_location = self->location;
self->location = g_object_ref (location);
if (nautilus_window_slot_get_active (self))
{
nautilus_window_sync_location_widgets (self->window);
}
nautilus_window_slot_update_title (self);
if (old_location)
@ -3233,7 +3228,6 @@ nautilus_window_slot_set_active (NautilusWindowSlot *self,
/* sync window to new slot */
nautilus_window_sync_allow_stop (window, self);
nautilus_window_sync_location_widgets (window);
nautilus_window_slot_sync_actions (self);
gtk_widget_insert_action_group (GTK_WIDGET (window), "slot", self->slot_action_group);

View File

@ -81,6 +81,7 @@ static GtkWidget *nautilus_window_ensure_location_entry (NautilusWindow *window)
static void nautilus_window_back_or_forward (NautilusWindow *window,
gboolean back,
guint distance);
static void nautilus_window_sync_location_widgets (NautilusWindow *window);
/* Sanity check: highest mouse button value I could find was 14. 5 is our
* lower threshold (well-documented to be the one of the button events for the
@ -511,6 +512,7 @@ action_open_location (GSimpleAction *action,
static void
on_location_changed (NautilusWindow *window)
{
nautilus_window_sync_location_widgets (window);
nautilus_gtk_places_sidebar_set_location (NAUTILUS_GTK_PLACES_SIDEBAR (window->places_sidebar),
nautilus_window_slot_get_location (nautilus_window_get_active_slot (window)));
}
@ -1197,16 +1199,15 @@ nautilus_window_sync_starred (NautilusWindow *window)
}
}
void
static void
nautilus_window_sync_location_widgets (NautilusWindow *window)
{
NautilusWindowSlot *slot;
NautilusWindowSlot *slot = window->active_slot;
GFile *location;
GAction *action;
gboolean enabled;
slot = window->active_slot;
/* This function is called by the active slot. */
/* This function can only be called when there is a slot. */
g_assert (slot != NULL);
location = nautilus_window_slot_get_location (slot);

View File

@ -81,8 +81,6 @@ GList * nautilus_window_get_slots (NautilusWindow *wind
void nautilus_window_slot_close (NautilusWindow *window,
NautilusWindowSlot *slot);
void nautilus_window_sync_location_widgets (NautilusWindow *window);
void nautilus_window_reset_menus (NautilusWindow *window);
void nautilus_window_show_about_dialog (NautilusWindow *window);