#include <gnome-keyring.h>
#include <stdio.h>

int main() {
	char* defkeyring;
	
	/* get the default keyring */

	int ret = gnome_keyring_get_default_keyring_sync(&defkeyring);
	if (ret) return ret;
	printf("default keyring: '%s'\n", defkeyring);
	
	unsigned int id;
	ret = gnome_keyring_set_network_password_sync(defkeyring,
						"testuser",
						"testdomain",
						"testserver",
						"testobj",
						"testproto",
						"testauthtype",
						1234,
						"testpassword",
						&id);
	if (ret) return ret;	
	printf("successfully create new entry, id=%d\n", id);

	GList *list, *ll;
	ret = gnome_keyring_find_network_password_sync(
						"testuser",
						"testdomain",
						"testserver",
						"testobj",
						"testproto",
						"testauthtype",
						1234,
						&list);
	if (ret) return ret;	
	
	for (ll = list; ll != NULL; ll = ll->next) {
		GnomeKeyringNetworkPasswordData *d = (GnomeKeyringNetworkPasswordData *) ll->data;
		printf("found item in keyring %s\n", d->keyring);
	}	
	printf("Done.\n");
	return 0;
}
