diff options
-rw-r--r-- | src/caja-window-manage-views.c | 32 |
1 files changed, 32 insertions, 0 deletions
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 */ |