Commit 9cb63ff9 authored by Marco Trevisan's avatar Marco Trevisan 🎺

search-engine-simple: remove recursive property using query flag instead

Compute the recursive parameter depending on the query flag for recursivity,
enabling it only if the query recursive flag is NAUTILUS_QUERY_RECURSIVE_ALWAYS,
while should be disabled otherwise.

At this point the "recursive" property that was set only for this search engine
doesn't make any sense anymore and we can safely drop it, together with the
calls that were done at search-engine level to handle this special case.

We move now the responsibility to to the engine itself, more than to the model.
parent 002d6513
......@@ -182,8 +182,6 @@ static void
start_search (NautilusSearchDirectory *self)
{
NautilusSearchEngineModel *model_provider;
NautilusSearchEngineSimple *simple_provider;
gboolean recursive;
if (!self->query)
{
......@@ -211,10 +209,6 @@ start_search (NautilusSearchDirectory *self)
model_provider = nautilus_search_engine_get_model_provider (self->engine);
nautilus_search_engine_model_set_model (model_provider, self->base_model);
simple_provider = nautilus_search_engine_get_simple_provider (self->engine);
recursive = nautilus_query_get_recursive (self->query);
g_object_set (simple_provider, "recursive", recursive, NULL);
reset_file_list (self);
nautilus_search_provider_start (NAUTILUS_SEARCH_PROVIDER (self->engine));
......
......@@ -35,7 +35,7 @@
enum
{
PROP_RECURSIVE = 1,
PROP_0,
PROP_RUNNING,
NUM_PROPERTIES
};
......@@ -437,9 +437,10 @@ nautilus_search_engine_simple_set_query (NautilusSearchProvider *provider,
{
NautilusSearchEngineSimple *simple = NAUTILUS_SEARCH_ENGINE_SIMPLE (provider);
g_object_ref (query);
g_clear_object (&simple->query);
simple->query = query;
simple->query = g_object_ref (query);
simple->recursive = nautilus_query_get_recursive (query) == NAUTILUS_QUERY_RECURSIVE_ALWAYS;
}
static gboolean
......@@ -452,30 +453,6 @@ nautilus_search_engine_simple_is_running (NautilusSearchProvider *provider)
return simple->active_search != NULL;
}
static void
nautilus_search_engine_simple_set_property (GObject *object,
guint arg_id,
const GValue *value,
GParamSpec *pspec)
{
NautilusSearchEngineSimple *engine = NAUTILUS_SEARCH_ENGINE_SIMPLE (object);
switch (arg_id)
{
case PROP_RECURSIVE:
{
engine->recursive = g_value_get_boolean (value);
}
break;
default:
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, arg_id, pspec);
}
break;
}
}
static void
nautilus_search_engine_simple_get_property (GObject *object,
guint arg_id,
......@@ -491,12 +468,6 @@ nautilus_search_engine_simple_get_property (GObject *object,
g_value_set_boolean (value, nautilus_search_engine_simple_is_running (NAUTILUS_SEARCH_PROVIDER (engine)));
}
break;
case PROP_RECURSIVE:
{
g_value_set_boolean (value, engine->recursive);
}
break;
}
}
......@@ -517,20 +488,6 @@ nautilus_search_engine_simple_class_init (NautilusSearchEngineSimpleClass *class
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = finalize;
gobject_class->get_property = nautilus_search_engine_simple_get_property;
gobject_class->set_property = nautilus_search_engine_simple_set_property;
/**
* NautilusSearchEngineSimple::recursive:
*
* Whether the search is recursive or not.
*/
g_object_class_install_property (gobject_class,
PROP_RECURSIVE,
g_param_spec_boolean ("recursive",
"recursive",
"recursive",
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
/**
* NautilusSearchEngine::running:
......
......@@ -416,13 +416,3 @@ nautilus_search_engine_get_model_provider (NautilusSearchEngine *engine)
return priv->model;
}
NautilusSearchEngineSimple *
nautilus_search_engine_get_simple_provider (NautilusSearchEngine *engine)
{
NautilusSearchEnginePrivate *priv;
priv = nautilus_search_engine_get_instance_private (engine);
return priv->simple;
}
......@@ -41,7 +41,5 @@ struct _NautilusSearchEngineClass
NautilusSearchEngine *nautilus_search_engine_new (void);
NautilusSearchEngineModel *
nautilus_search_engine_get_model_provider (NautilusSearchEngine *engine);
NautilusSearchEngineSimple *
nautilus_search_engine_get_simple_provider (NautilusSearchEngine *engine);
G_END_DECLS
\ No newline at end of file
G_END_DECLS
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