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 642757 - "c:identifier" attribute not available on GIValueInfo
"c:identifier" attribute not available on GIValueInfo
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-02-19 15:22 UTC by Laszlo Pandy
Modified: 2015-02-07 16:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add "c:identifier" attribute to GIrNodeValue (for flags and enum values). (2.00 KB, patch)
2011-02-22 15:08 UTC, Laszlo Pandy
none Details | Review
Add "c:identifier" attribute to GIrNodeValue (for flags and enum values). (5.42 KB, patch)
2011-02-22 18:28 UTC, Laszlo Pandy
accepted-commit_now Details | Review
Add "c:identifier" attribute to GIrNodeValue (for flags and enum values). (5.44 KB, patch)
2011-02-23 12:58 UTC, Laszlo Pandy
committed Details | Review

Description Laszlo Pandy 2011-02-19 15:22:45 UTC
It seems that all <member> elements in GIRs have a "c:identifier" attribute, but that attribute can only be accessed through the API for Function types. GIValueInfo has no such attribute. 

In PyGObject, we can retrieve the value_name for enums with GTypes, but for non GType enums we need to fill in the GEnumValue ourselves. "c:identifier" seems to be the value needed for GEnumValue.value_name.

I looked into making a patch for this myself, since it is easy to expose it using the existing g_base_info_get_attribute(). However it would require using up some of the reserved padding on ValueBlob for another string pointer, and probably someone more knowledgeable should tell me if this is the right thing to do.
Comment 1 Laszlo Pandy 2011-02-22 15:08:31 UTC
Created attachment 181592 [details] [review]
Add "c:identifier" attribute to GIrNodeValue (for flags and enum values).

Flags and enums with a GType have a value_nick and value_name
strings available in the class struct. But for flags and enums
without GType, we need to get this information from introspection.

g_base_info_get_name() gives the string for value_nick. In the GIR,
the attribute "c:identifier" is the string neede for value_name.

This patch adds the "c:identifier" from GIR to the typelib for all
flags and enum values. It can be retireved using
g_base_info_get_attribute(info, "c:identifier").
Comment 2 Laszlo Pandy 2011-02-22 18:28:37 UTC
Created attachment 181611 [details] [review]
Add "c:identifier" attribute to GIrNodeValue (for flags and enum values).

Same as previous patch, with tests added.

Rest of commit message:
Flags and enums with a GType have a value_nick and value_name
strings available in the class struct. But for flags and enums
without GType, we need to get this information from introspection.

g_base_info_get_name() gives the string for value_nick. In the GIR,
the attribute "c:identifier" is the string neede for value_name.

This patch adds the "c:identifier" from GIR to the typelib for all
flags and enum values. It can be retireved using
g_base_info_get_attribute(info, "c:identifier").
Comment 3 Johan (not receiving bugmail) Dahlin 2011-02-23 12:33:26 UTC
Review of attachment 181611 [details] [review]:

Looks great, thanks.

Perhaps rename the test to just gitypelibtest.c and move the cidentifier parts to
a specific function. As the test grows we'll probably use gtester etc.
Comment 4 Laszlo Pandy 2011-02-23 12:58:04 UTC
Created attachment 181693 [details] [review]
Add "c:identifier" attribute to GIrNodeValue (for flags and enum values).

Same as previous patch with gitestcidentifier.c renamed to gitypelibtest.c
Comment 5 André Klapper 2015-02-07 16:52:05 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]