[tracker/tracker-0.8] Revert "plugins/evolution: Make it possible to compile the evolution plugin, not working yet"
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.8] Revert "plugins/evolution: Make it possible to compile the evolution plugin, not working yet"
- Date: Thu, 19 Aug 2010 16:13:52 +0000 (UTC)
commit 67e7f5b5aa4386449ecdc685ba7238c8791b2fd5
Author: Martyn Russell <martyn lanedo com>
Date: Thu Aug 19 13:01:46 2010 +0100
Revert "plugins/evolution: Make it possible to compile the evolution plugin, not working yet"
This reverts commit b997f5c4780b03dbf7c30d0629e856e36e87781c.
src/plugins/evolution/Makefile.am | 4 +-
src/plugins/evolution/tracker-evolution-plugin.c | 179 ++++++++++------------
2 files changed, 86 insertions(+), 97 deletions(-)
---
diff --git a/src/plugins/evolution/Makefile.am b/src/plugins/evolution/Makefile.am
index 02e8b3e..7db1433 100644
--- a/src/plugins/evolution/Makefile.am
+++ b/src/plugins/evolution/Makefile.am
@@ -7,7 +7,7 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"Tracker\" \
-DTRACKER_COMPILATION \
-I$(top_builddir)/src \
- -I$(top_builddir)/src/libtracker-sparql \
+ -I$(top_builddir)/src/libtracker-client \
$(WARN_CFLAGS) \
$(DBUS_CFLAGS) \
$(EVOLUTION_PLUGIN_CFLAGS) \
@@ -36,7 +36,7 @@ liborg_freedesktop_Tracker_evolution_plugin_la_SOURCES = \
liborg_freedesktop_Tracker_evolution_plugin_la_LDFLAGS = -module -avoid-version
liborg_freedesktop_Tracker_evolution_plugin_la_LIBADD = \
- $(top_builddir)/src/libtracker-sparql/libtracker-sparql- TRACKER_API_VERSION@.la \
+ $(top_builddir)/src/libtracker-client/libtracker-client- TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-miner/libtracker-miner- TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(EVOLUTION_PLUGIN_LIBS) \
diff --git a/src/plugins/evolution/tracker-evolution-plugin.c b/src/plugins/evolution/tracker-evolution-plugin.c
index d3a4ca7..8e56d8d 100644
--- a/src/plugins/evolution/tracker-evolution-plugin.c
+++ b/src/plugins/evolution/tracker-evolution-plugin.c
@@ -57,7 +57,8 @@
#include <e-util/e-account-utils.h>
#endif
-#include <libtracker-sparql/tracker-sparql.h>
+#include <libtracker-client/tracker.h>
+#include <libtracker-client/tracker-sparql-builder.h>
#include <libtracker-common/tracker-date-time.h>
#include <libtracker-common/tracker-ontologies.h>
@@ -77,7 +78,7 @@
* reads, never writes). We hope that's sufficient for not having to get our
* code involved in Camel's cruel inneryard of having to lock the db_r ptr. */
-#define TRACKER_SERVICE "org.freedesktop.Tracker1"
+#define TRACKER_SERVICE "org.freedesktop.Tracker1"
#define NIE_DATASOURCE TRACKER_NIE_PREFIX "DataSource"
#define RDF_PREFIX TRACKER_RDF_PREFIX
@@ -106,7 +107,7 @@ G_DEFINE_TYPE (TrackerEvolutionPlugin, tracker_evolution_plugin, TRACKER_TYPE_MI
* during registration of accounts and folders). I know this is cruel. I know. */
typedef struct {
- TrackerSparqlConnection *connection;
+ TrackerClient *client;
gchar *sparql;
gboolean commit;
gint prio;
@@ -168,9 +169,9 @@ typedef struct {
GHashTable *registered_stores;
GList *registered_clients;
EAccountList *accounts;
- TrackerSparqlConnection *connection;
+ TrackerClient *client;
DBusGProxy *dbus_proxy;
- DBusGConnection *dbusconnection;
+ DBusGConnection *connection;
time_t last_time;
gboolean resuming, paused;
guint total_popped, of_total;
@@ -326,7 +327,7 @@ free_pool_item (gpointer data, gpointer user_data)
{
PoolItem *item = data;
g_free (item->sparql);
- g_object_unref (item->connection);
+ g_object_unref (item->client);
g_slice_free (PoolItem, item);
}
@@ -351,21 +352,15 @@ thread_pool_exec (gpointer data, gpointer user_data)
pool->freeup (data, pool->cancel);
}
-static void
-reply_void (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+
+static void
+reply_void (GError *error, gpointer user_data)
{
PoolItem *item = user_data;
ThreadPool *pool = item->pool;
- GError *error = NULL;
-
- tracker_sparql_connection_update_finish (TRACKER_SPARQL_CONNECTION (source_object),
- result, &error);
if (error) {
g_debug ("Tracker plugin: Error updating data: %s\n", error->message);
- g_error_free (error);
}
g_mutex_lock (item->mutex);
@@ -392,15 +387,10 @@ exec_update (gpointer data, gpointer user_data)
item->has_happened = FALSE;
if (item->commit) {
- /* tracker_resources_batch_commit_async (item->client, reply_void, item); */
+ tracker_resources_batch_commit_async (item->client, reply_void, item);
} else {
-
- tracker_sparql_connection_update_async (item->connection,
- item->sparql,
- G_PRIORITY_DEFAULT,
- NULL,
- reply_void, item);
-
+ tracker_resources_batch_sparql_update_async (item->client, item->sparql,
+ reply_void, item);
}
g_mutex_lock (item->mutex);
@@ -491,7 +481,7 @@ send_sparql_update (TrackerEvolutionPlugin *self, const gchar *sparql, gint prio
{
TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (self);
- if (priv->connection) {
+ if (priv->client) {
PoolItem *item = g_slice_new (PoolItem);
if (!sparql_pool)
@@ -501,7 +491,7 @@ send_sparql_update (TrackerEvolutionPlugin *self, const gchar *sparql, gint prio
item->dont_free = FALSE;
item->prio = prio;
item->commit = FALSE;
- item->connection = g_object_ref (priv->connection);
+ item->client = g_object_ref (priv->client);
item->sparql = g_strdup (sparql);
thread_pool_push (sparql_pool, item, NULL);
@@ -513,7 +503,7 @@ send_sparql_commit (TrackerEvolutionPlugin *self, gboolean update)
{
TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (self);
- if (priv->connection) {
+ if (priv->client) {
PoolItem *item = g_slice_new (PoolItem);
if (update) {
@@ -536,7 +526,7 @@ send_sparql_commit (TrackerEvolutionPlugin *self, gboolean update)
item->dont_free = FALSE;
item->prio = 0;
item->commit = TRUE;
- item->connection = g_object_ref (priv->connection);
+ item->client = g_object_ref (priv->client);
item->sparql = NULL;
thread_pool_push (sparql_pool, item, NULL);
@@ -550,7 +540,7 @@ add_contact (TrackerSparqlBuilder *sparql, const gchar *predicate, const gchar *
get_email_and_fullname (value, &email, &fullname);
- email_uri = tracker_sparql_escape_uri_printf ("mailto:%s", email);
+ email_uri = tracker_uri_printf_escaped ("mailto:%s", email);
tracker_sparql_builder_subject_iri (sparql, email_uri);
tracker_sparql_builder_predicate (sparql, "rdf:type");
@@ -835,10 +825,10 @@ on_folder_summary_changed (CamelFolder *folder,
/* This is not a path but a URI, don't use the
* OS's directory separator here */
- uri = tracker_sparql_escape_uri_printf ("%s/%s/%s",
- em_uri,
- camel_folder_get_full_name (folder),
- uid);
+ uri = tracker_uri_printf_escaped ("%s/%s/%s",
+ em_uri,
+ camel_folder_get_full_name (folder),
+ uid);
sparql = tracker_sparql_builder_new_update ();
@@ -920,10 +910,10 @@ on_folder_summary_changed (CamelFolder *folder,
/* This is not a path but a URI, don't use the OS's
* directory separator here */
- uri = tracker_sparql_escape_uri_printf ("%s/%s/%s",
- em_uri,
- camel_folder_get_full_name (folder),
- (char*) changes->uid_removed->pdata[i]);
+ uri = tracker_uri_printf_escaped ("%s/%s/%s",
+ em_uri,
+ camel_folder_get_full_name (folder),
+ (char*) changes->uid_removed->pdata[i]);
g_string_append_printf (sparql, "DELETE FROM <%s> { <%s> a rdfs:Resource }\n ", uri, uri);
g_free (uri);
@@ -1040,7 +1030,7 @@ introduce_walk_folders_in_folder (TrackerEvolutionPlugin *self,
folder = g_hash_table_lookup (priv->cached_folders, iter->full_name);
- uri = tracker_sparql_escape_uri_printf ("%s/%s/%s", em_uri, iter->full_name, uid);
+ uri = tracker_uri_printf_escaped ("%s/%s/%s", em_uri, iter->full_name, uid);
if (!sparql) {
sparql = tracker_sparql_builder_new_update ();
@@ -1209,8 +1199,8 @@ introduce_store_deal_with_deleted (TrackerEvolutionPlugin *self,
* directory separator here */
g_ptr_array_add (subjects_a,
- tracker_sparql_escape_uri_printf ("%s/%s/%s", em_uri,
- mailbox, uid));
+ tracker_uri_printf_escaped ("%s/%s/%s", em_uri,
+ mailbox, uid));
if (count > 100) {
more = TRUE;
@@ -1734,57 +1724,57 @@ register_client_second_half (ClientRegistry *info)
}
static void
-on_register_client_qry (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+on_register_client_qry (GPtrArray *results,
+ GError *error,
+ gpointer user_data)
{
- TrackerSparqlCursor *cursor;
ClientRegistry *info = user_data;
TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (info->self);
- GError *error = NULL;
-
- cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (source_object),
- res, &error);
+ guint i;
if (error) {
g_warning ("%s\n", error->message);
g_error_free (error);
g_slice_free (ClientRegistry, info);
- if (cursor) {
- //g_object_unref (cursor);
- }
return;
}
- if (!tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+ if (!results) {
if (priv->resuming) {
info->last_checkout = priv->last_time;
- } else if (priv->resuming && priv->last_time != 0) {
- info->last_checkout = priv->last_time;
} else {
info->last_checkout = 0;
}
} else {
- do {
- const gchar *str = tracker_sparql_cursor_get_string (cursor, 0, NULL);
- GError *new_error = NULL;
-
- info->last_checkout = (guint64) tracker_string_to_date (str, NULL, &new_error);
+ if (results->len == 0 && priv->resuming && priv->last_time != 0) {
+ info->last_checkout = priv->last_time;
+ } else {
+ if (results->len == 0) {
+ info->last_checkout = 0;
+ } else {
+ for (i = 0; i < results->len; i++) {
+ const gchar **str = g_ptr_array_index (results, i);
+ GError *new_error = NULL;
+
+ info->last_checkout = (guint64) tracker_string_to_date (str[0], NULL, &new_error);
+
+ if (new_error) {
+ g_warning ("%s", new_error->message);
+ g_error_free (error);
+ g_ptr_array_foreach (results, (GFunc) g_strfreev, NULL);
+ g_ptr_array_free (results, TRUE);
+ return;
+ }
- if (new_error) {
- g_warning ("%s", new_error->message);
- g_error_free (error);
- //g_object_unref (cursor);
- return;
+ break;
+ }
}
-
- break;
- } while (tracker_sparql_cursor_next (cursor, NULL, NULL));
+ }
+ g_ptr_array_foreach (results, (GFunc) g_strfreev, NULL);
+ g_ptr_array_free (results, TRUE);
}
register_client_second_half (info);
-
- //g_object_unref (cursor);
}
static void
@@ -1794,7 +1784,7 @@ register_client (TrackerEvolutionPlugin *self)
ClientRegistry *info;
const gchar *query;
- if (!priv->connection) {
+ if (!priv->client) {
return;
}
@@ -1807,10 +1797,9 @@ register_client (TrackerEvolutionPlugin *self)
query = "SELECT ?c "
"WHERE { <" DATASOURCE_URN "> nie:contentLastModified ?c }";
- tracker_sparql_connection_query_async (priv->connection, query,
- NULL,
- on_register_client_qry,
- info);
+ tracker_resources_sparql_query_async (priv->client, query,
+ on_register_client_qry,
+ info);
}
@@ -2164,10 +2153,10 @@ name_owner_changed_cb (DBusGProxy *proxy,
if (g_strcmp0 (name, TRACKER_SERVICE) == 0) {
if (tracker_is_empty_string (new_owner) && !tracker_is_empty_string (old_owner)) {
- if (priv->connection) {
- TrackerSparqlConnection *connection = priv->connection;
+ if (priv->client) {
+ TrackerClient *client = priv->client;
- priv->connection = NULL;
+ priv->client = NULL;
if (sparql_pool) {
ThreadPool *pool = sparql_pool;
@@ -2181,13 +2170,13 @@ name_owner_changed_cb (DBusGProxy *proxy,
thread_pool_destroy (pool);
}
- g_object_unref (connection);
+ g_object_unref (client);
}
}
if (tracker_is_empty_string (old_owner) && !tracker_is_empty_string (new_owner)) {
- if (!priv->connection) {
- priv->connection = tracker_sparql_connection_get (NULL);
+ if (!priv->client) {
+ priv->client = tracker_client_new (0, G_MAXINT);
}
register_client (user_data);
}
@@ -2278,10 +2267,10 @@ tracker_evolution_plugin_finalize (GObject *plugin)
g_object_unref (priv->accounts);
- if (priv->connection) {
- TrackerSparqlConnection *connection = priv->connection;
+ if (priv->client) {
+ TrackerClient *client = priv->client;
- priv->connection = NULL;
+ priv->client = NULL;
if (sparql_pool) {
ThreadPool *pool = sparql_pool;
@@ -2295,7 +2284,7 @@ tracker_evolution_plugin_finalize (GObject *plugin)
thread_pool_destroy (pool);
}
- g_object_unref (connection);
+ g_object_unref (client);
}
if (priv->dbus_proxy) {
@@ -2303,7 +2292,7 @@ tracker_evolution_plugin_finalize (GObject *plugin)
}
if (priv->connection) {
- dbus_g_connection_unref (priv->dbusconnection);
+ dbus_g_connection_unref (priv->connection);
}
G_OBJECT_CLASS (tracker_evolution_plugin_parent_class)->finalize (plugin);
@@ -2333,7 +2322,7 @@ tracker_evolution_plugin_init (TrackerEvolutionPlugin *plugin)
EIterator *it;
GError *error = NULL;
- priv->connection = NULL;
+ priv->client = NULL;
priv->last_time = 0;
priv->resuming = FALSE;
priv->paused = FALSE;
@@ -2343,13 +2332,13 @@ tracker_evolution_plugin_init (TrackerEvolutionPlugin *plugin)
priv->registered_stores = NULL;
priv->registered_clients = NULL;
- priv->dbusconnection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (error) {
goto error_handler;
}
- priv->dbus_proxy = dbus_g_proxy_new_for_name (priv->dbusconnection,
+ priv->dbus_proxy = dbus_g_proxy_new_for_name (priv->connection,
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
@@ -2403,8 +2392,8 @@ miner_started (TrackerMiner *miner)
{
TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (miner);
- if (!priv->connection) {
- priv->connection = tracker_sparql_connection_get (NULL);
+ if (!priv->client) {
+ priv->client = tracker_client_new (0, G_MAXINT);
}
dbus_g_proxy_begin_call (priv->dbus_proxy, "ListNames",
@@ -2439,10 +2428,10 @@ miner_paused (TrackerMiner *miner)
priv->paused = TRUE;
priv->last_time = 0;
- if (priv->connection) {
- TrackerSparqlConnection *connection = priv->connection;
+ if (priv->client) {
+ TrackerClient *client = priv->client;
- priv->connection = NULL;
+ priv->client = NULL;
if (sparql_pool) {
ThreadPool *pool = sparql_pool;
@@ -2456,7 +2445,7 @@ miner_paused (TrackerMiner *miner)
thread_pool_destroy (pool);
}
- g_object_unref (connection);
+ g_object_unref (client);
/* By setting this to NULL, events will still be catched by our
* handlers, but the send_sparql_* calls will just ignore it.
@@ -2502,8 +2491,8 @@ miner_resumed (TrackerMiner *miner)
priv->total_popped = 0;
priv->of_total = 0;
- if (!priv->connection) {
- priv->connection = tracker_sparql_connection_get (NULL);
+ if (!priv->client) {
+ priv->client = tracker_client_new (0, G_MAXINT);
}
g_object_set (miner, "progress", 0.0, "status", _("Processingâ?¦"), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]