mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 22:46:15 +01:00
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"). https://bugzilla.gnome.org/show_bug.cgi?id=642757
This commit is contained in:
parent
a0890f3d8f
commit
8304598583
@ -1480,6 +1480,7 @@ start_member (GMarkupParseContext *context,
|
|||||||
const gchar *name;
|
const gchar *name;
|
||||||
const gchar *value;
|
const gchar *value;
|
||||||
const gchar *deprecated;
|
const gchar *deprecated;
|
||||||
|
const gchar *c_identifier;
|
||||||
GIrNodeEnum *enum_;
|
GIrNodeEnum *enum_;
|
||||||
GIrNodeValue *value_;
|
GIrNodeValue *value_;
|
||||||
|
|
||||||
@ -1490,6 +1491,7 @@ start_member (GMarkupParseContext *context,
|
|||||||
name = find_attribute ("name", attribute_names, attribute_values);
|
name = find_attribute ("name", attribute_names, attribute_values);
|
||||||
value = find_attribute ("value", attribute_names, attribute_values);
|
value = find_attribute ("value", attribute_names, attribute_values);
|
||||||
deprecated = find_attribute ("deprecated", attribute_names, attribute_values);
|
deprecated = find_attribute ("deprecated", attribute_names, attribute_values);
|
||||||
|
c_identifier = find_attribute ("c:identifier", attribute_names, attribute_values);
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
{
|
{
|
||||||
@ -1509,6 +1511,10 @@ start_member (GMarkupParseContext *context,
|
|||||||
else
|
else
|
||||||
value_->deprecated = FALSE;
|
value_->deprecated = FALSE;
|
||||||
|
|
||||||
|
g_hash_table_insert (((GIrNode *)value_)->attributes,
|
||||||
|
g_strdup ("c:identifier"),
|
||||||
|
g_strdup (c_identifier));
|
||||||
|
|
||||||
enum_ = (GIrNodeEnum *)CURRENT_NODE (ctx);
|
enum_ = (GIrNodeEnum *)CURRENT_NODE (ctx);
|
||||||
enum_->values = g_list_append (enum_->values, value_);
|
enum_->values = g_list_append (enum_->values, value_);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user