From e13b8c468083093f84be5ab9235dda2699f3f56d Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 25 Jun 2012 10:17:16 +0200 Subject: [PATCH] Add methods to get services from collections, items * Add secret_collection_get_service() * Add secret_item_get_service() --- docs/reference/libsecret/libsecret-sections.txt | 2 ++ library/secret-collection.c | 15 +++++++++++++++ library/secret-collection.h | 2 ++ library/secret-item.c | 16 ++++++++++++++++ library/secret-item.h | 2 ++ 5 files changed, 37 insertions(+) diff --git a/docs/reference/libsecret/libsecret-sections.txt b/docs/reference/libsecret/libsecret-sections.txt index 7f23f23..98de4c8 100644 --- a/docs/reference/libsecret/libsecret-sections.txt +++ b/docs/reference/libsecret/libsecret-sections.txt @@ -13,6 +13,7 @@ secret_collection_delete secret_collection_delete_finish secret_collection_delete_sync secret_collection_get_created +secret_collection_get_service secret_collection_get_items secret_collection_get_label secret_collection_set_label @@ -57,6 +58,7 @@ secret_item_set_label_finish secret_item_set_label_sync secret_item_get_locked secret_item_get_modified +secret_item_get_service secret_item_get_secret secret_item_get_secret_finish secret_item_get_secret_sync diff --git a/library/secret-collection.c b/library/secret-collection.c index 52d153a..251ac0b 100644 --- a/library/secret-collection.c +++ b/library/secret-collection.c @@ -1170,6 +1170,21 @@ secret_collection_delete_sync (SecretCollection *self, return ret; } +/** + * secret_collection_get_service: + * @self: a collection + * + * Get the Secret Service object that this collection was created with. + * + * Returns: (transfer none): the Secret Service object + */ +SecretService * +secret_collection_get_service (SecretCollection *self) +{ + g_return_val_if_fail (SECRET_IS_COLLECTION (self), NULL); + return self->pv->service; +} + /** * secret_collection_get_items: * @self: a collection diff --git a/library/secret-collection.h b/library/secret-collection.h index 9e916eb..9f9b617 100644 --- a/library/secret-collection.h +++ b/library/secret-collection.h @@ -96,6 +96,8 @@ gboolean secret_collection_delete_sync (SecretCollection GCancellable *cancellable, GError **error); +SecretService * secret_collection_get_service (SecretCollection *self); + GList * secret_collection_get_items (SecretCollection *self); gchar * secret_collection_get_label (SecretCollection *self); diff --git a/library/secret-item.c b/library/secret-item.c index fa433eb..d0fa861 100644 --- a/library/secret-item.c +++ b/library/secret-item.c @@ -937,6 +937,22 @@ secret_item_delete_sync (SecretItem *self, return ret; } +/** + * secret_item_get_service: + * @self: an item + * + * Get the Secret Service object that this item was created with. + * + * Returns: (transfer none): the Secret Service object + */ +SecretService * +secret_item_get_service (SecretItem *self) +{ + g_return_val_if_fail (SECRET_IS_COLLECTION (self), NULL); + return self->pv->service; +} + + typedef struct { GCancellable *cancellable; SecretValue *value; diff --git a/library/secret-item.h b/library/secret-item.h index 12af0d7..90744cc 100644 --- a/library/secret-item.h +++ b/library/secret-item.h @@ -102,6 +102,8 @@ gboolean secret_item_delete_sync (SecretItem *self, GCancellable *cancellable, GError **error); +SecretService * secret_item_get_service (SecretItem *self); + void secret_item_get_secret (SecretItem *self, GCancellable *cancellable, GAsyncReadyCallback callback,