[tracker/tracker-store-queue] Merge fix for the push modules
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-store-queue] Merge fix for the push modules
- Date: Wed, 27 May 2009 11:49:08 -0400 (EDT)
commit 14c608447fbcb146dfc41fb56d6eaa9960ad1b33
Author: Philip Van Hoof <philip codeminded be>
Date: Wed May 27 17:44:22 2009 +0200
Merge fix for the push modules
Reintroduced tracker_store_queue_insert_statement. We'll replace this API with
tracker_store_queue_sparql_update and a query builder component afterwards.
---
.../evolution/tracker-evolution-registrar.c | 1 +
src/plugins/kmail/tracker-kmail-registrar.c | 1 +
src/tracker-store/tracker-removable-device.c | 4 ++
src/tracker-store/tracker-store.c | 58 +++++++++++++++++++-
src/tracker-store/tracker-store.h | 8 +++
5 files changed, 71 insertions(+), 1 deletions(-)
diff --git a/src/plugins/evolution/tracker-evolution-registrar.c b/src/plugins/evolution/tracker-evolution-registrar.c
index 1cab05f..c001917 100644
--- a/src/plugins/evolution/tracker-evolution-registrar.c
+++ b/src/plugins/evolution/tracker-evolution-registrar.c
@@ -273,6 +273,7 @@ data_insert_statement (TrackerEvolutionRegistrar *self,
const gchar *predicate,
const gchar *object)
{
+ /* To be replaced with batch_update when query builder is available */
tracker_store_queue_insert_statement (subject, predicate, object,
NULL, NULL, NULL);
}
diff --git a/src/plugins/kmail/tracker-kmail-registrar.c b/src/plugins/kmail/tracker-kmail-registrar.c
index 4ebf0f3..d1a462c 100644
--- a/src/plugins/kmail/tracker-kmail-registrar.c
+++ b/src/plugins/kmail/tracker-kmail-registrar.c
@@ -158,6 +158,7 @@ data_insert_statement (TrackerKMailRegistrar *self,
const gchar *predicate,
const gchar *object)
{
+ /* To be replaced with batch_update when query builder is available */
tracker_store_queue_insert_statement (subject, predicate, object,
NULL, NULL, NULL);
}
diff --git a/src/tracker-store/tracker-removable-device.c b/src/tracker-store/tracker-removable-device.c
index d5f8014..48c55e6 100644
--- a/src/tracker-store/tracker-removable-device.c
+++ b/src/tracker-store/tracker-removable-device.c
@@ -319,11 +319,15 @@ tracker_removable_device_load (const gchar *mount_point)
tmp = g_file_get_uri (mountp_file);
base_uri = g_strconcat (tmp, "/", NULL);
+ /*
tracker_store_queue_turtle_import (filename,
base_uri,
process_turtle_statement,
info,
process_turtle_destroy);
+ */
+
+ g_debug ("Support for removable device cache not yet ported to new TrackerStore API");
g_free (base_uri);
g_free (tmp);
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 5ab8b34..8289305 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -43,7 +43,9 @@ typedef struct {
typedef enum {
TRACKER_STORE_TASK_TYPE_UPDATE = 0,
TRACKER_STORE_TASK_TYPE_COMMIT = 1,
- TRACKER_STORE_TASK_TYPE_TURTLE = 2
+ TRACKER_STORE_TASK_TYPE_TURTLE = 2,
+ /* To be removed when query builder is available */
+ TRACKER_STORE_TASK_TYPE_STATEMENT = 3
} TrackerStoreTaskType;
typedef struct {
@@ -54,6 +56,12 @@ typedef struct {
gboolean in_progress;
gchar *path;
} turtle;
+ /* To be removed when query builder is available */
+ struct {
+ gchar *subject;
+ gchar *predicate;
+ gchar *object;
+ } statement;
} data;
gpointer user_data;
GDestroyNotify destroy;
@@ -80,6 +88,10 @@ tracker_store_task_free (TrackerStoreTask *task)
{
if (task->type == TRACKER_STORE_TASK_TYPE_TURTLE) {
g_free (task->data.turtle.path);
+ } else if (task->type == TRACKER_STORE_TASK_TYPE_STATEMENT) {
+ g_free (task->data.statement.subject);
+ g_free (task->data.statement.predicate);
+ g_free (task->data.statement.object);
} else {
g_free (task->data.query);
}
@@ -170,6 +182,17 @@ queue_idle_handler (gpointer user_data)
if (task->callback.commit_callback) {
task->callback.commit_callback (task->user_data);
}
+ } else if (task->type == TRACKER_STORE_TASK_TYPE_STATEMENT) {
+
+ /* To be removed when query builder is available */
+ tracker_data_insert_statement (task->data.statement.subject,
+ task->data.statement.predicate,
+ task->data.statement.object);
+
+ if (task->callback.update_callback) {
+ task->callback.update_callback (NULL, task->user_data);
+ }
+
} else if (task->type == TRACKER_STORE_TASK_TYPE_TURTLE) {
begin_batch (private);
@@ -419,3 +442,36 @@ tracker_store_delete_statement (const gchar *subject,
tracker_data_delete_statement (subject, predicate, object);
}
+/* To be removed when query builder is available */
+void
+tracker_store_queue_insert_statement (const gchar *subject,
+ const gchar *predicate,
+ const gchar *object,
+ TrackerStoreSparqlUpdateCallback callback,
+ gpointer user_data,
+ GDestroyNotify destroy)
+{
+ TrackerStorePrivate *private;
+ TrackerStoreTask *task;
+
+ g_assert (subject != NULL);
+ g_assert (predicate != NULL);
+ g_assert (object != NULL);
+
+ private = g_static_private_get (&private_key);
+ g_return_if_fail (private != NULL);
+ task = g_slice_new0 (TrackerStoreTask);
+ task->type = TRACKER_STORE_TASK_TYPE_STATEMENT;
+ task->data.statement.subject = g_strdup (subject);
+ task->data.statement.predicate = g_strdup (predicate);
+ task->data.statement.object = g_strdup (object);
+ task->user_data = user_data;
+ task->callback.update_callback = callback;
+ task->destroy = destroy;
+
+ g_queue_push_tail (private->queue, task);
+
+ if (!private->have_handler) {
+ start_handler (private);
+ }
+}
diff --git a/src/tracker-store/tracker-store.h b/src/tracker-store/tracker-store.h
index 0415b12..e29fb8c 100644
--- a/src/tracker-store/tracker-store.h
+++ b/src/tracker-store/tracker-store.h
@@ -61,6 +61,14 @@ TrackerDBResultSet*
tracker_store_sparql_query (const gchar *sparql,
GError **error);
+/* To be removed when query builder is available */
+void tracker_store_queue_insert_statement (const gchar *subject,
+ const gchar *predicate,
+ const gchar *object,
+ TrackerStoreSparqlUpdateCallback callback,
+ gpointer user_data,
+ GDestroyNotify destroy);
+
G_END_DECLS
#endif /* __TRACKER_STORE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]