After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770734 - Cannot get free-form attributes on properties.
Cannot get free-form attributes on properties.
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: libgirepository
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-09-02 07:40 UTC by Lim Jongrok
Modified: 2018-02-08 12:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
subject.c (6.19 KB, text/x-csrc)
2016-12-02 03:02 UTC, Lim Jongrok
Details
subject.h (1.70 KB, text/plain)
2016-12-02 03:02 UTC, Lim Jongrok
Details
dumpthing.c (6.57 KB, text/x-csrc)
2016-12-02 03:03 UTC, Lim Jongrok
Details
Subject-1.0.gir (8.13 KB, application/xml)
2016-12-02 03:04 UTC, Lim Jongrok
Details
Subject-1.0-gen.gir (4.60 KB, application/xml)
2016-12-02 03:06 UTC, Lim Jongrok
Details

Description Lim Jongrok 2016-09-02 07:40:42 UTC
I'm trying to use free-form attributes, from Object class type, to properties and fields.

But I can't get free-form attributes from property.

I can sure that gir xml file contains attributes.
But g_base_info_iterate_attributes() does not return any attributes.

I suspect that either that the attributes are omitted in typelib, or that they aren't loaded in the GIPropertyInfo.

C Comment:
> ...
>  /**
>   * OnggiModule:version: (attributes onggi.tracked=true)
>   *
>   * Version of the module.
>   */
> ...

GIR XML
> ...
>      <property name="version"
>                writable="1"
>                construct-only="1"
>                transfer-ownership="none">
>        <attribute name="onggi.tracked" value="true"/>
>        <doc xml:space="preserve">Version of the module.</doc>
>        <type name="guint" c:type="guint"/>
>      </property>
> ...
Comment 1 Lim Jongrok 2016-12-02 03:00:50 UTC
I found another aspect of this issue. I found attributes of properties are attached to class, not their properties.


Part of GIR XML for class "SubjectObject"
> ...
> <repository version="1.2"
>             xmlns="http://www.gtk.org/introspection/core/1.0"
>             xmlns:c="http://www.gtk.org/introspection/c/1.0"
>             xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
>   <package name="gobject-2.0"/>
>   <namespace name="Subject"
>              version="1.0"
>              shared-library="libsubject-1.0.so"
>              c:identifier-prefixes="Subject"
>              c:symbol-prefixes="subject">
>     <class name="Object"
>            c:symbol-prefix="object"
>            c:type="SubjectObject"
>            glib:type-name="SubjectObject"
>            glib:get-type="subject_object_get_type"
>            glib:type-struct="ObjectClass">
>       <doc xml:space="preserve">An instance structure.</doc>
>       <constructor name="new" c:identifier="subject_object_new">
> ...
>       <property name="prop-int" writable="1" transfer-ownership="none">
>         <attribute name="subject.attr" value="Property"/>
>         <doc xml:space="preserve">An integer property.</doc>
>         <type name="gint" c:type="gint"/>
>       </property>
> ...


Part of the code that used to print out attributes:

> void
> dump_info (guint       space,
>            GIBaseInfo *info)
> {
>   GITypeInfo *tinfo = NULL;
> 
>   g_print ("%*s%s\n", space, "", g_base_info_get_name (info));
> 
>   GIAttributeIter attr_iter = {0, };
> 
>   gchar *attr_name;
>   gchar *attr_value;
>
>   while (g_base_info_iterate_attributes (info, &attr_iter, &attr_name, &attr_value))
>     g_print ("%*s%s: %s\n", space + 4, "", attr_name, attr_value);
>
>   g_print ("\n");
>
>   ...


And this is the result.

> Object
>     subject.attr: Property
>
>   parent_instance
> 
>   new
>       subject.attr: Constructor
> ...
> ...
>
>   vfunc
>       subject.attr: VFuncWrapper
>
>   prop-int
>
>   sig
>       subject.attr: Signal
>
>     a
>...


Also I just runned g-ir-generate Subject-1.0.typelib and here is part of result.

> <repository version="1.0"
>             xmlns="http://www.gtk.org/introspection/core/1.0"
>             xmlns:c="http://www.gtk.org/introspection/c/1.0"
>             xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
>   <namespace name="Subject" version="1.0" shared-library="libsubject-1.0.so" c:prefix="Subject">
>     <class name="Object" glib:type-struct="ObjectClass" glib:type-name="SubjectObject" glib:get-type="subject_object_get_type">
>       <attribute name="subject.attr" value="Property"/>
>       <field name="parent_instance">
>         <type name="any"/>
>       </field>
> ...
> ...
>       </method>
>       <property name="prop-int" writable="1" transfer-ownership="none">
>         <type name="gint32"/>
>       </property>
>       <glib:signal name="sig" when="LAST">
> ...

So, I'm suspecting that attributes are attached to class, either of when being compiled, or loaded.

I'm also attaching the subject.c, subject.h, and Subject-1.0.gir, and gir that generated from `g-ir-generate Subject-1.0.gir`
Comment 2 Lim Jongrok 2016-12-02 03:02:10 UTC
Created attachment 341200 [details]
subject.c
Comment 3 Lim Jongrok 2016-12-02 03:02:31 UTC
Created attachment 341201 [details]
subject.h
Comment 4 Lim Jongrok 2016-12-02 03:03:52 UTC
Created attachment 341203 [details]
dumpthing.c

I wrote this to print out attributes.
Comment 5 Lim Jongrok 2016-12-02 03:04:19 UTC
Created attachment 341204 [details]
Subject-1.0.gir
Comment 6 Lim Jongrok 2016-12-02 03:06:10 UTC
Created attachment 341205 [details]
Subject-1.0-gen.gir

This is generated from `g-ir-generate Subject-1.0.typelib`.

Subject-1.0.typelib was generated from `g-ir-compiler Subject-1.0.gir`
Comment 7 GNOME Infrastructure Team 2018-02-08 12:42:48 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/162.