[nautilus] query-editor: use real location for search
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] query-editor: use real location for search
- Date: Tue, 22 Sep 2015 20:45:15 +0000 (UTC)
commit 9dbe133f2a175e078976b366f388a309ebc344f0
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Sep 22 22:40:00 2015 +0200
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
src/nautilus-query-editor.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index ccdb55b..858fdd7 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]