[tracker/class-signal] Trying to fix delete emit of rdfs:Resource, tryout
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/class-signal] Trying to fix delete emit of rdfs:Resource, tryout
- Date: Thu, 2 Sep 2010 11:37:14 +0000 (UTC)
commit 79732420da0b511c96b8ea9619adba968ac02b42
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Sep 2 13:36:36 2010 +0200
Trying to fix delete emit of rdfs:Resource, tryout
src/libtracker-data/tracker-ontologies.c | 25 +++++++++++++++++++++++++
src/libtracker-data/tracker-ontologies.h | 1 +
src/tracker-store/tracker-events.c | 7 +++++--
3 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-ontologies.c b/src/libtracker-data/tracker-ontologies.c
index cdde80c..caf920f 100644
--- a/src/libtracker-data/tracker-ontologies.c
+++ b/src/libtracker-data/tracker-ontologies.c
@@ -64,6 +64,9 @@ static GHashTable *id_uri_pairs;
/* rdf:type */
static TrackerProperty *rdf_type = NULL;
+/* rdfs:Resource */
+static TrackerClass *rdfs_resource = NULL;
+
void
tracker_ontologies_init (void)
{
@@ -154,6 +157,11 @@ tracker_ontologies_shutdown (void)
rdf_type = NULL;
}
+ if (rdfs_resource) {
+ g_object_unref (rdfs_resource);
+ rdfs_resource = NULL;
+ }
+
initialized = FALSE;
}
@@ -165,6 +173,15 @@ tracker_ontologies_get_rdf_type (void)
return rdf_type;
}
+TrackerClass *
+tracker_ontologies_get_rdfs_resource (void)
+{
+ g_return_val_if_fail (rdf_type != NULL, NULL);
+
+ return rdfs_resource;
+}
+
+
const gchar*
tracker_ontologies_get_uri_by_id (gint id)
{
@@ -189,6 +206,14 @@ tracker_ontologies_add_class (TrackerClass *service)
g_hash_table_insert (class_uris,
g_strdup (uri),
g_object_ref (service));
+
+ if (g_strcmp0 (uri, TRACKER_RDFS_PREFIX "Resource") == 0) {
+ if (rdfs_resource) {
+ g_object_unref (rdfs_resource);
+ }
+ rdfs_resource = g_object_ref (service);
+ }
+
}
}
diff --git a/src/libtracker-data/tracker-ontologies.h b/src/libtracker-data/tracker-ontologies.h
index df5ce6a..7b524e1 100644
--- a/src/libtracker-data/tracker-ontologies.h
+++ b/src/libtracker-data/tracker-ontologies.h
@@ -45,6 +45,7 @@ TrackerOntology **tracker_ontologies_get_ontologies (guint *length);
TrackerClass ** tracker_ontologies_get_classes (guint *length);
TrackerProperty ** tracker_ontologies_get_properties (guint *length);
TrackerProperty * tracker_ontologies_get_rdf_type (void);
+TrackerClass * tracker_ontologies_get_rdfs_resource (void);
/* Field mechanics */
void tracker_ontologies_add_property (TrackerProperty *field);
diff --git a/src/tracker-store/tracker-events.c b/src/tracker-store/tracker-events.c
index 0bc13f3..2d5e8e9 100644
--- a/src/tracker-store/tracker-events.c
+++ b/src/tracker-store/tracker-events.c
@@ -137,6 +137,7 @@ tracker_events_add_delete (gint graph_id,
GPtrArray *rdf_types)
{
TrackerProperty *rdf_type;
+ TrackerClass *rdfs_resource;
g_return_if_fail (rdf_types != NULL);
g_return_if_fail (private != NULL);
@@ -146,9 +147,11 @@ tracker_events_add_delete (gint graph_id,
}
rdf_type = tracker_ontologies_get_rdf_type ();
+ rdfs_resource = tracker_ontologies_get_rdfs_resource ();
- if (object_id != 0 && pred_id == tracker_property_get_id (rdf_type)) {
- /* Resource delete
+ if ((object_id != 0 && pred_id == tracker_property_get_id (rdf_type)) &&
+ (object_id != tracker_class_get_id (rdfs_resource))) {
+ /* Resource delete that isn't the rdfs:Resource
* In case of delete, object is the rdf:type */
if (is_allowed (private, NULL, object_id)) {
TrackerClass *class = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]