Skip to content
Snippets Groups Projects
Unverified Commit ab0a0c30 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

add a tiny tool

parent 8ec8c11c
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,12 @@ Then, add the following command to gnome-autostart. You should know how to auto-
You're all set! Re-login and have a try!
## FAQ
- Keyring not exist? The name is correct.
run `tools/list_keyrings.sh` to check name of your keyrings. The `login` keyring may be shown as `登录` based on your locale.
## TODO
This program is using deprecated `libgnome-keyring-1` rather than `libsecret`, only because the author can not understand how to use `libsecret`. There's almost no document! (If you think auto-generated document is document, then all source code are well documented. )
......@@ -43,9 +43,9 @@ int main(int argc, char **argv) {
auto res = do_unlock(keyring_and_pswd.at(0), keyring_and_pswd.at(1));
auto msg = keyringResultToString(res);
if(res == GNOME_KEYRING_RESULT_OK)
rlog.info("line {}: {}.", line_num, msg);
rlog.info("line {}: Working on keyring `{}`: {}.", line_num, keyring_and_pswd.at(0), msg);
else {
rlog.error("line {}: {}.", line_num, msg);
rlog.error("line {}: Working on keyring `{}`: {}.", line_num, keyring_and_pswd.at(0), msg);
no_error = false;
}
......
// You can use this naive program to know keyring names.
// eval g++ (pkg-config --cflags --libs gnome-keyring-1) list.cc -o s
#include <gnome-keyring-1/gnome-keyring.h>
#include <iostream>
int main() {
GList *pRes = nullptr;
GnomeKeyringResult res = gnome_keyring_list_keyring_names_sync(&pRes);
for(int i = 0; i < g_list_length(pRes); ++i) {
gpointer dat = g_list_nth_data(pRes, i);
gchar *gs = (gchar *)dat;
std::cout << gs << std::endl;
}
}
#!/bin/bash
eval g++ $(pkg-config --cflags --libs gnome-keyring-1) list_keyrings.cc -o list.out &&
./list.out
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment