2007-05-02 22:51:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005 Mr Jamie McCracken
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
*
|
|
|
|
* Author: Jamie McCracken <jamiemcc@gnome.org>
|
|
|
|
*
|
|
|
|
* Based on nautilus-search-engine-tracker.c
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2007-05-02 22:51:43 +00:00
|
|
|
#include <gmodule.h>
|
|
|
|
#include "gtksearchenginetracker.h"
|
|
|
|
|
2007-06-22 14:32:22 +00:00
|
|
|
/* we dlopen() libtracker at runtime */
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
typedef struct _TrackerClient TrackerClient;
|
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TRACKER_0_6 = 1 << 0,
|
2010-03-19 13:40:11 +00:00
|
|
|
TRACKER_0_7 = 1 << 1,
|
|
|
|
TRACKER_0_8 = 1 << 2
|
2009-09-30 04:43:51 +00:00
|
|
|
} TrackerVersion;
|
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
|
|
|
|
/* tracker 0.6 API */
|
2007-05-02 22:51:43 +00:00
|
|
|
typedef void (*TrackerArrayReply) (char **result, GError *error, gpointer user_data);
|
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
static TrackerClient * (*tracker_connect) (gboolean enable_warnings, gint timeout) = NULL;
|
2007-05-02 22:51:43 +00:00
|
|
|
static void (*tracker_disconnect) (TrackerClient *client) = NULL;
|
2008-05-25 14:19:16 +00:00
|
|
|
static int (*tracker_get_version) (TrackerClient *client, GError **error) = NULL;
|
2007-05-02 22:51:43 +00:00
|
|
|
static void (*tracker_cancel_last_call) (TrackerClient *client) = NULL;
|
|
|
|
|
|
|
|
static void (*tracker_search_metadata_by_text_async) (TrackerClient *client,
|
|
|
|
const char *query,
|
|
|
|
TrackerArrayReply callback,
|
|
|
|
gpointer user_data) = NULL;
|
|
|
|
static void (*tracker_search_metadata_by_text_and_location_async) (TrackerClient *client,
|
|
|
|
const char *query,
|
|
|
|
const char *location,
|
|
|
|
TrackerArrayReply callback,
|
|
|
|
gpointer user_data) = NULL;
|
2010-03-19 13:40:11 +00:00
|
|
|
/* tracker 0.8 API */
|
|
|
|
typedef enum {
|
|
|
|
TRACKER_CLIENT_ENABLE_WARNINGS = 1 << 0
|
|
|
|
} TrackerClientFlags;
|
|
|
|
|
|
|
|
typedef void (*TrackerReplyGPtrArray) (GPtrArray *result,
|
|
|
|
GError *error,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
static TrackerClient * (*tracker_client_new) (TrackerClientFlags flags,
|
|
|
|
gint timeout) = NULL;
|
|
|
|
static gchar * (*tracker_sparql_escape) (const gchar *str) = NULL;
|
|
|
|
static guint (*tracker_resources_sparql_query_async) (TrackerClient *client,
|
|
|
|
const gchar *query,
|
|
|
|
TrackerReplyGPtrArray callback,
|
|
|
|
gpointer user_data) = NULL;
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
static struct TrackerDlMapping
|
|
|
|
{
|
|
|
|
const char *fn_name;
|
|
|
|
gpointer *fn_ptr_ref;
|
2009-09-30 04:43:51 +00:00
|
|
|
TrackerVersion versions;
|
2007-05-02 22:51:43 +00:00
|
|
|
} tracker_dl_mapping[] =
|
|
|
|
{
|
2009-09-30 04:43:51 +00:00
|
|
|
#define MAP(a,v) { #a, (gpointer *)&a, v }
|
|
|
|
MAP (tracker_connect, TRACKER_0_6 | TRACKER_0_7),
|
|
|
|
MAP (tracker_disconnect, TRACKER_0_6 | TRACKER_0_7),
|
|
|
|
MAP (tracker_get_version, TRACKER_0_6),
|
2010-03-19 13:40:11 +00:00
|
|
|
MAP (tracker_cancel_last_call, TRACKER_0_6 | TRACKER_0_7 | TRACKER_0_8),
|
2009-09-30 04:43:51 +00:00
|
|
|
MAP (tracker_search_metadata_by_text_async, TRACKER_0_6 | TRACKER_0_7),
|
|
|
|
MAP (tracker_search_metadata_by_text_and_location_async, TRACKER_0_6 | TRACKER_0_7),
|
2010-03-19 13:40:11 +00:00
|
|
|
MAP (tracker_client_new, TRACKER_0_8),
|
|
|
|
MAP (tracker_sparql_escape, TRACKER_0_8),
|
|
|
|
MAP (tracker_resources_sparql_query_async, TRACKER_0_8)
|
2007-05-02 22:51:43 +00:00
|
|
|
#undef MAP
|
|
|
|
};
|
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
static TrackerVersion
|
2007-05-02 22:51:43 +00:00
|
|
|
open_libtracker (void)
|
|
|
|
{
|
|
|
|
static gboolean done = FALSE;
|
2009-09-30 04:43:51 +00:00
|
|
|
static TrackerVersion version = 0;
|
2010-03-19 13:40:11 +00:00
|
|
|
gpointer x;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
if (!done)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
GModule *tracker;
|
2007-09-18 21:48:01 +00:00
|
|
|
GModuleFlags flags;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
done = TRUE;
|
2007-09-18 21:48:01 +00:00
|
|
|
flags = G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL;
|
|
|
|
|
2010-04-07 13:02:18 +00:00
|
|
|
tracker = g_module_open ("libtracker-client-0.8.so.0", flags);
|
|
|
|
version = TRACKER_0_8;
|
2009-09-30 04:43:51 +00:00
|
|
|
|
2010-04-07 13:02:18 +00:00
|
|
|
if (!tracker)
|
2010-03-19 13:40:11 +00:00
|
|
|
{
|
2010-04-07 13:02:18 +00:00
|
|
|
tracker = g_module_open ("libtracker-client-0.7.so.0", flags);
|
|
|
|
|
|
|
|
if (tracker && !g_module_symbol (tracker, "tracker_resources_sparql_query_async", &x))
|
|
|
|
{
|
|
|
|
version = TRACKER_0_7;
|
|
|
|
}
|
2010-03-19 13:40:11 +00:00
|
|
|
}
|
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
if (!tracker)
|
|
|
|
{
|
|
|
|
tracker = g_module_open ("libtrackerclient.so.0", flags);
|
|
|
|
version = TRACKER_0_6;
|
|
|
|
}
|
2007-09-18 21:48:01 +00:00
|
|
|
|
|
|
|
if (!tracker)
|
2009-09-30 04:43:51 +00:00
|
|
|
{
|
|
|
|
tracker = g_module_open ("libtracker.so.0", flags);
|
|
|
|
version = TRACKER_0_6;
|
|
|
|
}
|
2007-09-18 21:48:01 +00:00
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
if (!tracker)
|
2009-09-30 04:43:51 +00:00
|
|
|
return 0;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (tracker_dl_mapping); i++)
|
|
|
|
{
|
2009-09-30 04:43:51 +00:00
|
|
|
if ((tracker_dl_mapping[i].versions & version) == 0)
|
|
|
|
continue;
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
if (!g_module_symbol (tracker, tracker_dl_mapping[i].fn_name,
|
|
|
|
tracker_dl_mapping[i].fn_ptr_ref))
|
|
|
|
{
|
|
|
|
g_warning ("Missing symbol '%s' in libtracker\n",
|
|
|
|
tracker_dl_mapping[i].fn_name);
|
|
|
|
g_module_close (tracker);
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (tracker_dl_mapping); i++)
|
|
|
|
tracker_dl_mapping[i].fn_ptr_ref = NULL;
|
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
return 0;
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-30 04:43:51 +00:00
|
|
|
|
|
|
|
return version;
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct _GtkSearchEngineTrackerPrivate
|
|
|
|
{
|
|
|
|
GtkQuery *query;
|
|
|
|
TrackerClient *client;
|
|
|
|
gboolean query_pending;
|
2009-09-30 04:43:51 +00:00
|
|
|
TrackerVersion version;
|
2007-05-02 22:51:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GtkSearchEngineTracker, _gtk_search_engine_tracker, GTK_TYPE_SEARCH_ENGINE);
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkSearchEngineTracker *tracker;
|
|
|
|
|
|
|
|
tracker = GTK_SEARCH_ENGINE_TRACKER (object);
|
|
|
|
|
|
|
|
if (tracker->priv->query)
|
|
|
|
{
|
|
|
|
g_object_unref (tracker->priv->query);
|
|
|
|
tracker->priv->query = NULL;
|
|
|
|
}
|
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
if (tracker->priv->version == TRACKER_0_8)
|
|
|
|
g_object_unref (tracker->priv->client);
|
|
|
|
else
|
|
|
|
tracker_disconnect (tracker->priv->client);
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (_gtk_search_engine_tracker_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
/* stolen from tracker sources, tracker.c */
|
|
|
|
static void
|
|
|
|
sparql_append_string_literal (GString *sparql,
|
|
|
|
const gchar *str)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
s = tracker_sparql_escape (str);
|
|
|
|
|
|
|
|
g_string_append_c (sparql, '"');
|
|
|
|
g_string_append (sparql, s);
|
|
|
|
g_string_append_c (sparql, '"');
|
|
|
|
|
|
|
|
g_free (s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
static void
|
2010-03-19 13:40:11 +00:00
|
|
|
search_callback (gpointer results,
|
2007-05-02 22:51:43 +00:00
|
|
|
GError *error,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkSearchEngineTracker *tracker;
|
|
|
|
gchar **results_p;
|
|
|
|
GList *hit_uris;
|
2010-03-19 13:40:11 +00:00
|
|
|
GPtrArray *OUT_result;
|
|
|
|
gchar *uri;
|
|
|
|
gint i;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
tracker = GTK_SEARCH_ENGINE_TRACKER (user_data);
|
|
|
|
hit_uris = NULL;
|
|
|
|
|
|
|
|
tracker->priv->query_pending = FALSE;
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
{
|
2010-03-19 13:40:11 +00:00
|
|
|
_gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message);
|
2007-05-02 22:51:43 +00:00
|
|
|
g_error_free (error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!results)
|
|
|
|
return;
|
2010-03-19 13:40:11 +00:00
|
|
|
|
|
|
|
if (tracker->priv->version == TRACKER_0_8)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
2010-03-19 13:40:11 +00:00
|
|
|
OUT_result = (GPtrArray*) results;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
for (i = 0; i < OUT_result->len; i++)
|
|
|
|
{
|
|
|
|
uri = g_strdup (((gchar **) OUT_result->pdata[i])[0]);
|
|
|
|
if (uri)
|
|
|
|
hit_uris = g_list_prepend (hit_uris, uri);
|
|
|
|
}
|
2009-09-30 04:43:51 +00:00
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
g_ptr_array_foreach (OUT_result, (GFunc) g_free, NULL);
|
|
|
|
g_ptr_array_free (OUT_result, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (results_p = results; *results_p; results_p++)
|
|
|
|
{
|
|
|
|
if (tracker->priv->version == TRACKER_0_6)
|
|
|
|
uri = g_filename_to_uri (*results_p, NULL, NULL);
|
|
|
|
else
|
|
|
|
uri = g_strdup (*results_p);
|
|
|
|
|
|
|
|
if (uri)
|
|
|
|
hit_uris = g_list_prepend (hit_uris, uri);
|
|
|
|
}
|
|
|
|
g_strfreev ((gchar **) results);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (tracker), hit_uris);
|
|
|
|
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (tracker));
|
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
g_list_foreach (hit_uris, (GFunc) g_free, NULL);
|
2007-05-02 22:51:43 +00:00
|
|
|
g_list_free (hit_uris);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_search_engine_tracker_start (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
GtkSearchEngineTracker *tracker;
|
2007-06-22 14:32:22 +00:00
|
|
|
gchar *search_text, *location, *location_uri;
|
2010-03-19 13:40:11 +00:00
|
|
|
GString *sparql;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
|
|
|
|
|
|
|
if (tracker->priv->query_pending)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (tracker->priv->query == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
search_text = _gtk_query_get_text (tracker->priv->query);
|
|
|
|
location_uri = _gtk_query_get_location (tracker->priv->query);
|
2007-06-22 14:32:22 +00:00
|
|
|
|
|
|
|
location = NULL;
|
2007-05-02 22:51:43 +00:00
|
|
|
if (location_uri)
|
|
|
|
{
|
2009-09-30 04:43:51 +00:00
|
|
|
if (tracker->priv->version == TRACKER_0_6)
|
|
|
|
{
|
|
|
|
location = g_filename_from_uri (location_uri, NULL, NULL);
|
|
|
|
g_free (location_uri);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
location = location_uri;
|
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
if (tracker->priv->version == TRACKER_0_8)
|
2007-05-02 22:51:43 +00:00
|
|
|
{
|
2010-03-19 13:40:11 +00:00
|
|
|
sparql = g_string_new ("SELECT ?url WHERE { ?file a nfo:FileDataObject; nie:url ?url; fts:match ");
|
|
|
|
sparql_append_string_literal (sparql, search_text);
|
|
|
|
if (location)
|
|
|
|
{
|
|
|
|
g_string_append (sparql, " . FILTER (fn:starts-with(?url,");
|
|
|
|
sparql_append_string_literal (sparql, location);
|
|
|
|
g_string_append (sparql, "))");
|
|
|
|
}
|
|
|
|
g_string_append (sparql, " }");
|
|
|
|
|
|
|
|
tracker_resources_sparql_query_async (tracker->priv->client,
|
|
|
|
sparql->str,
|
|
|
|
(TrackerReplyGPtrArray) search_callback,
|
|
|
|
tracker);
|
|
|
|
g_string_free (sparql, TRUE);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-03-19 13:40:11 +00:00
|
|
|
if (location)
|
|
|
|
{
|
|
|
|
tracker_search_metadata_by_text_and_location_async (tracker->priv->client,
|
|
|
|
search_text,
|
|
|
|
location,
|
|
|
|
(TrackerArrayReply) search_callback,
|
|
|
|
tracker);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tracker_search_metadata_by_text_async (tracker->priv->client,
|
|
|
|
search_text,
|
|
|
|
(TrackerArrayReply) search_callback,
|
|
|
|
tracker);
|
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tracker->priv->query_pending = TRUE;
|
|
|
|
g_free (search_text);
|
2010-03-19 13:40:11 +00:00
|
|
|
g_free (location);
|
2007-05-02 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_search_engine_tracker_stop (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
GtkSearchEngineTracker *tracker;
|
|
|
|
|
|
|
|
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
|
|
|
|
|
|
|
if (tracker->priv->query && tracker->priv->query_pending)
|
|
|
|
{
|
|
|
|
tracker_cancel_last_call (tracker->priv->client);
|
|
|
|
tracker->priv->query_pending = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_search_engine_tracker_is_indexed (GtkSearchEngine *engine)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_search_engine_tracker_set_query (GtkSearchEngine *engine,
|
|
|
|
GtkQuery *query)
|
|
|
|
{
|
|
|
|
GtkSearchEngineTracker *tracker;
|
|
|
|
|
|
|
|
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
|
|
|
|
|
|
|
|
if (query)
|
|
|
|
g_object_ref (query);
|
|
|
|
|
|
|
|
if (tracker->priv->query)
|
|
|
|
g_object_unref (tracker->priv->query);
|
|
|
|
|
|
|
|
tracker->priv->query = query;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_search_engine_tracker_class_init (GtkSearchEngineTrackerClass *class)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GtkSearchEngineClass *engine_class;
|
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (class);
|
|
|
|
gobject_class->finalize = finalize;
|
|
|
|
|
|
|
|
engine_class = GTK_SEARCH_ENGINE_CLASS (class);
|
|
|
|
engine_class->set_query = gtk_search_engine_tracker_set_query;
|
|
|
|
engine_class->start = gtk_search_engine_tracker_start;
|
|
|
|
engine_class->stop = gtk_search_engine_tracker_stop;
|
|
|
|
engine_class->is_indexed = gtk_search_engine_tracker_is_indexed;
|
|
|
|
|
|
|
|
g_type_class_add_private (gobject_class, sizeof (GtkSearchEngineTrackerPrivate));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gtk_search_engine_tracker_init (GtkSearchEngineTracker *engine)
|
|
|
|
{
|
|
|
|
engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine, GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTrackerPrivate);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GtkSearchEngine *
|
|
|
|
_gtk_search_engine_tracker_new (void)
|
|
|
|
{
|
|
|
|
GtkSearchEngineTracker *engine;
|
|
|
|
TrackerClient *tracker_client;
|
2009-09-30 04:43:51 +00:00
|
|
|
TrackerVersion version;
|
2008-05-25 14:19:16 +00:00
|
|
|
GError *err = NULL;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
version = open_libtracker ();
|
2007-05-02 22:51:43 +00:00
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
if (version == TRACKER_0_8)
|
|
|
|
{
|
|
|
|
tracker_client = tracker_client_new (TRACKER_CLIENT_ENABLE_WARNINGS, G_MAXINT);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!tracker_connect)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
tracker_client = tracker_connect (FALSE, -1);
|
|
|
|
}
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
if (!tracker_client)
|
|
|
|
return NULL;
|
|
|
|
|
2010-03-19 13:40:11 +00:00
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
if (version == TRACKER_0_6)
|
|
|
|
{
|
|
|
|
if (!tracker_get_version)
|
|
|
|
return NULL;
|
2008-05-25 14:19:16 +00:00
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
tracker_get_version (tracker_client, &err);
|
2008-05-25 14:19:16 +00:00
|
|
|
|
2009-09-30 04:43:51 +00:00
|
|
|
if (err != NULL)
|
|
|
|
{
|
|
|
|
g_error_free (err);
|
|
|
|
tracker_disconnect (tracker_client);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-05-25 14:19:16 +00:00
|
|
|
}
|
|
|
|
|
2007-05-02 22:51:43 +00:00
|
|
|
engine = g_object_new (GTK_TYPE_SEARCH_ENGINE_TRACKER, NULL);
|
|
|
|
|
|
|
|
engine->priv->client = tracker_client;
|
|
|
|
engine->priv->query_pending = FALSE;
|
2009-09-30 04:43:51 +00:00
|
|
|
engine->priv->version = version;
|
2007-05-02 22:51:43 +00:00
|
|
|
|
|
|
|
return GTK_SEARCH_ENGINE (engine);
|
|
|
|
}
|