From 8304598583fd80f0bbc7d3c4b21d53581478985c Mon Sep 17 00:00:00 2001 From: Laszlo Pandy Date: Tue, 22 Feb 2011 16:02:12 +0100 Subject: [PATCH] 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 --- girparser.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/girparser.c b/girparser.c index be74e0bbd..e32acc0dc 100644 --- a/girparser.c +++ b/girparser.c @@ -1480,6 +1480,7 @@ start_member (GMarkupParseContext *context, const gchar *name; const gchar *value; const gchar *deprecated; + const gchar *c_identifier; GIrNodeEnum *enum_; GIrNodeValue *value_; @@ -1490,6 +1491,7 @@ start_member (GMarkupParseContext *context, name = find_attribute ("name", attribute_names, attribute_values); value = find_attribute ("value", 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) { @@ -1509,6 +1511,10 @@ start_member (GMarkupParseContext *context, else value_->deprecated = FALSE; + g_hash_table_insert (((GIrNode *)value_)->attributes, + g_strdup ("c:identifier"), + g_strdup (c_identifier)); + enum_ = (GIrNodeEnum *)CURRENT_NODE (ctx); enum_->values = g_list_append (enum_->values, value_);