[nautilus/wip/csoriano/search-improvements: 3/3] files-view: sync the query when the location is a search



commit 64dbc8b5e1c6e66bc5feca7fa521406349fe0576
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Dec 17 10:32:07 2015 +0100

    files-view: sync the query when the location is a search

 src/nautilus-files-view.c  |   10 +++++++++-
 src/nautilus-window-slot.c |    3 +++
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 055800e..769c115 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3092,6 +3092,14 @@ nautilus_files_view_set_location (NautilusView *view,
         nautilus_profile_start (NULL);
         directory = nautilus_directory_get (location);
         load_directory (NAUTILUS_FILES_VIEW (view), directory);
+        /* In case we want to load a previous search, sync the query */
+        if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
+                NautilusQuery *previous_query;
+
+                previous_query = nautilus_search_directory_get_query (NAUTILUS_SEARCH_DIRECTORY (directory));
+                nautilus_view_set_search_query (view, previous_query);
+                g_object_unref (previous_query);
+        }
         nautilus_directory_unref (directory);
         nautilus_profile_end (NULL);
 }
@@ -7754,7 +7762,7 @@ nautilus_files_view_set_search_query (NautilusView  *view,
                          * Reuse the search directory and reload it.
                          */
                         nautilus_search_directory_set_query (NAUTILUS_SEARCH_DIRECTORY 
(files_view->details->model), query);
-                        nautilus_view_set_location (view, location);
+                        load_directory (files_view, nautilus_directory_ref (files_view->details->model));
                 } else {
                         NautilusDirectory *directory;
                         NautilusFile *file;
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index b10de00..de92841 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -267,7 +267,10 @@ check_search_visible (NautilusWindowSlot *slot)
         /* If we changed location just to another search location, for example,
          * when changing the query, just keep the search visible */
         if (nautilus_view_is_searching (view))
+        if (nautilus_view_is_searching (view)) {
+                nautilus_window_slot_set_search_visible (slot, TRUE);
                 return;
+         }
 
         if (query) {
                 text = nautilus_query_get_text (query);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]