Commit 2553625f authored by Marco Trevisan's avatar Marco Trevisan 🎺

search-engine: use nautilus_file_is_remote to check remote files

parent 7c96419c
......@@ -20,9 +20,11 @@
*/
#include <config.h>
#include "nautilus-file.h"
#include "nautilus-search-engine-simple.h"
#include "nautilus-search-hit.h"
#include "nautilus-search-provider.h"
#include "nautilus-search-engine-simple.h"
#include "nautilus-ui-utilities.h"
#define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
#include "nautilus-debug.h"
......@@ -324,9 +326,15 @@ visit_directory (GFile *dir,
if (recursive_flag != NAUTILUS_QUERY_RECURSIVE_NEVER &&
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
{
recursive = recursive_flag == NAUTILUS_QUERY_RECURSIVE_ALWAYS ||
(recursive_flag == NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY &&
g_file_is_native (child));
if (recursive_flag == NAUTILUS_QUERY_RECURSIVE_ALWAYS)
{
recursive = TRUE;
}
else if (recursive_flag == NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY)
{
g_autoptr (NautilusFile) file = nautilus_file_get (child);
recursive = !nautilus_file_is_remote (file);
}
}
if (recursive)
......
......@@ -19,6 +19,8 @@
*
*/
#include <glib-object.h>
#pragma once
G_BEGIN_DECLS
......@@ -29,4 +31,4 @@ G_DECLARE_FINAL_TYPE (NautilusSearchEngineSimple, nautilus_search_engine_simple,
NautilusSearchEngineSimple* nautilus_search_engine_simple_new (void);
G_END_DECLS
\ No newline at end of file
G_END_DECLS
......@@ -22,6 +22,7 @@
#include <config.h>
#include "nautilus-search-engine-tracker.h"
#include "nautilus-file.h"
#include "nautilus-search-hit.h"
#include "nautilus-search-provider.h"
#define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
......@@ -463,21 +464,27 @@ static void
nautilus_search_engine_tracker_set_query (NautilusSearchProvider *provider,
NautilusQuery *query)
{
g_autoptr (GFile) location = NULL;
NautilusSearchEngineTracker *tracker;
NautilusQueryRecursive recursive;
tracker = NAUTILUS_SEARCH_ENGINE_TRACKER (provider);
recursive = nautilus_query_get_recursive (query);
location = nautilus_query_get_location (query);
g_clear_object (&tracker->query);
tracker->query = g_object_ref (query);
tracker->recursive = recursive == NAUTILUS_QUERY_RECURSIVE_ALWAYS ||
recursive == NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY ||
(recursive == NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY &&
g_file_is_native (location));
if (recursive == NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY)
{
g_autoptr (GFile) location = nautilus_query_get_location (query);
g_autoptr (NautilusFile) location_file = nautilus_file_get (location);
tracker->recursive = !nautilus_file_is_remote (location_file);
}
else
{
tracker->recursive = recursive == NAUTILUS_QUERY_RECURSIVE_ALWAYS ||
recursive == NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY;
}
}
static gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment