Optionally return error message from wxSecretStore::IsOk()

This allows to give at least some explanation about why the secrets
can't be stored to the user, e.g. they could search for a message such
as

The name org.freedesktop.secrets was not provided by any .service files

to find out that gnome-keyring package needs to be installed on their
system.

Note that this change means that under Unix an attempt to connect to the
secret service is now made when wxSecretStore is constructed and not
just when it's used for the first time, as before.
This commit is contained in:
Vadim Zeitlin
2020-02-10 18:23:59 +01:00
parent fd84892e62
commit 5a454d373b
6 changed files with 120 additions and 13 deletions

View File

@@ -196,9 +196,11 @@ int main(int argc, char **argv)
}
wxSecretStore store = wxSecretStore::GetDefault();
if ( !store.IsOk() )
wxString errmsg;
if ( !store.IsOk(&errmsg) )
{
wxFprintf(stderr, "Failed to create default secret store.\n");
wxFprintf(stderr, "Failed to create default secret store (%s)\n",
errmsg);
return EXIT_FAILURE;
}