GSimpleAsyncResult is deprecated in favor of the simpler GTask, so use
that instead. This cuts down on the deprecation warnings.
I wanted to do both separately, but porting one without the other led to
some faulty casts from GSimpleAsyncResult to GTask (and vice versa).
Apart from having more developer-friendly messages if the assertions go
wrong, it also prevents the assertions not being run if
`G_DISABLE_ASSERT` is defined (e.g. for performance reasons).
Some distributions patch libgcrypt to provide a pkg-config file, and
disable libgcrypt-config. One of these distributions is Yocto, which we
use as the basis for the GNOME Continuous build environment.
We should check if there's a pkg-config file available for gcrypt, and
use it, falling back to libgcrypt-config if the pkg-config file is not
found.
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