summaryrefslogtreecommitdiff
path: root/girepository/girwriter.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/girwriter.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/girwriter.c')
-rw-r--r--girepository/girwriter.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/girepository/girwriter.c b/girepository/girwriter.c
index 6fa892db..ca68f57b 100644
--- a/girepository/girwriter.c
+++ b/girepository/girwriter.c
@@ -187,6 +187,26 @@ write_type_name_attribute (const gchar *namespace,
xml_printf (file, "\"");
}
+ static void
+write_ownership_transfer (GITransfer transfer,
+ Xml *file)
+{
+ switch (transfer)
+ {
+ case GI_TRANSFER_NOTHING:
+ xml_printf (file, " transfer-ownership=\"none\"");
+ break;
+ case GI_TRANSFER_CONTAINER:
+ xml_printf (file, " transfer-ownership=\"container\"");
+ break;
+ case GI_TRANSFER_EVERYTHING:
+ xml_printf (file, " transfer-ownership=\"full\"");
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
static void
write_type_info (const gchar *namespace,
GITypeInfo *info,
@@ -443,20 +463,7 @@ write_callable_info (const gchar *namespace,
xml_start_element (file, "return-value");
- switch (g_callable_info_get_caller_owns (info))
- {
- case GI_TRANSFER_NOTHING:
- xml_printf (file, " transfer-ownership=\"none\"");
- break;
- case GI_TRANSFER_CONTAINER:
- xml_printf (file, " transfer-ownership=\"container\"");
- break;
- case GI_TRANSFER_EVERYTHING:
- xml_printf (file, " transfer-ownership=\"full\"");
- break;
- default:
- g_assert_not_reached ();
- }
+ write_ownership_transfer (g_callable_info_get_caller_owns (info), file);
if (g_callable_info_may_return_null (info))
xml_printf (file, " allow-none=\"1\"");
@@ -477,20 +484,7 @@ write_callable_info (const gchar *namespace,
xml_printf (file, " name=\"%s\"",
g_base_info_get_name ((GIBaseInfo *) arg));
- switch (g_arg_info_get_ownership_transfer (arg))
- {
- case GI_TRANSFER_NOTHING:
- xml_printf (file, " transfer-ownership=\"none\"");
- break;
- case GI_TRANSFER_CONTAINER:
- xml_printf (file, " transfer-ownership=\"container\"");
- break;
- case GI_TRANSFER_EVERYTHING:
- xml_printf (file, " transfer-ownership=\"full\"");
- break;
- default:
- g_assert_not_reached ();
- }
+ write_ownership_transfer (g_arg_info_get_ownership_transfer (arg), file);
switch (g_arg_info_get_direction (arg))
{
@@ -968,6 +962,8 @@ write_property_info (const gchar *namespace,
if (flags & G_PARAM_CONSTRUCT_ONLY)
xml_printf (file, " construct-only=\"1\"");
+ write_ownership_transfer (g_property_info_get_ownership_transfer (info), file);
+
write_attributes (file, (GIBaseInfo*) info);
type = g_property_info_get_type (info);