diff options
author | António Fernandes <antoniof@gnome.org> | 2021-01-13 00:50:14 +0000 |
---|---|---|
committer | António Fernandes <antoniojpfernandes@gmail.com> | 2021-07-08 20:26:35 +0000 |
commit | 9a86aa22fd7014e27b44af5ec1079d7a03ceb514 (patch) | |
tree | e26dd928315a2a843d14daa6cbd0ab3f73837063 | |
parent | bf7b487eb976abe5f036005f56e74ed7a05a1598 (diff) | |
download | nautilus-9a86aa22fd7014e27b44af5ec1079d7a03ceb514.tar.gz |
Revert "window, window-slot: Save and restore navigation history"
This reverts commit 691f1cf1bde256c94e126c1a2bb111aaff630b72.
It's a solid workaround, but we are going to fix the root issue.
-rw-r--r-- | src/nautilus-window-slot.c | 48 | ||||
-rw-r--r-- | src/nautilus-window-slot.h | 13 | ||||
-rw-r--r-- | src/nautilus-window.c | 84 |
3 files changed, 7 insertions, 138 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c index f27f7e2d1..505d1782f 100644 --- a/src/nautilus-window-slot.c +++ b/src/nautilus-window-slot.c @@ -198,9 +198,6 @@ nautilus_window_slot_restore_navigation_state (NautilusWindowSlot *self, priv = nautilus_window_slot_get_instance_private (self); - /* We are restoring saved history to newly created slot with no history. */ - g_warn_if_fail (priv->back_list == NULL && priv->forward_list == NULL); - priv->back_list = g_steal_pointer (&data->back_list); priv->forward_list = g_steal_pointer (&data->forward_list); @@ -2286,11 +2283,12 @@ nautilus_window_slot_set_content_view (NautilusWindowSlot *self, } void -nautilus_window_slot_back_or_forward (NautilusWindowSlot *self, - gboolean back, - guint distance, - NautilusWindowOpenFlags flags) +nautilus_window_back_or_forward (NautilusWindow *window, + gboolean back, + guint distance, + NautilusWindowOpenFlags flags) { + NautilusWindowSlot *self; GList *list; GFile *location; guint len; @@ -2298,6 +2296,7 @@ nautilus_window_slot_back_or_forward (NautilusWindowSlot *self, GFile *old_location; NautilusWindowSlotPrivate *priv; + self = nautilus_window_get_active_slot (window); priv = nautilus_window_slot_get_instance_private (self); list = back ? priv->back_list : priv->forward_list; @@ -3735,38 +3734,3 @@ nautilus_window_slot_get_query_editor (NautilusWindowSlot *self) return priv->query_editor; } - -/* - * Open the specified location and set up the navigation history including the - * back and forward lists. This function is intended to be called when switching - * between NautilusWindowSlot and NautilusOtherLocationsWindowSlot. It allows - * the navigation history accumulated in the slot being replaced to be loaded - * into the replacing slot. - * - * The 'location' member variable is set to the new location before calling - * begin_location_change() to ensure that it matches the - * 'current_location_bookmark' member as expected by the location change - * pipeline. - */ -void -nautilus_window_slot_open_location_set_navigation_state (NautilusWindowSlot *self, - GFile *location, - NautilusWindowOpenFlags flags, - GList *new_selection, - NautilusLocationChangeType change_type, - NautilusNavigationState *navigation_state, - guint distance) -{ - NautilusWindowSlotPrivate *priv; - - priv = nautilus_window_slot_get_instance_private (self); - - nautilus_window_slot_restore_navigation_state (self, navigation_state); - - g_clear_object (&priv->location); - - priv->location = nautilus_file_get_location (navigation_state->file); - - begin_location_change (self, location, NULL, new_selection, - change_type, distance, NULL); -} diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h index 3518c948c..bdb9dccfa 100644 --- a/src/nautilus-window-slot.h +++ b/src/nautilus-window-slot.h @@ -77,14 +77,6 @@ void nautilus_window_slot_open_location_full (NautilusWindowSlot NautilusWindowOpenFlags flags, GList *new_selection); -void nautilus_window_slot_open_location_set_navigation_state (NautilusWindowSlot *slot, - GFile *location, - NautilusWindowOpenFlags flags, - GList *new_selection, - NautilusLocationChangeType change_type, - NautilusNavigationState *navigation_state, - guint distance); - GFile * nautilus_window_slot_get_location (NautilusWindowSlot *slot); GFile * nautilus_window_slot_get_pending_location (NautilusWindowSlot *slot); @@ -142,9 +134,4 @@ NautilusQueryEditor *nautilus_window_slot_get_query_editor (NautilusWindowSlot * /* Only used by slot-dnd */ NautilusView* nautilus_window_slot_get_current_view (NautilusWindowSlot *slot); -void nautilus_window_slot_back_or_forward (NautilusWindowSlot *slot, - gboolean back, - guint distance, - NautilusWindowOpenFlags flags); - void free_navigation_state (gpointer data); diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 2215903d9..f004d629e 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -595,7 +595,6 @@ nautilus_window_open_location_full (NautilusWindow *window, { NautilusWindowSlot *active_slot; gboolean new_tab_at_end; - NautilusNavigationState *navigation_state = NULL; /* The location owner can be one of the slots requesting to handle an * unhandled location. But this slot can be destroyed when switching to @@ -627,8 +626,6 @@ nautilus_window_open_location_full (NautilusWindow *window, } else if (!nautilus_window_slot_handles_location (target_slot, location)) { - navigation_state = nautilus_window_slot_get_navigation_state (active_slot); - target_slot = replace_active_slot (window, location, flags); } @@ -640,19 +637,7 @@ nautilus_window_open_location_full (NautilusWindow *window, nautilus_window_set_active_slot (window, target_slot); } - if (navigation_state != NULL) - { - nautilus_window_slot_open_location_set_navigation_state (target_slot, - location, flags, selection, - NAUTILUS_LOCATION_CHANGE_STANDARD, - navigation_state, 0); - - free_navigation_state (navigation_state); - } - else - { - nautilus_window_slot_open_location_full (target_slot, location, flags, selection); - } + nautilus_window_slot_open_location_full (target_slot, location, flags, selection); g_object_unref (location); } @@ -2964,70 +2949,3 @@ nautilus_window_search (NautilusWindow *window, g_warning ("Trying search on a slot but no active slot present"); } } - -/* Ideally, this method should be a simple wrapper for the slot method. However, - * going back or forward can result in a new slot (or another subclass), so we - * workaround that by duplicating part of nautilus_window_slot_back_or_forward() - */ -void -nautilus_window_back_or_forward (NautilusWindow *window, - gboolean back, - guint distance, - NautilusWindowOpenFlags flags) -{ - NautilusWindowSlot *slot; - GList *next_location_list, *back_list, *forward_list; - g_autoptr (GFile) next_location = NULL; - guint len; - NautilusBookmark *next_location_bookmark; - gboolean active_slot_handles_location; - - slot = nautilus_window_get_active_slot (window); - back_list = nautilus_window_slot_get_back_history (slot); - forward_list = nautilus_window_slot_get_forward_history (slot); - - next_location_list = back ? back_list : forward_list; - - len = (guint) g_list_length (next_location_list); - - /* If we can't move in the direction at all, just return. */ - if (len == 0) - { - return; - } - - /* If the distance to move is off the end of the list, go to the end - * of the list. */ - if (distance >= len) - { - distance = len - 1; - } - - next_location_bookmark = g_list_nth_data (next_location_list, distance); - next_location = nautilus_bookmark_get_location (next_location_bookmark); - - active_slot_handles_location = nautilus_window_slot_handles_location (slot, next_location); - - if (!active_slot_handles_location) - { - NautilusNavigationState *navigation_state; - NautilusLocationChangeType location_change_type; - - navigation_state = nautilus_window_slot_get_navigation_state (slot); - - location_change_type = back ? NAUTILUS_LOCATION_CHANGE_BACK : NAUTILUS_LOCATION_CHANGE_FORWARD; - - slot = replace_active_slot (window, next_location, flags); - - nautilus_window_slot_open_location_set_navigation_state (slot, - next_location, flags, NULL, - location_change_type, - navigation_state, distance); - - free_navigation_state (navigation_state); - } - else - { - nautilus_window_slot_back_or_forward (slot, back, distance, flags); - } -} |