GNOME Bugzilla – Bug 655996
Metadata parameter not being picked up
Last modified: 2017-03-23 07:39:44 UTC
Previously having the following metadata line: ContactName.family owned given the following GIR definition: <record name="ContactName" c:type="EContactName" glib:type-name="EContactName" glib:get-type="e_contact_name_get_type" c:symbol-prefix="contact_name"> <field name="family" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="given" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="additional" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="prefixes" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <field name="suffixes" writable="1"> <type name="utf8" c:type="gchar*"/> </field> <constructor name="new" c:identifier="e_contact_name_new"> <doc xml:whitespace="preserve">Creates a new #EContactName struct.</doc> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">A new #EContactName struct.</doc> <type name="ContactName" c:type="EContactName*"/> </return-value> </constructor> <method name="copy" c:identifier="e_contact_name_copy"> <doc xml:whitespace="preserve">Creates a copy of @n.</doc> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">A new #EContactName identical to @n.</doc> <type name="ContactName" c:type="EContactName*"/> </return-value> </method> <method name="free" c:identifier="e_contact_name_free"> <doc xml:whitespace="preserve">Frees @name and its contents.</doc> <return-value transfer-ownership="none"> <type name="none" c:type="void"/> </return-value> </method> <method name="to_string" c:identifier="e_contact_name_to_string"> <doc xml:whitespace="preserve">Generates a string representation of @name.</doc> <return-value transfer-ownership="full"> <doc xml:whitespace="preserve">The string representation of @name.</doc> <type name="utf8" c:type="gchar*"/> </return-value> </method> </record> would generate a VAPI class definition like this: [Compact] [CCode (copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "e_contact_name_get_type ()", cheader_filename = "libebook/e-book-client.h")] public class ContactName { public string additional; public string family; public string given; public string prefixes; public string suffixes; [CCode (has_construct_function = false)] public ContactName (); public E.ContactName copy (); public void free (); public static E.ContactName from_string (string name_str); public string to_string (); } Using Vala from git as of Monday I am getting: [Compact] [CCode (copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "e_contact_name_get_type ()", cheader_filename = "libebook/e-book-client.h")] public class ContactName { public weak string additional; public weak string family; public weak string given; public weak string prefixes; public weak string suffixes; [CCode (has_construct_function = false)] public ContactName (); public E.ContactName copy (); public void free (); public static E.ContactName from_string (string name_str); public string to_string (); } That is, that metadata line is effectively being ignored.
Content of EBook-1.2.metadata: BookView.contacts_added#signal.object type="GLib.List<weak void*>" BookView.contacts_removed#signal.object type="GLib.List<weak void*>" BookView.contacts_changed#signal.object type="GLib.List<weak void*>" BookClientView.objects_added#signal.object type="GLib.List<weak void*>" BookClientView.objects_removed#signal.object type="GLib.List<weak void*>" BookClientView.objects_modified#signal.object type="GLib.List<weak void*>" ContactName.family owned ContactName.given owned ContactName.additional owned ContactName.prefixes owned ContactName.suffixes owned ContactAddress.address_format owned ContactAddress.code owned ContactAddress.country owned ContactAddress.ext owned ContactAddress.locality owned ContactAddress.po owned ContactAddress.region owned ContactAddress.street owned
I believe you need to be doing unowned=false, not owned, in this case. I'll leave this open since they should really be equivalent.
Whether to use owned or unowned depends on the initial ownership of the symbol. If the argument doesn't apply an unused metadata warning issued.