From 15902b70b2e67dbc9d9b1e29f61fb2b18781512f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sat, 11 May 2019 00:15:04 +0100 Subject: [PATCH] Use proper prefix for SecretCollection flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit f36379af33f1312471144efe662535786fcf7edd 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. --- libsecret/secret-collection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsecret/secret-collection.h b/libsecret/secret-collection.h index 1f88977..f16e62a 100644 --- a/libsecret/secret-collection.h +++ b/libsecret/secret-collection.h @@ -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;