summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-09-22 22:40:00 +0200
committerCarlos Soriano <csoriano@gnome.org>2015-09-22 22:44:57 +0200
commit9dbe133f2a175e078976b366f388a309ebc344f0 (patch)
tree95e95476ee3c95c7754d321aa3d2fc4b738c80b7
parent9ea79449c81f9cb9e269742ef1b20ea41b311f4e (diff)
downloadnautilus-9dbe133f2a175e078976b366f388a309ebc344f0.tar.gz
query-editor: use real location for search
Most of the times we were using as a location the invented uri for the search directory as a model for the search, which is wrong and the search was no returning results and the view loading the cached files. Before the window slot changes done a few weeks ago this was fine because we didn't set more than once the location of the query editor in a single search. So we were protected about this situation. However now with the isolation of the model, the window slot is unaware of the details of the model (if it is an invented uri or not) so can't control that. To fix it, make the query editor aware of the type of model used, and in case of it being a search directory, use the base model as a location for the search, and if not, use the file location uri. https://bugzilla.gnome.org/show_bug.cgi?id=755336
-rw-r--r--src/nautilus-query-editor.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index ccdb55bed..858fdd79d 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -1089,8 +1089,22 @@ void
nautilus_query_editor_set_location (NautilusQueryEditor *editor,
GFile *location)
{
+ NautilusDirectory *directory;
+ NautilusDirectory *base_model;
+
g_free (editor->details->current_uri);
- editor->details->current_uri = g_file_get_uri (location);
+
+ /* The client could set us a location that is actually a search directory,
+ * like what happens with the slot when updating the query editor location.
+ * However here we want the real location used as a model for the search,
+ * not the search directory invented uri. */
+ directory = nautilus_directory_get (location);
+ if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
+ base_model = nautilus_search_directory_get_base_model (NAUTILUS_SEARCH_DIRECTORY (directory));
+ editor->details->current_uri = nautilus_directory_get_uri (base_model);
+ } else {
+ editor->details->current_uri = g_file_get_uri (location);
+ }
update_location (editor);
}