From c9418210ed329f70454a3bc8760dc69782add9a8 Mon Sep 17 00:00:00 2001 From: monsta Date: Fri, 6 Jan 2017 13:10:38 +0300 Subject: revert part of previous commit - it broke Back/Forward buttons --- src/caja-window-manage-views.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c index 86c50ab8..cf06f8d1 100644 --- a/src/caja-window-manage-views.c +++ b/src/caja-window-manage-views.c @@ -271,6 +271,37 @@ handle_go_forward (CajaNavigationWindowSlot *navigation_slot, g_list_free_1 (link); } +static void +handle_go_elsewhere (CajaWindowSlot *slot, GFile *location) +{ + CajaNavigationWindowSlot *navigation_slot; + + if (CAJA_IS_NAVIGATION_WINDOW_SLOT (slot)) + { + navigation_slot = CAJA_NAVIGATION_WINDOW_SLOT (slot); + + /* Clobber the entire forward list, and move displayed location to back list */ + caja_navigation_window_slot_clear_forward_list (navigation_slot); + + if (slot->location != NULL) + { + /* If we're returning to the same uri somehow, don't put this uri on back list. + * This also avoids a problem where set_displayed_location + * didn't update last_location_bookmark since the uri didn't change. + */ + if (!g_file_equal (slot->location, location)) + { + /* Store bookmark for current location in back list, unless there is no current location */ + check_last_bookmark_location_matches_slot (slot); + /* Use the first bookmark in the history list rather than creating a new one. */ + navigation_slot->back_list = g_list_prepend (navigation_slot->back_list, + slot->last_location_bookmark); + g_object_ref (navigation_slot->back_list->data); + } + } + } +} + void caja_window_update_up_button (CajaWindow *window) { @@ -422,6 +453,7 @@ update_history (CajaWindowSlot *slot, case CAJA_LOCATION_CHANGE_STANDARD: case CAJA_LOCATION_CHANGE_FALLBACK: caja_window_slot_add_current_location_to_history_list (slot); + handle_go_elsewhere (slot, new_location); return; case CAJA_LOCATION_CHANGE_RELOAD: /* for reload there is no work to do */ -- cgit v1.2.1