summaryrefslogtreecommitdiff
path: root/girepository/gipropertyinfo.c
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-06-08 16:40:35 +0200
committerTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-06-08 17:35:12 +0200
commit22ae017ffd3052c0b81822b2ca6e41626b76b9c4 (patch)
treeb280bde67eaa4096bd8a83ad539a8fe9c7c14f5c /girepository/gipropertyinfo.c
parent862cdbe9ed2464c722e566238980895d08a48106 (diff)
downloadgobject-introspection-22ae017ffd3052c0b81822b2ca6e41626b76b9c4.tar.gz
Support the (transfer) annotation for properties.
* girepository/*: Add g_property_info_get_ownership_transfer() and write the transfer attribute of properties into the typelib. * giscanner/*: Parse the (transfer) annotation and write it into the .gir. * tools/generate.c: Read the transfer annotation for properties and write to the .tgir. https://bugzilla.gnome.org/show_bug.cgi?id=620484
Diffstat (limited to 'girepository/gipropertyinfo.c')
-rw-r--r--girepository/gipropertyinfo.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/girepository/gipropertyinfo.c b/girepository/gipropertyinfo.c
index 705a80bf..224709d2 100644
--- a/girepository/gipropertyinfo.c
+++ b/girepository/gipropertyinfo.c
@@ -57,3 +57,30 @@ g_property_info_get_type (GIPropertyInfo *info)
return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (PropertyBlob, type));
}
+/**
+ * g_property_info_get_ownership_transfer:
+ * @info: a #GIPropertyInfo
+ *
+ * Obtain the ownership transfer for this property. See #GITransfer for more
+ * information about transfer values.
+ *
+ * Returns: the transfer
+ */
+GITransfer
+g_property_info_get_ownership_transfer (GIPropertyInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ PropertyBlob *blob;
+
+ g_return_val_if_fail (info != NULL, -1);
+ g_return_val_if_fail (GI_IS_PROPERTY_INFO (info), -1);
+
+ blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->transfer_ownership)
+ return GI_TRANSFER_EVERYTHING;
+ else if (blob->transfer_container_ownership)
+ return GI_TRANSFER_CONTAINER;
+ else
+ return GI_TRANSFER_NOTHING;
+}