[gcr] gck: Add gck_slot_enumerate_objects() function
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr] gck: Add gck_slot_enumerate_objects() function
- Date: Wed, 12 Oct 2011 11:17:41 +0000 (UTC)
commit 119d3232310824ad7ed3a72c6e77fce3bf30f5fa
Author: Stef Walter <stefw collabora co uk>
Date: Wed Oct 12 13:17:25 2011 +0200
gck: Add gck_slot_enumerate_objects() function
docs/reference/gck/gck-sections.txt | 1 +
gck/gck-slot.c | 38 +++++++++++++++++++++++++++++++---
gck/gck.h | 6 ++++-
3 files changed, 40 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gck/gck-sections.txt b/docs/reference/gck/gck-sections.txt
index 6482a6d..00c2dd6 100644
--- a/docs/reference/gck/gck-sections.txt
+++ b/docs/reference/gck/gck-sections.txt
@@ -135,6 +135,7 @@ gck_slot_get_token_info
gck_slot_get_mechanisms
gck_slot_get_mechanism_info
gck_slot_has_flags
+gck_slot_enumerate_objects
gck_slots_enumerate_objects
gck_slot_open_session
gck_slot_open_session_full
diff --git a/gck/gck-slot.c b/gck/gck-slot.c
index b937ca8..65cf5b3 100644
--- a/gck/gck-slot.c
+++ b/gck/gck-slot.c
@@ -999,9 +999,39 @@ gck_slot_set_interaction (GckSlot *self,
}
/**
+ * gck_slot_enumerate_objects:
+ * @self: a #GckSlot to enumerate objects on
+ * @match: attributes that the objects must match, or empty for all objects
+ * @options: options for opening a session
+ *
+ * Setup an enumerator for listing matching objects on the slot.
+ *
+ * This call will not block but will return an enumerator immediately.
+ *
+ * Returns: (transfer full): a new enumerator
+ **/
+GckEnumerator *
+gck_slot_enumerate_objects (GckSlot *self,
+ GckAttributes *match,
+ GckSessionOptions options)
+{
+ GList *slots = NULL;
+ GckEnumerator *enumerator;
+
+ g_return_val_if_fail (GCK_IS_SLOT (self), NULL);
+ g_return_val_if_fail (match != NULL, NULL);
+
+ slots = g_list_append (slots, self);
+ enumerator = gck_slots_enumerate_objects (slots, match, options);
+ g_list_free (slots);
+
+ return enumerator;
+}
+
+/**
* gck_slots_enumerate_objects:
* @slots: (element-type Gck.Slot): a list of #GckSlot to enumerate objects on.
- * @attrs: Attributes that the objects must have, or empty for all objects.
+ * @match: attributes that the objects must match, or empty for all objects
* @options: options for opening a session
*
* Setup an enumerator for listing matching objects on the slots.
@@ -1012,15 +1042,15 @@ gck_slot_set_interaction (GckSlot *self,
**/
GckEnumerator*
gck_slots_enumerate_objects (GList *slots,
- GckAttributes *attrs,
+ GckAttributes *match,
GckSessionOptions options)
{
GckUriData *uri_data;
- g_return_val_if_fail (attrs, NULL);
+ g_return_val_if_fail (match != NULL, NULL);
uri_data = gck_uri_data_new ();
- uri_data->attributes = gck_attributes_ref (attrs);
+ uri_data->attributes = gck_attributes_ref (match);
return _gck_enumerator_new (slots, options, uri_data);
}
diff --git a/gck/gck.h b/gck/gck.h
index 4b02220..aab785e 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -651,8 +651,12 @@ GckSession* gck_slot_open_session_finish (GckSlot *self,
GAsyncResult *result,
GError **error);
+GckEnumerator * gck_slot_enumerate_objects (GckSlot *self,
+ GckAttributes *match,
+ GckSessionOptions options);
+
GckEnumerator* gck_slots_enumerate_objects (GList *slots,
- GckAttributes *attrs,
+ GckAttributes *match,
GckSessionOptions options);
/* ------------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]