[nautilus] query: always set a query location URI
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] query: always set a query location URI
- Date: Thu, 18 Oct 2012 19:08:00 +0000 (UTC)
commit cffa0c70914529892a3026cc759515b22503775d
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Oct 18 14:23:39 2012 -0400
query: always set a query location URI
It makes sense for a query object to always be relative to a specific
location, so just initialize the query URI to g_get_home_dir().
libnautilus-private/nautilus-query.c | 9 ++++-----
.../nautilus-search-engine-tracker.c | 15 +++++----------
2 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/libnautilus-private/nautilus-query.c b/libnautilus-private/nautilus-query.c
index 107adbd..7a92c38 100644
--- a/libnautilus-private/nautilus-query.c
+++ b/libnautilus-private/nautilus-query.c
@@ -74,6 +74,7 @@ nautilus_query_init (NautilusQuery *query)
query->details = G_TYPE_INSTANCE_GET_PRIVATE (query, NAUTILUS_TYPE_QUERY,
NautilusQueryDetails);
query->details->show_hidden = TRUE;
+ query->details->location_uri = nautilus_get_home_directory_uri ();
}
static gchar *
@@ -417,11 +418,9 @@ nautilus_query_to_xml (NautilusQuery *query)
g_string_append_printf (xml, " <text>%s</text>\n", text);
g_free (text);
- if (query->details->location_uri) {
- uri = encode_home_uri (query->details->location_uri);
- g_string_append_printf (xml, " <location>%s</location>\n", uri);
- g_free (uri);
- }
+ uri = encode_home_uri (query->details->location_uri);
+ g_string_append_printf (xml, " <location>%s</location>\n", uri);
+ g_free (uri);
if (query->details->mime_types) {
g_string_append (xml, " <mimetypes>\n");
diff --git a/libnautilus-private/nautilus-search-engine-tracker.c b/libnautilus-private/nautilus-search-engine-tracker.c
index 5b6b58e..ae3f2ec 100644
--- a/libnautilus-private/nautilus-search-engine-tracker.c
+++ b/libnautilus-private/nautilus-search-engine-tracker.c
@@ -266,16 +266,11 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
g_string_append (sparql, "nie:mimeType ?mime ;");
}
- g_string_append_printf (sparql, " fts:match '%s*'", search_text);
- g_string_append (sparql, " . FILTER (");
-
- if (location_uri) {
- g_string_append_printf (sparql, " tracker:uri-is-descendant('%s', nie:url(?urn)) && ",
- location_uri);
- }
-
- g_string_append_printf (sparql, "fn:contains(fn:lower-case(nfo:fileName(?urn)), '%s')",
- search_text);
+ g_string_append_printf (sparql,
+ " fts:match '%s*' . FILTER ("
+ " tracker:uri-is-descendant('%s', nie:url(?urn)) &&"
+ " fn:contains(fn:lower-case(nfo:fileName(?urn)), '%s')",
+ search_text, location_uri, search_text);
if (mime_count > 0) {
g_string_append (sparql, " && (");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]