[tracker] libtracker-sparql: Add tracker_resource_[add|set]_take_relation()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-sparql: Add tracker_resource_[add|set]_take_relation()
- Date: Tue, 11 Jul 2017 16:14:17 +0000 (UTC)
commit 41649a26e1e8816f47a2e4832a62d39b58f775b2
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jul 10 23:52:37 2017 +0200
libtracker-sparql: Add tracker_resource_[add|set]_take_relation()
These are C helper functions, so users may create trees of TrackerResources
without having to manually unref all non-root ones.
.../libtracker-sparql-sections.txt | 2 +
src/libtracker-sparql/tracker-resource.c | 31 ++++++++++++++++++++
src/libtracker-sparql/tracker-resource.h | 2 +
3 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/libtracker-sparql/libtracker-sparql-sections.txt
b/docs/reference/libtracker-sparql/libtracker-sparql-sections.txt
index 1a06559..c0d3b4e 100644
--- a/docs/reference/libtracker-sparql/libtracker-sparql-sections.txt
+++ b/docs/reference/libtracker-sparql/libtracker-sparql-sections.txt
@@ -20,6 +20,7 @@ tracker_resource_set_identifier
tracker_resource_set_int
tracker_resource_set_int64
tracker_resource_set_relation
+tracker_resource_set_take_relation
tracker_resource_set_string
tracker_resource_set_uri
tracker_resource_add_boolean
@@ -28,6 +29,7 @@ tracker_resource_add_gvalue
tracker_resource_add_int
tracker_resource_add_int64
tracker_resource_add_relation
+tracker_resource_add_take_relation
tracker_resource_add_string
tracker_resource_add_uri
tracker_resource_get_first_boolean
diff --git a/src/libtracker-sparql/tracker-resource.c b/src/libtracker-sparql/tracker-resource.c
index 2b405ce..694f5ac 100644
--- a/src/libtracker-sparql/tracker-resource.c
+++ b/src/libtracker-sparql/tracker-resource.c
@@ -404,6 +404,21 @@ SET_PROPERTY_FOR_GTYPE (tracker_resource_set_int64, gint64, G_TYPE_INT64, g_valu
SET_PROPERTY_FOR_GTYPE (tracker_resource_set_relation, TrackerResource *, TRACKER_TYPE_RESOURCE,
g_value_set_object, validate_pointer);
/**
+ * tracker_resource_set_take_relation: (skip)
+ * @self: the #TrackerResource
+ * @property_uri: a string identifying the property to modify
+ * @resource: the property object
+ *
+ * Sets a single-valued resource object as a #TrackerResource. This
+ * function produces similar RDF to tracker_resource_set_uri(),
+ * although in this function the URI will depend on the identifier
+ * set on @resource. This function takes ownership of @resource.
+ *
+ * Since: 2.0
+ */
+SET_PROPERTY_FOR_GTYPE (tracker_resource_set_take_relation, TrackerResource *, TRACKER_TYPE_RESOURCE,
g_value_take_object, validate_pointer);
+
+/**
* tracker_resource_set_string:
* @self: the #TrackerResource
* @property_uri: a string identifying the property to modify
@@ -609,6 +624,22 @@ ADD_PROPERTY_FOR_GTYPE (tracker_resource_add_int64, gint64, G_TYPE_INT64, g_valu
ADD_PROPERTY_FOR_GTYPE (tracker_resource_add_relation, TrackerResource *, TRACKER_TYPE_RESOURCE,
g_value_set_object, validate_pointer);
/**
+ * tracker_resource_add_take_relation: (skip)
+ * @self: the #TrackerResource
+ * @property_uri: a string identifying the property to modify
+ * @resource: the property object
+ *
+ * Adds a resource object to a multi-valued property. This
+ * function produces similar RDF to tracker_resource_add_uri(),
+ * although in this function the URI will depend on the identifier
+ * set on @resource. This function takes ownership of @resource.
+ *
+ * Since: 2.0
+ */
+ADD_PROPERTY_FOR_GTYPE (tracker_resource_add_take_relation, TrackerResource *, TRACKER_TYPE_RESOURCE,
g_value_take_object, validate_pointer);
+
+
+/**
* tracker_resource_add_string:
* @self: the #TrackerResource
* @property_uri: a string identifying the property to modify
diff --git a/src/libtracker-sparql/tracker-resource.h b/src/libtracker-sparql/tracker-resource.h
index 1740fc1..2b4e2d7 100644
--- a/src/libtracker-sparql/tracker-resource.h
+++ b/src/libtracker-sparql/tracker-resource.h
@@ -42,6 +42,7 @@ void tracker_resource_set_double (TrackerResource *self, const char *property_ur
void tracker_resource_set_int (TrackerResource *self, const char *property_uri, int value);
void tracker_resource_set_int64 (TrackerResource *self, const char *property_uri, gint64 value);
void tracker_resource_set_relation (TrackerResource *self, const char *property_uri, TrackerResource
*resource);
+void tracker_resource_set_take_relation (TrackerResource *self, const char *property_uri, TrackerResource
*resource);
void tracker_resource_set_string (TrackerResource *self, const char *property_uri, const char *value);
void tracker_resource_set_uri (TrackerResource *self, const char *property_uri, const char *value);
@@ -51,6 +52,7 @@ void tracker_resource_add_double (TrackerResource *self, const char *property_ur
void tracker_resource_add_int (TrackerResource *self, const char *property_uri, int value);
void tracker_resource_add_int64 (TrackerResource *self, const char *property_uri, gint64 value);
void tracker_resource_add_relation (TrackerResource *self, const char *property_uri, TrackerResource
*resource);
+void tracker_resource_add_take_relation (TrackerResource *self, const char *property_uri, TrackerResource
*resource);
void tracker_resource_add_string (TrackerResource *self, const char *property_uri, const char *value);
void tracker_resource_add_uri (TrackerResource *self, const char *property_uri, const char *value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]