summaryrefslogtreecommitdiff
path: root/src/nautilus-shell-search-provider.c
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2018-07-17 04:15:11 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2018-07-26 04:18:53 +0200
commit16d8b80cc482acb3d7bd725c4daf2a1b29ad6a3e (patch)
tree7c869e2d5901e3ae8bf90ff8d41a66863ea18399 /src/nautilus-shell-search-provider.c
parent99f55748ef69a68df86b9a039998ee576d59b898 (diff)
downloadnautilus-16d8b80cc482acb3d7bd725c4daf2a1b29ad6a3e.tar.gz
shell: pass the full query to the slot to preserve all settings
Instead of just opening a window with just the location and search terms, we should pass to the window slot the full nautilus query with all the shell search provider flags, so that they will be respected and that the results in the overview will respect the ones in nautilus
Diffstat (limited to 'src/nautilus-shell-search-provider.c')
-rw-r--r--src/nautilus-shell-search-provider.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index bd97345d4..0789f0861 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -426,15 +426,32 @@ search_add_volumes_and_bookmarks (PendingSearch *search)
g_object_unref (volume_monitor);
}
+static NautilusQuery*
+shell_query_new (gchar **terms)
+{
+ NautilusQuery *query;
+ g_autoptr (GFile) home = NULL;
+ g_autofree gchar *terms_joined = NULL;
+
+ terms_joined = g_strjoinv (" ", terms);
+ home = g_file_new_for_path (g_get_home_dir ());
+
+ query = nautilus_query_new ();
+ nautilus_query_set_show_hidden_files (query, FALSE);
+ nautilus_query_set_recursive (query, NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
+ nautilus_query_set_text (query, terms_joined);
+ nautilus_query_set_location (query, home);
+
+ return query;
+}
+
static void
execute_search (NautilusShellSearchProvider *self,
GDBusMethodInvocation *invocation,
gchar **terms)
{
- gchar *terms_joined;
NautilusQuery *query;
PendingSearch *pending_search;
- GFile *home;
cancel_current_search (self);
@@ -446,14 +463,7 @@ execute_search (NautilusShellSearchProvider *self,
return;
}
- terms_joined = g_strjoinv (" ", terms);
- home = g_file_new_for_path (g_get_home_dir ());
-
- query = nautilus_query_new ();
- nautilus_query_set_show_hidden_files (query, FALSE);
- nautilus_query_set_recursive (query, NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
- nautilus_query_set_text (query, terms_joined);
- nautilus_query_set_location (query, home);
+ query = shell_query_new (terms);
pending_search = g_slice_new0 (PendingSearch);
pending_search->invocation = g_object_ref (invocation);
@@ -480,9 +490,6 @@ execute_search (NautilusShellSearchProvider *self,
nautilus_search_provider_set_query (NAUTILUS_SEARCH_PROVIDER (pending_search->engine),
query);
nautilus_search_provider_start (NAUTILUS_SEARCH_PROVIDER (pending_search->engine));
-
- g_clear_object (&home);
- g_free (terms_joined);
}
static gboolean
@@ -714,13 +721,9 @@ handle_launch_search (NautilusShellSearchProvider2 *skeleton,
gpointer user_data)
{
GApplication *app = g_application_get_default ();
- gchar *string = g_strjoinv (" ", terms);
- gchar *uri = nautilus_get_home_directory_uri ();
-
- nautilus_application_search (NAUTILUS_APPLICATION (app), uri, string);
+ g_autoptr (NautilusQuery) query = shell_query_new (terms);
- g_free (string);
- g_free (uri);
+ nautilus_application_search (NAUTILUS_APPLICATION (app), query);
nautilus_shell_search_provider2_complete_launch_search (skeleton, invocation);
return TRUE;