2007-05-02 22:51:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005 Red Hat, 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: Alexander Larsson <alexl@redhat.com>
|
|
|
|
*
|
|
|
|
* Based on nautilus-search-engine-simple.c
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2007-05-14 15:35:37 +00:00
|
|
|
|
2015-04-30 17:46:27 +00:00
|
|
|
#include <gio/gio.h>
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2010-10-19 17:14:46 +00:00
|
|
|
#include <gdk/gdk.h>
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
#include "gtksearchenginesimple.h"
|
2015-07-24 19:52:37 +00:00
|
|
|
#include "gtkfilesystem.h"
|
2007-07-09 18:04:59 +00:00
|
|
|
#include "gtkprivate.h"
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
2007-05-13 21:21:39 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
#define BATCH_SIZE 500
|
|
|
|
|
2015-02-28 21:13:18 +00:00
|
|
|
typedef struct
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
|
|
|
GtkSearchEngineSimple *engine;
|
2015-05-16 04:37:07 +00:00
|
|
|
GCancellable *cancellable;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
GQueue *directories;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
gint n_processed_files;
|
2015-05-16 04:37:07 +00:00
|
|
|
GList *hits;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
GtkQuery *query;
|
2015-06-19 02:44:11 +00:00
|
|
|
gboolean recursive;
|
2007-05-02 22:51:43 +00:00
|
|
|
} SearchThreadData;
|
|
|
|
|
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
struct _GtkSearchEngineSimple
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
2015-06-19 04:48:29 +00:00
|
|
|
GtkSearchEngine parent;
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
GtkQuery *query;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
SearchThreadData *active_search;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
gboolean query_finished;
|
2015-06-19 04:11:01 +00:00
|
|
|
|
|
|
|
GtkSearchEngineSimpleIsIndexed is_indexed_callback;
|
|
|
|
gpointer is_indexed_data;
|
2015-06-19 04:32:49 +00:00
|
|
|
GDestroyNotify is_indexed_data_destroy;
|
2007-05-02 22:51:43 +00:00
|
|
|
};
|
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
struct _GtkSearchEngineSimpleClass
|
|
|
|
{
|
|
|
|
GtkSearchEngineClass parent_class;
|
|
|
|
};
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
G_DEFINE_TYPE (GtkSearchEngineSimple, _gtk_search_engine_simple, GTK_TYPE_SEARCH_ENGINE)
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
static void
|
2007-09-25 20:59:15 +00:00
|
|
|
gtk_search_engine_simple_dispose (GObject *object)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
2015-06-19 04:48:29 +00:00
|
|
|
GtkSearchEngineSimple *simple = GTK_SEARCH_ENGINE_SIMPLE (object);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
g_clear_object (&simple->query);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
if (simple->active_search)
|
2007-09-25 20:59:15 +00:00
|
|
|
{
|
2015-06-19 04:48:29 +00:00
|
|
|
g_cancellable_cancel (simple->active_search->cancellable);
|
|
|
|
simple->active_search = NULL;
|
2007-09-25 20:59:15 +00:00
|
|
|
}
|
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
_gtk_search_engine_simple_set_indexed_cb (simple, NULL, NULL, NULL);
|
2015-06-19 04:32:49 +00:00
|
|
|
|
2007-09-25 20:59:15 +00:00
|
|
|
G_OBJECT_CLASS (_gtk_search_engine_simple_parent_class)->dispose (object);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
2015-07-24 19:52:37 +00:00
|
|
|
static void
|
|
|
|
queue_if_local (SearchThreadData *data,
|
|
|
|
GFile *file)
|
|
|
|
{
|
|
|
|
if (!_gtk_file_consider_as_remote (file))
|
|
|
|
g_queue_push_tail (data->directories, g_object_ref (file));
|
|
|
|
}
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
static SearchThreadData *
|
|
|
|
search_thread_data_new (GtkSearchEngineSimple *engine,
|
|
|
|
GtkQuery *query)
|
|
|
|
{
|
|
|
|
SearchThreadData *data;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
data = g_new0 (SearchThreadData, 1);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-07-09 18:02:38 +00:00
|
|
|
data->engine = g_object_ref (engine);
|
2015-05-16 04:37:07 +00:00
|
|
|
data->directories = g_queue_new ();
|
|
|
|
data->query = g_object_ref (query);
|
2015-06-19 02:44:11 +00:00
|
|
|
data->recursive = _gtk_search_engine_get_recursive (GTK_SEARCH_ENGINE (engine));
|
2015-07-24 19:52:37 +00:00
|
|
|
queue_if_local (data, gtk_query_get_location (query));
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
data->cancellable = g_cancellable_new ();
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2015-02-28 21:13:18 +00:00
|
|
|
static void
|
2007-05-02 22:51:43 +00:00
|
|
|
search_thread_data_free (SearchThreadData *data)
|
|
|
|
{
|
2015-05-16 04:37:07 +00:00
|
|
|
g_queue_foreach (data->directories, (GFunc)g_object_unref, NULL);
|
|
|
|
g_queue_free (data->directories);
|
|
|
|
g_object_unref (data->cancellable);
|
|
|
|
g_object_unref (data->query);
|
2007-07-09 18:02:38 +00:00
|
|
|
g_object_unref (data->engine);
|
2015-05-16 04:37:07 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
g_free (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
search_thread_done_idle (gpointer user_data)
|
|
|
|
{
|
|
|
|
SearchThreadData *data;
|
|
|
|
|
|
|
|
data = user_data;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
if (!g_cancellable_is_cancelled (data->cancellable))
|
2007-09-25 20:59:15 +00:00
|
|
|
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (data->engine));
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
data->engine->active_search = NULL;
|
2007-05-02 22:51:43 +00:00
|
|
|
search_thread_data_free (data);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-02-28 21:13:18 +00:00
|
|
|
typedef struct
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
2015-06-18 18:31:02 +00:00
|
|
|
GList *hits;
|
2007-05-02 22:51:43 +00:00
|
|
|
SearchThreadData *thread_data;
|
2015-06-18 18:31:02 +00:00
|
|
|
} Batch;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
search_thread_add_hits_idle (gpointer user_data)
|
|
|
|
{
|
2015-06-18 18:31:02 +00:00
|
|
|
Batch *batch = user_data;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2015-06-18 18:31:02 +00:00
|
|
|
if (!g_cancellable_is_cancelled (batch->thread_data->cancellable))
|
|
|
|
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (batch->thread_data->engine), batch->hits);
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2015-06-18 18:31:02 +00:00
|
|
|
g_list_free_full (batch->hits, (GDestroyNotify)_gtk_search_hit_free);
|
|
|
|
g_free (batch);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
send_batch (SearchThreadData *data)
|
|
|
|
{
|
2015-06-18 18:31:02 +00:00
|
|
|
Batch *batch;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
data->n_processed_files = 0;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
if (data->hits)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
2014-03-22 11:44:01 +00:00
|
|
|
guint id;
|
|
|
|
|
2015-06-18 18:31:02 +00:00
|
|
|
batch = g_new (Batch, 1);
|
|
|
|
batch->hits = data->hits;
|
|
|
|
batch->thread_data = data;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-18 18:31:02 +00:00
|
|
|
id = gdk_threads_add_idle (search_thread_add_hits_idle, batch);
|
2014-03-22 11:44:01 +00:00
|
|
|
g_source_set_name_by_id (id, "[gtk+] search_thread_add_hits_idle");
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
2010-10-19 17:14:46 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
data->hits = NULL;
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
2015-06-19 04:11:01 +00:00
|
|
|
static gboolean
|
|
|
|
is_indexed (GtkSearchEngineSimple *engine,
|
|
|
|
GFile *location)
|
|
|
|
{
|
2015-06-19 04:48:29 +00:00
|
|
|
if (engine->is_indexed_callback)
|
2015-06-19 04:11:01 +00:00
|
|
|
{
|
2015-06-19 04:48:29 +00:00
|
|
|
if (engine->is_indexed_callback (location, engine->is_indexed_data))
|
2015-06-19 04:11:01 +00:00
|
|
|
{
|
|
|
|
gchar *uri = g_file_get_uri (location);
|
|
|
|
g_debug ("Simple search engine: Skipping indexed location: %s\n", uri);
|
|
|
|
g_free (uri);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-04-30 17:46:27 +00:00
|
|
|
static void
|
2015-05-16 04:37:07 +00:00
|
|
|
visit_directory (GFile *dir, SearchThreadData *data)
|
2015-04-30 17:46:27 +00:00
|
|
|
{
|
2015-05-16 04:37:07 +00:00
|
|
|
GFileEnumerator *enumerator;
|
|
|
|
GFileInfo *info;
|
|
|
|
GFile *child;
|
|
|
|
const gchar *display_name;
|
|
|
|
|
|
|
|
enumerator = g_file_enumerate_children (dir,
|
|
|
|
G_FILE_ATTRIBUTE_STANDARD_NAME ","
|
|
|
|
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
|
|
|
|
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
|
2015-06-18 18:37:23 +00:00
|
|
|
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN ","
|
|
|
|
G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP ","
|
|
|
|
G_FILE_ATTRIBUTE_STANDARD_SIZE ","
|
|
|
|
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
|
2015-06-27 05:07:32 +00:00
|
|
|
G_FILE_ATTRIBUTE_STANDARD_TARGET_URI ","
|
2015-07-01 21:04:17 +00:00
|
|
|
G_FILE_ATTRIBUTE_TIME_MODIFIED ","
|
2015-07-05 01:16:55 +00:00
|
|
|
G_FILE_ATTRIBUTE_TIME_ACCESS ","
|
2015-07-05 03:46:11 +00:00
|
|
|
G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME ","
|
2015-07-07 02:57:40 +00:00
|
|
|
G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH ","
|
2015-07-05 03:46:11 +00:00
|
|
|
G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE,
|
2015-05-16 04:37:07 +00:00
|
|
|
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
|
|
|
data->cancellable, NULL);
|
|
|
|
if (enumerator == NULL)
|
|
|
|
return;
|
2015-04-30 17:46:27 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
while (g_file_enumerator_iterate (enumerator, &info, &child, data->cancellable, NULL))
|
2015-04-30 17:46:27 +00:00
|
|
|
{
|
2015-05-16 04:37:07 +00:00
|
|
|
if (info == NULL)
|
|
|
|
break;
|
2015-04-30 17:46:27 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
display_name = g_file_info_get_display_name (info);
|
|
|
|
if (display_name == NULL)
|
|
|
|
continue;
|
2015-04-30 17:46:27 +00:00
|
|
|
|
|
|
|
if (g_file_info_get_is_hidden (info))
|
|
|
|
continue;
|
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
if (gtk_query_matches_string (data->query, display_name))
|
2015-06-18 18:31:02 +00:00
|
|
|
{
|
|
|
|
GtkSearchHit *hit;
|
|
|
|
|
|
|
|
hit = g_new (GtkSearchHit, 1);
|
2015-07-24 04:40:59 +00:00
|
|
|
hit->file = g_object_ref (child);
|
2015-06-18 18:31:02 +00:00
|
|
|
hit->info = g_object_ref (info);
|
|
|
|
data->hits = g_list_prepend (data->hits, hit);
|
|
|
|
}
|
2015-04-30 17:46:27 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
data->n_processed_files++;
|
|
|
|
if (data->n_processed_files > BATCH_SIZE)
|
|
|
|
send_batch (data);
|
2015-04-30 17:46:27 +00:00
|
|
|
|
2015-06-19 04:11:01 +00:00
|
|
|
if (data->recursive &&
|
|
|
|
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY &&
|
|
|
|
!is_indexed (data->engine, child))
|
2015-07-24 19:52:37 +00:00
|
|
|
queue_if_local (data, child);
|
2015-04-30 17:46:27 +00:00
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
g_object_unref (enumerator);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
2015-02-28 21:13:18 +00:00
|
|
|
static gpointer
|
2007-05-02 22:51:43 +00:00
|
|
|
search_thread_func (gpointer user_data)
|
|
|
|
{
|
|
|
|
SearchThreadData *data;
|
2015-05-16 04:37:07 +00:00
|
|
|
GFile *dir;
|
|
|
|
guint id;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
data = user_data;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
while (!g_cancellable_is_cancelled (data->cancellable) &&
|
|
|
|
(dir = g_queue_pop_head (data->directories)) != NULL)
|
|
|
|
{
|
|
|
|
visit_directory (dir, data);
|
|
|
|
g_object_unref (dir);
|
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2015-05-16 04:37:07 +00:00
|
|
|
if (!g_cancellable_is_cancelled (data->cancellable))
|
|
|
|
send_batch (data);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2014-03-22 11:44:01 +00:00
|
|
|
id = gdk_threads_add_idle (search_thread_done_idle, data);
|
|
|
|
g_source_set_name_by_id (id, "[gtk+] search_thread_done_idle");
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_search_engine_simple_start (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
GtkSearchEngineSimple *simple;
|
|
|
|
SearchThreadData *data;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
simple = GTK_SEARCH_ENGINE_SIMPLE (engine);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
if (simple->active_search != NULL)
|
2007-05-02 22:51:43 +00:00
|
|
|
return;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
if (simple->query == NULL)
|
2007-05-02 22:51:43 +00:00
|
|
|
return;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
data = search_thread_data_new (simple, simple->query);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2011-11-02 01:06:09 +00:00
|
|
|
g_thread_unref (g_thread_new ("file-search", search_thread_func, data));
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
simple->active_search = data;
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_search_engine_simple_stop (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
GtkSearchEngineSimple *simple;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
simple = GTK_SEARCH_ENGINE_SIMPLE (engine);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
if (simple->active_search != NULL)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
2015-06-19 04:48:29 +00:00
|
|
|
g_cancellable_cancel (simple->active_search->cancellable);
|
|
|
|
simple->active_search = NULL;
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-02-28 21:13:18 +00:00
|
|
|
gtk_search_engine_simple_set_query (GtkSearchEngine *engine,
|
2007-05-02 22:51:43 +00:00
|
|
|
GtkQuery *query)
|
|
|
|
{
|
|
|
|
GtkSearchEngineSimple *simple;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
simple = GTK_SEARCH_ENGINE_SIMPLE (engine);
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
if (query)
|
|
|
|
g_object_ref (query);
|
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
if (simple->query)
|
|
|
|
g_object_unref (simple->query);
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
simple->query = query;
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_search_engine_simple_class_init (GtkSearchEngineSimpleClass *class)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GtkSearchEngineClass *engine_class;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (class);
|
2007-09-25 20:59:15 +00:00
|
|
|
gobject_class->dispose = gtk_search_engine_simple_dispose;
|
2015-02-28 21:13:18 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
engine_class = GTK_SEARCH_ENGINE_CLASS (class);
|
|
|
|
engine_class->set_query = gtk_search_engine_simple_set_query;
|
|
|
|
engine_class->start = gtk_search_engine_simple_start;
|
|
|
|
engine_class->stop = gtk_search_engine_simple_stop;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_search_engine_simple_init (GtkSearchEngineSimple *engine)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkSearchEngine *
|
|
|
|
_gtk_search_engine_simple_new (void)
|
|
|
|
{
|
2007-05-13 21:21:39 +00:00
|
|
|
return g_object_new (GTK_TYPE_SEARCH_ENGINE_SIMPLE, NULL);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
2015-06-19 04:11:01 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_search_engine_simple_set_indexed_cb (GtkSearchEngineSimple *engine,
|
|
|
|
GtkSearchEngineSimpleIsIndexed callback,
|
2015-06-19 04:32:49 +00:00
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify destroy)
|
2015-06-19 04:11:01 +00:00
|
|
|
{
|
2015-06-19 04:48:29 +00:00
|
|
|
if (engine->is_indexed_data_destroy)
|
|
|
|
engine->is_indexed_data_destroy (engine->is_indexed_data);
|
2015-06-19 04:32:49 +00:00
|
|
|
|
2015-06-19 04:48:29 +00:00
|
|
|
engine->is_indexed_callback = callback;
|
|
|
|
engine->is_indexed_data = data;
|
|
|
|
engine->is_indexed_data_destroy = destroy;
|
2015-06-19 04:11:01 +00:00
|
|
|
}
|