[tracker/property-changes] libtracker-data: Support for changing tracker:indexed in ontology



commit 98d0dc996182178ca999916c7acc7cd5e71d2fb6
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Mar 31 14:30:18 2010 +0200

    libtracker-data: Support for changing tracker:indexed in ontology

 src/libtracker-data/tracker-data-manager.c |   36 +++++++++++----------------
 1 files changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 33b14f3..10d4343 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -75,10 +75,10 @@ static gboolean  initialized;
 static gboolean  in_journal_replay;
 
 static void
-notify_and_writeback_helper (const gchar *kind,
-                             const gchar *subject,
-                             const gchar *predicate,
-                             const gchar *object)
+update_property_value (const gchar *kind,
+                       const gchar *subject,
+                       const gchar *predicate,
+                       const gchar *object)
 {
 	GError *error = NULL;
 	TrackerDBResultSet *result_set;
@@ -86,7 +86,7 @@ notify_and_writeback_helper (const gchar *kind,
 	gboolean needed = TRUE;
 
 	query = g_strdup_printf ("SELECT ?old_value WHERE { "
-	                           "<%s> tracker:%s ?old_value "
+	                           "<%s> %s ?old_value "
 	                         "}", subject, kind);
 
 	result_set = tracker_data_query_sparql (query, &error);
@@ -118,7 +118,7 @@ notify_and_writeback_helper (const gchar *kind,
 	}
 
 	if (error) {
-		g_critical ("Can't update tracker:%s for %s: %s", 
+		g_critical ("Can't update %s for %s: %s", 
 		            kind, subject, error->message);
 		g_error_free (error);
 	}
@@ -251,7 +251,6 @@ tracker_data_ontology_load_statement (const gchar *ontology_path,
 		tracker_class_add_super_class (class, super_class);
 	} else if (g_strcmp0 (predicate, TRACKER_PREFIX "notify") == 0) {
 		TrackerClass *class;
-		gboolean wanted_value;
 
 		class = tracker_ontologies_get_class_by_uri (subject);
 		if (class == NULL) {
@@ -259,18 +258,15 @@ tracker_data_ontology_load_statement (const gchar *ontology_path,
 			return;
 		}
 
-		if (strcmp (object, "true") == 0) {
-			wanted_value = TRUE;
-		}
-
 		if (tracker_class_get_is_new (class) != in_update) {
-			notify_and_writeback_helper ("notify", subject, predicate, object);
+			update_property_value ("tracker:notify", subject, predicate, object);
 		}
 
-		tracker_class_set_notify (class, wanted_value);
+		if (strcmp (object, "true") == 0) {
+			tracker_class_set_notify (class, TRUE);
+		}
 	} else if (g_strcmp0 (predicate, TRACKER_PREFIX "writeback") == 0) {
 		TrackerProperty *property;
-		gboolean wanted_value;
 
 		property = tracker_ontologies_get_property_by_uri (subject);
 		if (property == NULL) {
@@ -278,15 +274,13 @@ tracker_data_ontology_load_statement (const gchar *ontology_path,
 			return;
 		}
 
-		if (strcmp (object, "true") == 0) {
-			wanted_value = TRUE;
-		}
-
 		if (tracker_property_get_is_new (property) != in_update) {
-			notify_and_writeback_helper ("writeback", subject, predicate, object);
+			update_property_value ("tracker:writeback", subject, predicate, object);
 		}
 
-		tracker_property_set_writeback (property, wanted_value);
+		if (strcmp (object, "true") == 0) {
+			tracker_property_set_writeback (property, TRUE);
+		}
 	} else if (g_strcmp0 (predicate, RDFS_SUB_PROPERTY_OF) == 0) {
 		TrackerProperty *property, *super_property;
 
@@ -375,7 +369,7 @@ tracker_data_ontology_load_statement (const gchar *ontology_path,
 		}
 
 		if (tracker_property_get_is_new (property) != in_update) {
-			return;
+			update_property_value ("tracker:indexed", subject, predicate, object);
 		}
 
 		if (strcmp (object, "true") == 0) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]