2007-05-02 22:51:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005 Novell, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2007-05-02 22:51:43 +00:00
|
|
|
*
|
|
|
|
* Author: Anders Carlsson <andersca@imendio.com>
|
|
|
|
*
|
|
|
|
* Based on nautilus-search-engine.c
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2007-05-02 22:51:43 +00:00
|
|
|
#include "gtksearchengine.h"
|
2015-07-01 19:51:20 +00:00
|
|
|
#include "gtksearchenginemodel.h"
|
2007-06-24 11:57:07 +00:00
|
|
|
#include "gtksearchenginequartz.h"
|
2015-09-12 13:13:00 +00:00
|
|
|
#include "gtkintl.h"
|
2007-06-24 11:57:07 +00:00
|
|
|
|
2010-12-09 04:07:00 +00:00
|
|
|
#include <gdk/gdk.h> /* for GDK_WINDOWING_QUARTZ */
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2020-05-16 22:04:56 +00:00
|
|
|
#if defined(HAVE_TRACKER3)
|
|
|
|
#include "gtksearchenginetracker3.h"
|
2008-04-02 09:59:44 +00:00
|
|
|
#endif
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
struct _GtkSearchEnginePrivate {
|
|
|
|
GtkSearchEngine *native;
|
|
|
|
gboolean native_running;
|
2020-05-16 22:00:22 +00:00
|
|
|
gboolean got_results;
|
2015-05-01 19:34:08 +00:00
|
|
|
gchar *native_error;
|
|
|
|
|
2015-07-01 19:51:20 +00:00
|
|
|
GtkSearchEngine *model;
|
|
|
|
gboolean model_running;
|
|
|
|
gchar *model_error;
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
gboolean running;
|
2015-06-19 02:44:11 +00:00
|
|
|
gboolean recursive;
|
2015-05-01 19:34:08 +00:00
|
|
|
GHashTable *hits;
|
2015-07-01 19:51:20 +00:00
|
|
|
|
|
|
|
GtkQuery *query;
|
2015-05-01 19:34:08 +00:00
|
|
|
};
|
|
|
|
|
2015-02-28 21:13:18 +00:00
|
|
|
enum
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
|
|
|
HITS_ADDED,
|
|
|
|
FINISHED,
|
|
|
|
ERROR,
|
|
|
|
LAST_SIGNAL
|
2015-02-28 21:13:18 +00:00
|
|
|
};
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL];
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkSearchEngine, _gtk_search_engine, G_TYPE_OBJECT);
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_query (GtkSearchEngine *engine,
|
|
|
|
GtkQuery *query)
|
|
|
|
{
|
2015-07-01 19:51:20 +00:00
|
|
|
g_set_object (&engine->priv->query, query);
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
if (engine->priv->native)
|
|
|
|
_gtk_search_engine_set_query (engine->priv->native, query);
|
|
|
|
|
2015-07-01 19:51:20 +00:00
|
|
|
if (engine->priv->model)
|
|
|
|
_gtk_search_engine_set_query (engine->priv->model, query);
|
2015-05-01 19:34:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
start (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
g_hash_table_remove_all (engine->priv->hits);
|
|
|
|
|
|
|
|
if (engine->priv->native)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&engine->priv->native_error, g_free);
|
|
|
|
_gtk_search_engine_start (engine->priv->native);
|
|
|
|
engine->priv->native_running = TRUE;
|
|
|
|
}
|
|
|
|
|
2015-07-01 19:51:20 +00:00
|
|
|
if (engine->priv->model)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&engine->priv->model_error, g_free);
|
|
|
|
_gtk_search_engine_start (engine->priv->model);
|
|
|
|
engine->priv->model_running = TRUE;
|
|
|
|
}
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
engine->priv->running = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
stop (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
if (engine->priv->native)
|
|
|
|
{
|
|
|
|
_gtk_search_engine_stop (engine->priv->native);
|
|
|
|
engine->priv->native_running = FALSE;
|
|
|
|
}
|
|
|
|
|
2015-07-01 19:51:20 +00:00
|
|
|
if (engine->priv->model)
|
|
|
|
{
|
|
|
|
_gtk_search_engine_stop (engine->priv->model);
|
|
|
|
engine->priv->model_running = FALSE;
|
|
|
|
}
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
engine->priv->running = FALSE;
|
|
|
|
|
|
|
|
g_hash_table_remove_all (engine->priv->hits);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkSearchEngine *engine = GTK_SEARCH_ENGINE (object);
|
|
|
|
|
|
|
|
g_clear_object (&engine->priv->native);
|
|
|
|
g_free (engine->priv->native_error);
|
|
|
|
|
2015-07-01 19:51:20 +00:00
|
|
|
g_clear_object (&engine->priv->model);
|
|
|
|
g_free (engine->priv->model_error);
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
g_clear_pointer (&engine->priv->hits, g_hash_table_unref);
|
|
|
|
|
2015-07-01 19:51:20 +00:00
|
|
|
g_clear_object (&engine->priv->query);
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
G_OBJECT_CLASS (_gtk_search_engine_parent_class)->finalize (object);
|
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_search_engine_class_init (GtkSearchEngineClass *class)
|
|
|
|
{
|
2015-05-01 19:34:08 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
|
|
|
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
|
|
|
class->set_query = set_query;
|
|
|
|
class->start = start;
|
|
|
|
class->stop = stop;
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
signals[HITS_ADDED] =
|
2015-09-12 13:13:00 +00:00
|
|
|
g_signal_new (I_("hits-added"),
|
2015-02-28 21:13:18 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkSearchEngineClass, hits_added),
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2015-02-28 21:13:18 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_POINTER);
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
signals[FINISHED] =
|
2015-09-12 13:13:00 +00:00
|
|
|
g_signal_new (I_("finished"),
|
2015-02-28 21:13:18 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkSearchEngineClass, finished),
|
|
|
|
NULL, NULL,
|
2019-05-29 20:05:19 +00:00
|
|
|
NULL,
|
2020-05-16 22:00:22 +00:00
|
|
|
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
signals[ERROR] =
|
2015-09-12 13:13:00 +00:00
|
|
|
g_signal_new (I_("error"),
|
2015-02-28 21:13:18 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkSearchEngineClass, error),
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2015-02-28 21:13:18 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_STRING);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_search_engine_init (GtkSearchEngine *engine)
|
|
|
|
{
|
2015-05-01 19:34:08 +00:00
|
|
|
engine->priv = _gtk_search_engine_get_instance_private (engine);
|
2015-06-19 04:06:14 +00:00
|
|
|
|
|
|
|
engine->priv->recursive = TRUE;
|
2015-05-01 19:34:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
hits_added (GtkSearchEngine *engine,
|
|
|
|
GList *hits,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GtkSearchEngine *composite = GTK_SEARCH_ENGINE (data);
|
|
|
|
GList *added, *l;
|
2015-06-18 18:31:02 +00:00
|
|
|
GtkSearchHit *hit;
|
2015-05-01 19:34:08 +00:00
|
|
|
|
|
|
|
added = NULL;
|
|
|
|
|
|
|
|
for (l = hits; l; l = l->next)
|
|
|
|
{
|
2015-06-18 18:31:02 +00:00
|
|
|
hit = l->data;
|
2015-05-01 19:34:08 +00:00
|
|
|
|
|
|
|
if (!g_hash_table_contains (composite->priv->hits, hit))
|
|
|
|
{
|
2015-06-18 18:31:02 +00:00
|
|
|
hit = _gtk_search_hit_dup (hit);
|
2015-05-01 19:34:08 +00:00
|
|
|
g_hash_table_add (composite->priv->hits, hit);
|
|
|
|
added = g_list_prepend (added, hit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (added)
|
|
|
|
{
|
|
|
|
_gtk_search_engine_hits_added (composite, added);
|
|
|
|
g_list_free (added);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_status (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
gboolean running;
|
|
|
|
|
2020-01-31 15:52:03 +00:00
|
|
|
running = engine->priv->native_running;
|
2015-05-01 19:34:08 +00:00
|
|
|
|
|
|
|
if (running != engine->priv->running)
|
|
|
|
{
|
|
|
|
engine->priv->running = running;
|
|
|
|
|
|
|
|
if (!running)
|
|
|
|
{
|
|
|
|
if (engine->priv->native_error)
|
|
|
|
_gtk_search_engine_error (engine, engine->priv->native_error);
|
2015-07-01 19:51:20 +00:00
|
|
|
else if (engine->priv->model_error)
|
|
|
|
_gtk_search_engine_error (engine, engine->priv->model_error);
|
2015-05-01 19:34:08 +00:00
|
|
|
else
|
2020-05-16 22:00:22 +00:00
|
|
|
_gtk_search_engine_finished (engine, engine->priv->got_results);
|
|
|
|
|
|
|
|
engine->priv->got_results = FALSE;
|
2015-05-01 19:34:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
finished (GtkSearchEngine *engine,
|
2020-05-16 22:00:22 +00:00
|
|
|
gboolean got_results,
|
2015-05-01 19:34:08 +00:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GtkSearchEngine *composite = GTK_SEARCH_ENGINE (data);
|
|
|
|
|
|
|
|
if (engine == composite->priv->native)
|
|
|
|
composite->priv->native_running = FALSE;
|
2015-07-01 19:51:20 +00:00
|
|
|
else if (engine == composite->priv->model)
|
|
|
|
composite->priv->model_running = FALSE;
|
2015-05-01 19:34:08 +00:00
|
|
|
|
2020-05-16 22:00:22 +00:00
|
|
|
composite->priv->got_results |= got_results;
|
2015-05-01 19:34:08 +00:00
|
|
|
update_status (composite);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
error (GtkSearchEngine *engine,
|
|
|
|
const gchar *message,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GtkSearchEngine *composite = GTK_SEARCH_ENGINE (data);
|
|
|
|
|
|
|
|
if (engine == composite->priv->native)
|
|
|
|
{
|
|
|
|
g_free (composite->priv->native_error);
|
|
|
|
composite->priv->native_error = g_strdup (message);
|
|
|
|
composite->priv->native_running = FALSE;
|
|
|
|
}
|
2015-07-01 19:51:20 +00:00
|
|
|
else if (engine == composite->priv->model)
|
|
|
|
{
|
|
|
|
g_free (composite->priv->model_error);
|
|
|
|
composite->priv->model_error = g_strdup (message);
|
|
|
|
composite->priv->model_running = FALSE;
|
|
|
|
}
|
2015-05-01 19:34:08 +00:00
|
|
|
|
|
|
|
update_status (composite);
|
|
|
|
}
|
|
|
|
|
2015-06-18 18:31:02 +00:00
|
|
|
static gboolean
|
|
|
|
search_hit_equal (gconstpointer a, gconstpointer b)
|
|
|
|
{
|
|
|
|
const GtkSearchHit *ha = (const GtkSearchHit *)a;
|
|
|
|
const GtkSearchHit *hb = (const GtkSearchHit *)b;
|
|
|
|
|
2015-07-24 04:40:59 +00:00
|
|
|
return g_file_equal (ha->file, hb->file);
|
2015-06-18 18:31:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static guint
|
|
|
|
search_hit_hash (gconstpointer a)
|
|
|
|
{
|
|
|
|
const GtkSearchHit *ha = (const GtkSearchHit *)a;
|
|
|
|
|
2015-07-24 04:40:59 +00:00
|
|
|
return g_file_hash (ha->file);
|
2015-06-18 18:31:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkSearchHit *
|
|
|
|
_gtk_search_hit_dup (GtkSearchHit *hit)
|
|
|
|
{
|
|
|
|
GtkSearchHit *dup;
|
|
|
|
|
|
|
|
dup = g_new (GtkSearchHit, 1);
|
2015-07-24 04:40:59 +00:00
|
|
|
dup->file = g_object_ref (hit->file);
|
2015-06-18 18:31:02 +00:00
|
|
|
if (hit->info)
|
|
|
|
dup->info = g_object_ref (hit->info);
|
|
|
|
else
|
|
|
|
dup->info = NULL;
|
|
|
|
|
|
|
|
return dup;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_search_hit_free (GtkSearchHit *hit)
|
|
|
|
{
|
2015-07-24 04:40:59 +00:00
|
|
|
g_clear_object (&hit->file);
|
2015-06-18 18:31:02 +00:00
|
|
|
g_clear_object (&hit->info);
|
|
|
|
g_free (hit);
|
|
|
|
}
|
|
|
|
|
2015-05-01 19:34:08 +00:00
|
|
|
static void
|
|
|
|
connect_engine_signals (GtkSearchEngine *engine,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2015-07-22 00:40:46 +00:00
|
|
|
g_signal_connect_object (engine, "hits-added", G_CALLBACK (hits_added), data, 0);
|
|
|
|
g_signal_connect_object (engine, "finished", G_CALLBACK (finished), data, 0);
|
|
|
|
g_signal_connect_object (engine, "error", G_CALLBACK (error), data, 0);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkSearchEngine *
|
|
|
|
_gtk_search_engine_new (void)
|
|
|
|
{
|
2015-05-01 19:34:08 +00:00
|
|
|
GtkSearchEngine *engine;
|
|
|
|
|
|
|
|
engine = g_object_new (GTK_TYPE_SEARCH_ENGINE, NULL);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2020-05-16 22:04:56 +00:00
|
|
|
#if defined(HAVE_TRACKER3)
|
|
|
|
engine->priv->native = gtk_search_engine_tracker3_new ();
|
|
|
|
if (engine->priv->native)
|
|
|
|
{
|
|
|
|
g_debug ("Using Tracker3 search engine");
|
|
|
|
connect_engine_signals (engine->priv->native, engine);
|
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
#endif
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-06-24 11:57:07 +00:00
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
2015-05-01 19:34:08 +00:00
|
|
|
engine->priv->native = _gtk_search_engine_quartz_new ();
|
|
|
|
if (engine->priv->native)
|
2015-02-14 05:57:29 +00:00
|
|
|
{
|
|
|
|
g_debug ("Using Quartz search engine");
|
2015-05-01 19:34:08 +00:00
|
|
|
connect_engine_signals (engine->priv->native, engine);
|
2015-02-14 05:57:29 +00:00
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
#endif
|
|
|
|
|
2015-06-18 18:31:02 +00:00
|
|
|
engine->priv->hits = g_hash_table_new_full (search_hit_hash, search_hit_equal,
|
|
|
|
(GDestroyNotify)_gtk_search_hit_free, NULL);
|
2015-02-14 05:57:29 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
return engine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-02-28 21:13:18 +00:00
|
|
|
_gtk_search_engine_set_query (GtkSearchEngine *engine,
|
|
|
|
GtkQuery *query)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
|
|
|
|
g_return_if_fail (GTK_SEARCH_ENGINE_GET_CLASS (engine)->set_query != NULL);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
GTK_SEARCH_ENGINE_GET_CLASS (engine)->set_query (engine, query);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_search_engine_start (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
|
|
|
|
g_return_if_fail (GTK_SEARCH_ENGINE_GET_CLASS (engine)->start != NULL);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
GTK_SEARCH_ENGINE_GET_CLASS (engine)->start (engine);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_search_engine_stop (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
|
|
|
|
g_return_if_fail (GTK_SEARCH_ENGINE_GET_CLASS (engine)->stop != NULL);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
GTK_SEARCH_ENGINE_GET_CLASS (engine)->stop (engine);
|
|
|
|
}
|
|
|
|
|
2015-02-28 21:13:18 +00:00
|
|
|
void
|
|
|
|
_gtk_search_engine_hits_added (GtkSearchEngine *engine,
|
|
|
|
GList *hits)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
g_signal_emit (engine, signals[HITS_ADDED], 0, hits);
|
|
|
|
}
|
|
|
|
|
2015-02-28 21:13:18 +00:00
|
|
|
void
|
2020-05-16 22:00:22 +00:00
|
|
|
_gtk_search_engine_finished (GtkSearchEngine *engine,
|
|
|
|
gboolean got_results)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2020-05-16 22:00:22 +00:00
|
|
|
g_signal_emit (engine, signals[FINISHED], 0, got_results);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-02-28 21:13:18 +00:00
|
|
|
_gtk_search_engine_error (GtkSearchEngine *engine,
|
|
|
|
const gchar *error_message)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
g_signal_emit (engine, signals[ERROR], 0, error_message);
|
|
|
|
}
|
2015-06-19 02:44:11 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_search_engine_set_recursive (GtkSearchEngine *engine,
|
|
|
|
gboolean recursive)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
|
|
|
|
|
|
|
|
g_assert (!engine->priv->running);
|
|
|
|
|
|
|
|
engine->priv->recursive = recursive;
|
|
|
|
|
|
|
|
if (engine->priv->native)
|
|
|
|
_gtk_search_engine_set_recursive (engine->priv->native, recursive);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_gtk_search_engine_get_recursive (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SEARCH_ENGINE (engine), TRUE);
|
|
|
|
|
|
|
|
return engine->priv->recursive;
|
|
|
|
}
|
2015-07-01 19:51:20 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_search_engine_set_model (GtkSearchEngine *engine,
|
|
|
|
GtkFileSystemModel *model)
|
|
|
|
{
|
|
|
|
g_clear_object (&engine->priv->model);
|
|
|
|
if (model)
|
|
|
|
{
|
|
|
|
engine->priv->model = _gtk_search_engine_model_new (model);
|
2015-07-24 19:44:20 +00:00
|
|
|
connect_engine_signals (engine->priv->model, engine);
|
2015-07-01 19:51:20 +00:00
|
|
|
if (engine->priv->query)
|
|
|
|
_gtk_search_engine_set_query (engine->priv->model, engine->priv->query);
|
|
|
|
}
|
|
|
|
}
|