summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-09-17 13:34:45 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-09-17 13:34:45 -0400
commit1594c2b03e98d59dfb8dcd4a62fd56ff2f6025aa (patch)
tree5a6e69a1fa3f3fed1645f91dc9d76e887b298094 /src
parent15be7f1f433fe08a05df050b422f72d27e24c42c (diff)
downloadnautilus-1594c2b03e98d59dfb8dcd4a62fd56ff2f6025aa.tar.gz
view: preserve selection when going out of search
Forward the current selection when we go back from a search directory to its base location. This helps identifying the search results if some were pre-selected before leaving the search. https://bugzilla.gnome.org/show_bug.cgi?id=680849
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-view.c6
-rw-r--r--src/nautilus-window-manage-views.c16
2 files changed, 16 insertions, 6 deletions
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 06637aaff..d647f968c 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -9126,12 +9126,6 @@ load_directory (NautilusView *view,
}
old_directory = view->details->model;
-
- if (NAUTILUS_IS_SEARCH_DIRECTORY (directory) &&
- !NAUTILUS_IS_SEARCH_DIRECTORY (old_directory)) {
- nautilus_search_directory_set_base_model (NAUTILUS_SEARCH_DIRECTORY (directory), old_directory);
- }
-
disconnect_model_handlers (view);
nautilus_directory_ref (directory);
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index cf146da7e..407a27eeb 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -971,6 +971,7 @@ create_content_view (NautilusWindowSlot *slot,
GList *selection;
gboolean ret = TRUE;
GError *error = NULL;
+ NautilusDirectory *old_directory, *new_directory;
window = nautilus_window_slot_get_window (slot);
@@ -1003,6 +1004,21 @@ create_content_view (NautilusWindowSlot *slot,
nautilus_window_connect_content_view (window, slot->new_content_view);
}
+ /* Forward search selection and state before loading the new model */
+ new_directory = nautilus_directory_get (slot->pending_location);
+ old_directory = nautilus_directory_get (slot->location);
+
+ if (NAUTILUS_IS_SEARCH_DIRECTORY (new_directory) &&
+ !NAUTILUS_IS_SEARCH_DIRECTORY (old_directory)) {
+ nautilus_search_directory_set_base_model (NAUTILUS_SEARCH_DIRECTORY (new_directory), old_directory);
+ }
+
+ if (NAUTILUS_IS_SEARCH_DIRECTORY (old_directory) &&
+ !NAUTILUS_IS_SEARCH_DIRECTORY (new_directory) &&
+ slot->pending_selection == NULL) {
+ slot->pending_selection = nautilus_view_get_selection (slot->content_view);
+ }
+
/* Actually load the pending location and selection: */
if (slot->pending_location != NULL) {