[nautilus] view: preserve selection when going out of search
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] view: preserve selection when going out of search
- Date: Mon, 17 Sep 2012 17:39:46 +0000 (UTC)
commit 1594c2b03e98d59dfb8dcd4a62fd56ff2f6025aa
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Sep 17 13:34:45 2012 -0400
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
src/nautilus-view.c | 6 ------
src/nautilus-window-manage-views.c | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 06637aa..d647f96 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 cf146da..407a27e 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]