mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
xml: Fix flags and enums
GtkBuilder XML uses enum nicknames, full names, or integer values, but we accept GIR names, so passing those through doesn't work if the name has an underscore (which traditionally turns into a dash in the nickname). Avoid the problem by always writing the integer value of the enum member.
This commit is contained in:
parent
51d8969ced
commit
6c67e1fc5a
11 changed files with 34 additions and 14 deletions
|
@ -127,7 +127,11 @@ class DecompileCtx:
|
|||
def print_attribute(self, name, value, type):
|
||||
def get_enum_name(value):
|
||||
for member in type.members.values():
|
||||
if member.nick == value or member.c_ident == value:
|
||||
if (
|
||||
member.nick == value
|
||||
or member.c_ident == value
|
||||
or str(member.value) == value
|
||||
):
|
||||
return member.name
|
||||
return value.replace("-", "_")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue