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.
Normally it shouldn't matter too much, but the GIR parser apparently
doesn't like it:
```
/home/niels/gnome/libsecret/libsecret/secret-schema.h:75: syntax error, unexpected ';' in ';' at ';'
/home/niels/gnome/libsecret/libsecret/secret-prompt.h:78: syntax error, unexpected ';' in ';' at ';'
/home/niels/gnome/libsecret/libsecret/secret-value.h:54: syntax error, unexpected ';' in ';' at ';'
/home/niels/gnome/libsecret/libsecret/secret-service.h:307: syntax error, unexpected ';' in ';' at ';'
/home/niels/gnome/libsecret/libsecret/secret-collection.h:176: syntax error, unexpected ';' in ';' at ';'
/home/niels/gnome/libsecret/libsecret/secret-item.h:194: syntax error, unexpected ';' in ';' at ';'
```
g_autoptr() is a macro that was defined in GLib 2.44 that allows for
basic auto-cleanup of variables. One way to add this kind of support
would be through the use of e.g. `G_DECLARE_DERIVABLE_TYPE()` for our
declarations, but this would consitute an ABI break (due to the
`...Private *` field in the public structs). Instead, we can use
`G_DEFINE_AUTOPTR_CLEANUP_FUNC` to manually declare this.
This commit also bumps the minimally required GLib version to 2.44
Initialize the schema_name so that NULL is returned when the schema name
is absent, instead of an uninitialized memory. Mark return value as
nullable to indicate this for introspection and documentation.
Previously there were no functions in the simple API that return the
matched attributes other than the secret value, while there were needs
for augumenting user input with additional information (such as
completing web forms).
This adds a set of functions which wrap secret_service_search*. Note
that the return value is a list of GHashTable not of SecretItem,
because SecretItem is a subclass of GDBusProxy, which we don't want to
expose from the simple API.
Fixes#16