Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <gnome-keyring.h>
- int main() {
- GnomeKeyringResult lock_result = gnome_keyring_lock_all_sync();
- if (lock_result == GNOME_KEYRING_RESULT_OK) {
- printf("Successfully lockedn");
- return 0;
- } else {
- printf("Error locking keyring: %dn", lock_result);
- return 1;
- }
- }
- #include <stdio.h>
- #include <gnome-keyring.h>
- int main() {
- GnomeKeyringResult lock_result = gnome_keyring_unlock_sync(NULL,NULL);
- if (lock_result == GNOME_KEYRING_RESULT_OK) {
- printf("Successfully unlockedn");
- return 0;
- } else {
- printf("Error unlocking keyring: %dn", lock_result);
- return 1;
- }
- }
- #include <stdio.h>
- #include <gnome-keyring.h>
- int main() {
- GnomeKeyringInfo *info;
- GnomeKeyringResult gkr;
- gkr = gnome_keyring_get_info_sync(NULL, &info);
- if (gkr != GNOME_KEYRING_RESULT_OK) {
- printf("errorn");
- return -1;
- }
- if (gnome_keyring_info_get_is_locked(info)) {
- printf("lockedn");
- return 0;
- }
- else {
- printf("unlockedn");
- return -1;
- }
- gnome_keyring_info_free(info);
- }
- import gnomekeyring
- print gnomekeyring.get_info_sync(gnomekeyring.get_default_keyring_sync()).get_is_locked()
- cc gkey-check.c -o gkey-check -Wall -I/usr/include/gnome-keyring-1 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -lgnome-keyring -lglib-2.0
Add Comment
Please, Sign In to add comment