Use proper prefix for SecretCollection flags

Commit f36379af33 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.
This commit is contained in:
Emmanuele Bassi 2019-05-11 00:15:04 +01:00
parent 64f63a76fe
commit 15902b70b2

View File

@ -27,12 +27,12 @@
G_BEGIN_DECLS
typedef enum {
typedef enum { /*< prefix=SECRET_COLLECTION >*/
SECRET_COLLECTION_NONE = 0 << 0,
SECRET_COLLECTION_LOAD_ITEMS = 1 << 1,
} SecretCollectionFlags;
typedef enum {
typedef enum { /*< prefix=SECRET_COLLECTION_CREATE >*/
SECRET_COLLECTION_CREATE_NONE = 0 << 0,
} SecretCollectionCreateFlags;