Skip to content

Use proper prefix for SecretCollection flags

Emmanuele Bassi requested to merge collection-enums-prefix into master

Commit f36379af added the enumeration GType for SecretCollectionFlags and SecretCollectionCreateFlags in the introspection data, but by doing so it broke existing users of the introspected API.

Additionally, the enumeration nicknames—which are used to generate the enumeration value from the type name and the namespace—were wrong before, and are wrong now. The idiomatic way to name enumeration members is to use the uppercase, snake case version of the type name, and append the value at the end:

SecretCollectionFlags → SECRET_COLLECTION_FLAGS_NONE SecretCollectionCreateFlags → SECRET_COLLECTION_CREATE_FLAGS_NONE

If this practice is not followed, enumerations should use the glib-mkenums trigraph and the prefix option; this tells glib-mkenums, and the introspection parser after that, where to cut off the prefix and which part of the enumeration value should be considered the nickname.

Thus, with prefix=SECRET_COLLECTION we can turn:

SECRET_COLLECTION_NONE

into:

Secret.CollectionFlags.NONE

which is the idiomatic form of an enumeration value.

Merge request reports