[gnome-keyring] gck: More introspection tweaks, checking for parameters which allow none



commit cd72f81f26e7d3bd1c03261c486f40107be3b5b7
Author: Stef Walter <stefw collabora co uk>
Date:   Thu Sep 29 16:28:10 2011 +0200

    gck: More introspection tweaks, checking for parameters which allow none

 gck/gck-attributes.c               |    6 ++--
 gck/gck-misc.c                     |    4 +-
 gck/gck-module.c                   |    4 ++-
 gck/gck-modules.c                  |   14 +++++++--
 gck/gck-object.c                   |    6 +---
 gck/gck-session.c                  |   52 ++++++++++++++++++++++--------------
 gck/gck-slot.c                     |   11 +++++--
 gck/gck-uri.c                      |    2 +-
 gck/gck.h                          |   24 ++++++++--------
 gcr/gcr-certificate-chain.c        |   32 +++++++++++++---------
 gcr/gcr-certificate-chain.h        |    3 +-
 gcr/gcr-certificate-renderer.c     |   12 ++++----
 gcr/gcr-certificate-widget.c       |   10 +++---
 gcr/gcr-certificate.c              |   47 ++++++++++++++++++++------------
 gcr/gcr-collection-model.c         |    6 ++--
 gcr/gcr-combo-selector.c           |    2 +-
 gcr/gcr-failure-renderer.c         |    2 +-
 gcr/gcr-gnupg-collection.c         |    2 +-
 gcr/gcr-gnupg-importer.c           |    1 +
 gcr/gcr-gnupg-process.c            |   10 +++---
 gcr/gcr-import-button.c            |    2 +-
 gcr/gcr-key-renderer.c             |    8 +++---
 gcr/gcr-key-widget.c               |    6 ++--
 gcr/gcr-library.c                  |    8 +++---
 gcr/gcr-live-search.c              |    1 +
 gcr/gcr-menu-button.c              |    1 +
 gcr/gcr-parser.c                   |   39 ++++++++++++++------------
 gcr/gcr-renderer.c                 |    6 ++--
 gcr/gcr-types.h                    |    1 +
 gcr/gcr-viewer-widget.c            |    2 +-
 gcr/gcr-viewer.c                   |    2 +-
 gcr/tests/test-certificate-chain.c |    2 +-
 32 files changed, 189 insertions(+), 139 deletions(-)
---
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index cee4d8c..de64d3f 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -486,8 +486,8 @@ gck_attribute_get_ulong (GckAttribute *attr)
  * to this function unless you're know it's supposed to contain
  * a value of the right type.
  *
- * Return value: A null terminated string, to be freed with g_free(),
- * or NULL if the value contained a NULL string.
+ * Return value: (allow-none): a null terminated string, to be freed with
+ *               g_free(), or %NULL if the value was invalid
  */
 gchar*
 gck_attribute_get_string (GckAttribute *attr)
@@ -785,7 +785,7 @@ gck_attributes_new_full (GckAllocator allocator)
 }
 
 /**
- * gck_attributes_new_empty:
+ * gck_attributes_new_empty: (skip)
  * @attr_type: The first attribute type to add as empty.
  * @...: The arguments should be values of attribute types, terminated with gck_INVALID.
  *
diff --git a/gck/gck-misc.c b/gck/gck-misc.c
index ca8fcd5..595f619 100644
--- a/gck/gck-misc.c
+++ b/gck/gck-misc.c
@@ -280,7 +280,7 @@ gck_list_ref_copy (GList *reflist)
 }
 
 /**
- * gck_string_from_chars:
+ * gck_string_from_chars: (skip)
  * @data: The character data to turn into a null terminated string.
  * @max: The maximum length of the charater data.
  *
@@ -312,7 +312,7 @@ gck_string_from_chars (const guchar *data, gsize max)
 }
 
 /**
- * gck_string_to_chars:
+ * gck_string_to_chars: (skip)
  * @data: The character buffer to place string into.
  * @max: The maximum length of the charater buffer.
  * @string: The string to place in the buffer.
diff --git a/gck/gck-module.c b/gck/gck-module.c
index 524f331..8806dd7 100644
--- a/gck/gck-module.c
+++ b/gck/gck-module.c
@@ -531,6 +531,8 @@ gck_module_initialize_async (const gchar *path,
 {
 	Initialize *args;
 
+	g_return_if_fail (path != NULL);
+
 	args =  _gck_call_async_prep (NULL, NULL, perform_initialize, NULL,
 	                              sizeof (*args), free_initialize);
 	args->path = g_strdup (path);
@@ -584,7 +586,7 @@ gck_module_initialize_finish (GAsyncResult *result,
 GckModule*
 gck_module_new (CK_FUNCTION_LIST_PTR funcs)
 {
-	g_return_val_if_fail (funcs, NULL);
+	g_return_val_if_fail (funcs != NULL, NULL);
 	return g_object_new (GCK_TYPE_MODULE, "functions", funcs, NULL);
 }
 
diff --git a/gck/gck-modules.c b/gck/gck-modules.c
index 5c5ccb4..497d2ff 100644
--- a/gck/gck-modules.c
+++ b/gck/gck-modules.c
@@ -207,7 +207,9 @@ gck_modules_get_slots (GList *modules, gboolean token_present)
  * with g_object_unref().
  **/
 GckEnumerator*
-gck_modules_enumerate_objects (GList *modules, GckAttributes *attrs, guint session_options)
+gck_modules_enumerate_objects (GList *modules,
+                               GckAttributes *attrs,
+                               GckSessionOptions session_options)
 {
 	GckUriData *uri_data;
 
@@ -291,6 +293,8 @@ gck_modules_token_for_uri (GList *modules,
 	GList *results;
 	GckSlot *slot = NULL;
 
+	g_return_val_if_fail (uri != NULL, NULL);
+
 	results = tokens_for_uri (modules, uri, TRUE, error);
 	if (results)
 		slot = g_object_ref (results->data);
@@ -316,6 +320,8 @@ gck_modules_tokens_for_uri (GList *modules,
                             const gchar *uri,
                             GError **error)
 {
+	g_return_val_if_fail (uri != NULL, NULL);
+
 	return tokens_for_uri (modules, uri, FALSE, error);
 }
 
@@ -341,7 +347,7 @@ gck_modules_object_for_uri (GList *modules, const gchar *uri, guint session_opti
 	GckEnumerator *en;
 	GckObject *result;
 
-	g_return_val_if_fail (uri, NULL);
+	g_return_val_if_fail (uri != NULL, NULL);
 	g_return_val_if_fail (!error || !*error, NULL);
 
 	en = gck_modules_enumerate_uri (modules, uri, session_options, error);
@@ -377,7 +383,7 @@ gck_modules_objects_for_uri (GList *modules, const gchar *uri, guint session_opt
 	GckEnumerator *en;
 	GList *results;
 
-	g_return_val_if_fail (uri, NULL);
+	g_return_val_if_fail (uri != NULL, NULL);
 	g_return_val_if_fail (!error || !*error, NULL);
 
 	en = gck_modules_enumerate_uri (modules, uri, session_options, error);
@@ -410,6 +416,8 @@ gck_modules_enumerate_uri (GList *modules, const gchar *uri, guint session_optio
 {
 	GckUriData *uri_data;
 
+	g_return_val_if_fail (uri != NULL, NULL);
+
 	uri_data = gck_uri_parse (uri, GCK_URI_FOR_ANY, error);
 	if (uri_data == NULL)
 		return NULL;
diff --git a/gck/gck-object.c b/gck/gck-object.c
index ee89a45..7288760 100644
--- a/gck/gck-object.c
+++ b/gck/gck-object.c
@@ -505,7 +505,7 @@ gck_object_set (GckObject *self, GckAttributes *attrs,
 	gboolean ret = FALSE;
 
 	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
-	g_return_val_if_fail (attrs, FALSE);
+	g_return_val_if_fail (attrs != NULL, FALSE);
 	g_return_val_if_fail (!error || !*error, FALSE);
 
 	_gck_attributes_lock (attrs);
@@ -538,7 +538,7 @@ gck_object_set_async (GckObject *self, GckAttributes *attrs, GCancellable *cance
 	SetAttributes *args;
 
 	g_return_if_fail (GCK_IS_OBJECT (self));
-	g_return_if_fail (attrs);
+	g_return_if_fail (attrs != NULL);
 
 	args = _gck_call_async_prep (self->pv->session, self, perform_set_attributes,
 	                             NULL, sizeof (*args), free_set_attributes);
@@ -716,7 +716,6 @@ gck_object_get_full (GckObject *self, gulong *attr_types, guint n_attr_types,
 	guint i;
 
 	g_return_val_if_fail (GCK_IS_OBJECT (self), NULL);
-	g_return_val_if_fail (n_attr_types, NULL);
 	g_return_val_if_fail (!error || !*error, NULL);
 
 	attrs = gck_attributes_new ();
@@ -765,7 +764,6 @@ gck_object_get_async (GckObject *self, gulong *attr_types, guint n_attr_types, G
 	guint i;
 
 	g_return_if_fail (GCK_IS_OBJECT (self));
-	g_return_if_fail (n_attr_types);
 
 	attrs = gck_attributes_new ();
 	for (i = 0; i < n_attr_types; ++i)
diff --git a/gck/gck-session.c b/gck/gck-session.c
index 5ecfe09..eba1de6 100644
--- a/gck/gck-session.c
+++ b/gck/gck-session.c
@@ -578,7 +578,7 @@ gck_session_init_pin (GckSession *self, const guchar *pin, gsize n_pin,
 /**
  * gck_session_init_pin_async:
  * @self: Initialize PIN for this session's slot.
- * @pin: The user's PIN, or NULL for protected authentication path.
+ * @pin: (allow-none) (array length=n_pin): The user's PIN, or NULL for protected authentication path.
  * @n_pin: The length of the PIN.
  * @cancellable: Optional cancellation object, or NULL.
  * @callback: Called when the operation completes.
@@ -650,9 +650,11 @@ perform_set_pin (SetPin *args)
 /**
  * gck_session_set_pin:
  * @self: Change the PIN for this session's slot.
- * @old_pin: The user's old PIN, or NULL for protected authentication path.
+ * @old_pin: (allow-none) (array length=n_old_pin): the user's old PIN, or %NULL
+ *           for protected authentication path.
  * @n_old_pin: The length of the PIN.
- * @new_pin: The user's new PIN, or NULL for protected authentication path.
+ * @new_pin: (allow-none) (array length=n_new_pin): the user's new PIN, or %NULL
+ *           for protected authentication path
  * @n_new_pin: The length of the PIN.
  * @cancellable: Optional cancellation object, or NULL.
  * @error: A location to return an error.
@@ -748,7 +750,8 @@ perform_login (Login *args)
  * gck_session_login:
  * @self: Log in to this session.
  * @user_type: The type of login user.
- * @pin: The user's PIN, or NULL for protected authentication path.
+ * @pin: (allow-none) (array length=n_pin): the user's PIN, or %NULL for
+ *       protected authentication path
  * @n_pin: The length of the PIN.
  * @cancellable: Optional cancellation object, or NULL.
  * @error: A location to return an error.
@@ -771,7 +774,8 @@ gck_session_login (GckSession *self, gulong user_type, const guchar *pin,
  * gck_session_login_async:
  * @self: Log in to this session.
  * @user_type: The type of login user.
- * @pin: The user's PIN, or NULL for protected authentication path.
+ * @pin: (allow-none) (array length=n_pin): the user's PIN, or %NULL for
+ *       protected authentication path
  * @n_pin: The length of the PIN.
  * @cancellable: Optional cancellation object, or NULL.
  * @callback: Called when the operation completes.
@@ -937,7 +941,7 @@ gck_session_create_object (GckSession *self, GckAttributes *attrs,
 	gboolean ret;
 
 	g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
-	g_return_val_if_fail (attrs, NULL);
+	g_return_val_if_fail (attrs != NULL, NULL);
 
 	_gck_attributes_lock (attrs);
 	ret = _gck_call_sync (self, perform_create_object, NULL, &args, cancellable, error);
@@ -2263,9 +2267,10 @@ crypt_finish (GckSession *self, GAsyncResult *result, gsize *n_result, GError **
  * Encrypt data in a mechanism specific manner. This call may
  * block for an indefinite period.
  *
- * Returns: The data that was encrypted, or NULL if an error occured.
+ * Returns: (transfer full) (array length=n_result): the data that was encrypted,
+ *          or %NULL if an error occured.
  */
-guchar*
+guchar *
 gck_session_encrypt (GckSession *self, GckObject *key, gulong mech_type, const guchar *input,
                       gsize n_input, gsize *n_result, GCancellable *cancellable, GError **error)
 {
@@ -2287,9 +2292,10 @@ gck_session_encrypt (GckSession *self, GckObject *key, gulong mech_type, const g
  * Encrypt data in a mechanism specific manner. This call may
  * block for an indefinite period.
  *
- * Returns: The data that was encrypted, or NULL if an error occured.
+ * Returns: (transfer full) (array length=n_result): the data that was encrypted,
+ *          or %NULL if an error occured
  */
-guchar*
+guchar *
 gck_session_encrypt_full (GckSession *self, GckObject *key, GckMechanism *mechanism,
                            const guchar *input, gsize n_input, gsize *n_result,
                            GCancellable *cancellable, GError **error)
@@ -2354,7 +2360,8 @@ gck_session_encrypt_async (GckSession *self, GckObject *key, GckMechanism *mecha
  *
  * Get the result of an encryption operation.
  *
- * Returns: The data that was encrypted, or NULL if an error occurred.
+ * Returns: (transfer full) (array length=n_result): the data that was encrypted,
+ *          or %NULL if an error occurred.
  */
 guchar*
 gck_session_encrypt_finish (GckSession *self, GAsyncResult *result, gsize *n_result,
@@ -2381,9 +2388,10 @@ gck_session_encrypt_finish (GckSession *self, GAsyncResult *result, gsize *n_res
  * Decrypt data in a mechanism specific manner. This call may
  * block for an indefinite period.
  *
- * Returns: The data that was decrypted, or NULL if an error occured.
+ * Returns: (transfer full) (array length=n_result): the data that was decrypted,
+ *          or NULL if an error occured
  */
-guchar*
+guchar *
 gck_session_decrypt (GckSession *self, GckObject *key, gulong mech_type, const guchar *input,
                       gsize n_input, gsize *n_result, GCancellable *cancellable, GError **error)
 {
@@ -2405,9 +2413,10 @@ gck_session_decrypt (GckSession *self, GckObject *key, gulong mech_type, const g
  * Decrypt data in a mechanism specific manner. This call may
  * block for an indefinite period.
  *
- * Returns: The data that was decrypted, or NULL if an error occured.
+ * Returns: (transfer full) (array length=n_result): the data that was decrypted,
+ *          or %NULL if an error occured
  */
-guchar*
+guchar *
 gck_session_decrypt_full (GckSession *self, GckObject *key, GckMechanism *mechanism,
                            const guchar *input, gsize n_input, gsize *n_result,
                            GCancellable *cancellable, GError **error)
@@ -2470,7 +2479,8 @@ gck_session_decrypt_async (GckSession *self, GckObject *key, GckMechanism *mecha
  *
  * Get the result of an decryption operation.
  *
- * Returns: The data that was decrypted, or NULL if an error occurred.
+ * Returns: (transfer full) (array length=n_result): the data that was decrypted,
+ *          or NULL if an error occurred
  */
 guchar*
 gck_session_decrypt_finish (GckSession *self, GAsyncResult *result,
@@ -2497,9 +2507,10 @@ gck_session_decrypt_finish (GckSession *self, GAsyncResult *result,
  * Sign data in a mechanism specific manner. This call may
  * block for an indefinite period.
  *
- * Returns: The data that was signed, or NULL if an error occured.
+ * Returns: (transfer full) (array length=n_result): the data that was signed,
+ *          or %NULL if an error occured
  */
-guchar*
+guchar *
 gck_session_sign (GckSession *self, GckObject *key, gulong mech_type, const guchar *input,
                    gsize n_input, gsize *n_result, GCancellable *cancellable, GError **error)
 {
@@ -2586,9 +2597,10 @@ gck_session_sign_async (GckSession *self, GckObject *key, GckMechanism *mechanis
  *
  * Get the result of an signing operation.
  *
- * Returns: The data that was signed, or NULL if an error occurred.
+ * Returns: (transfer full) (array length=n_result): the data that was signed,
+ *          or %NULL if an error occurred
  */
-guchar*
+guchar *
 gck_session_sign_finish (GckSession *self, GAsyncResult *result,
                           gsize *n_result, GError **error)
 {
diff --git a/gck/gck-slot.c b/gck/gck-slot.c
index f7b393f..16f0ec8 100644
--- a/gck/gck-slot.c
+++ b/gck/gck-slot.c
@@ -1027,7 +1027,9 @@ free_open_session (OpenSession *args)
  * Returns: (transfer full): a new session or %NULL if an error occurs
  **/
 GckSession *
-gck_slot_open_session (GckSlot *self, guint options, GCancellable *cancellable,
+gck_slot_open_session (GckSlot *self,
+                       GckSessionOptions options,
+                       GCancellable *cancellable,
                        GError **error)
 {
 	return gck_slot_open_session_full (self, options, 0, NULL, NULL, cancellable, error);
@@ -1098,8 +1100,11 @@ gck_slot_open_session_full (GckSlot *self, guint options, gulong pkcs11_flags, g
  * This call will return immediately and complete asynchronously.
  **/
 void
-gck_slot_open_session_async (GckSlot *self, guint options, GCancellable *cancellable,
-                             GAsyncReadyCallback callback, gpointer user_data)
+gck_slot_open_session_async (GckSlot *self,
+                             GckSessionOptions options,
+                             GCancellable *cancellable,
+                             GAsyncReadyCallback callback,
+                             gpointer user_data)
 {
 	gck_slot_open_session_full_async (self, options, 0UL, NULL, NULL, cancellable, callback, user_data);
 }
diff --git a/gck/gck-uri.c b/gck/gck-uri.c
index aa7f41c..3d66c83 100644
--- a/gck/gck-uri.c
+++ b/gck/gck-uri.c
@@ -278,7 +278,7 @@ gck_uri_build (GckUriData *uri_data, GckUriFlags flags)
 	int res;
 	guint i;
 
-	g_return_val_if_fail (uri_data, NULL);
+	g_return_val_if_fail (uri_data != NULL, NULL);
 
 	p11_uri = p11_kit_uri_new ();
 
diff --git a/gck/gck.h b/gck/gck.h
index f071ed8..0401f11 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -76,6 +76,13 @@ gchar*              gck_string_from_chars                   (const guchar *data,
 
 typedef gpointer    (*GckAllocator)                         (gpointer data, gsize length);
 
+typedef enum {
+	GCK_SESSION_READ_ONLY = 0,
+	GCK_SESSION_READ_WRITE = 1 << 1,
+	GCK_SESSION_LOGIN_USER =  1 << 2,
+	GCK_SESSION_AUTHENTICATE = 1 << 3,
+} GckSessionOptions;
+
 typedef struct _GckMechanism GckMechanism;
 
 struct _GckMechanism {
@@ -370,7 +377,7 @@ GList*                gck_modules_get_slots                   (GList *modules,
 
 GckEnumerator*        gck_modules_enumerate_objects           (GList *modules,
                                                                GckAttributes *attrs,
-                                                               guint session_options);
+                                                               GckSessionOptions session_options);
 
 GckSlot*              gck_modules_token_for_uri               (GList *modules,
                                                                const gchar *uri,
@@ -382,17 +389,17 @@ GList *               gck_modules_tokens_for_uri              (GList *modules,
 
 GckObject*            gck_modules_object_for_uri              (GList *modules,
                                                                const gchar *uri,
-                                                               guint session_options,
+                                                               GckSessionOptions session_options,
                                                                GError **error);
 
 GList*                gck_modules_objects_for_uri             (GList *modules,
                                                                const gchar *uri,
-                                                               guint session_options,
+                                                               GckSessionOptions session_options,
                                                                GError **error);
 
 GckEnumerator*        gck_modules_enumerate_uri               (GList *modules,
                                                                const gchar *uri,
-                                                               guint session_options,
+                                                               GckSessionOptions session_options,
                                                                GError **error);
 
 
@@ -582,7 +589,7 @@ gboolean            gck_slot_has_flags                      (GckSlot *self,
 
 GckEnumerator*      gck_slots_enumerate_objects             (GList *slots,
                                                              GckAttributes *attrs,
-                                                             guint session_options);
+                                                             GckSessionOptions session_options);
 
 GckSession*         gck_slot_open_session                   (GckSlot *self,
                                                              guint options,
@@ -620,13 +627,6 @@ GckSession*         gck_slot_open_session_finish            (GckSlot *self,
  * SESSION
  */
 
-typedef enum {
-	GCK_SESSION_READ_ONLY = 0,
-	GCK_SESSION_READ_WRITE = 1 << 1,
-	GCK_SESSION_LOGIN_USER =  1 << 2,
-	GCK_SESSION_AUTHENTICATE = 1 << 3,
-} GckSessionOptions;
-
 typedef struct _GckSessionInfo GckSessionInfo;
 
 struct _GckSessionInfo {
diff --git a/gcr/gcr-certificate-chain.c b/gcr/gcr-certificate-chain.c
index 7ccf495..dab8d77 100644
--- a/gcr/gcr-certificate-chain.c
+++ b/gcr/gcr-certificate-chain.c
@@ -234,7 +234,7 @@ perform_build_chain (GcrCertificateChainPrivate *pv, GCancellable *cancellable,
 	g_assert (pv->certificates);
 
 	pv->status = GCR_CERTIFICATE_CHAIN_UNKNOWN;
-	lookups = !((pv->flags & GCR_CERTIFICATE_CHAIN_FLAG_NO_LOOKUPS) == GCR_CERTIFICATE_CHAIN_FLAG_NO_LOOKUPS);
+	lookups = !((pv->flags & GCR_CERTIFICATE_CHAIN_NO_LOOKUPS) == GCR_CERTIFICATE_CHAIN_NO_LOOKUPS);
 
 	/* This chain is built */
 	if (!pv->certificates->len) {
@@ -498,7 +498,7 @@ gcr_certificate_chain_class_init (GcrCertificateChainClass *klass)
 
 /**
  * GcrCertificateChainFlags:
- * @GCR_CERTIFICATE_CHAIN_FLAG_NO_LOOKUPS: If this flag is specified then no
+ * @GCR_CERTIFICATE_CHAIN_NO_LOOKUPS: If this flag is specified then no
  * lookups for anchors or pinned certificates are done, and the resulting chain
  * will be neither anchored or pinned. Additionally no missing certificate
  * authorities are looked up in PKCS\#11.
@@ -652,7 +652,7 @@ gcr_certificate_chain_get_certificate (GcrCertificateChain *self, guint index)
  * gcr_certificate_chain_build:
  * @self: the #GcrCertificateChain
  * @purpose: the purpose the certificate chain will be used for
- * @peer: the peer the certificate chain will be used with, or NULL
+ * @peer: (allow-none): the peer the certificate chain will be used with, or %NULL
  * @flags: chain completion flags
  * @cancellable: a #GCancellable or %NULL
  * @error: a #GError or %NULL
@@ -679,7 +679,7 @@ gcr_certificate_chain_get_certificate (GcrCertificateChain *self, guint index)
  * been stored for this peer. If %NULL then no pinned certificates will
  * be considered.
  *
- * If the %GCR_CERTIFICATE_CHAIN_FLAG_NO_LOOKUPS flag is specified then no
+ * If the %GCR_CERTIFICATE_CHAIN_NO_LOOKUPS flag is specified then no
  * lookups for anchors or pinned certificates are done, and the resulting chain
  * will be neither anchored or pinned. Additionally no missing certificate
  * authorities are looked up in PKCS\#11
@@ -690,15 +690,18 @@ gcr_certificate_chain_get_certificate (GcrCertificateChain *self, guint index)
  * Returns: whether the operation completed successfully
  */
 gboolean
-gcr_certificate_chain_build (GcrCertificateChain *self, const gchar *purpose,
-                             const gchar *peer, guint flags,
-                             GCancellable *cancellable, GError **error)
+gcr_certificate_chain_build (GcrCertificateChain *self,
+                             const gchar *purpose,
+                             const gchar *peer,
+                             GcrCertificateChainFlags flags,
+                             GCancellable *cancellable,
+                             GError **error)
 {
 	GcrCertificateChainPrivate *pv;
 	gboolean ret;
 
 	g_return_val_if_fail (GCR_IS_CERTIFICATE_CHAIN (self), FALSE);
-	g_return_val_if_fail (purpose, FALSE);
+	g_return_val_if_fail (purpose != NULL, FALSE);
 
 	pv = prep_chain_private (self->pv, purpose, peer, flags);
 
@@ -720,7 +723,7 @@ gcr_certificate_chain_build (GcrCertificateChain *self, const gchar *purpose,
  * gcr_certificate_chain_build_async:
  * @self: the #GcrCertificateChain
  * @purpose: the purpose the certificate chain will be used for
- * @peer: the peer the certificate chain will be used with, or NULL
+ * @peer: (allow-none): the peer the certificate chain will be used with, or %NULL
  * @flags: chain completion flags
  * @cancellable: a #GCancellable or %NULL
  * @callback: this will be called when the operation completes.
@@ -748,7 +751,7 @@ gcr_certificate_chain_build (GcrCertificateChain *self, const gchar *purpose,
  * been stored for this peer. If %NULL then no pinned certificates will
  * be considered.
  *
- * If the %GCR_CERTIFICATE_CHAIN_FLAG_NO_LOOKUPS flag is specified then no
+ * If the %GCR_CERTIFICATE_CHAIN_NO_LOOKUPS flag is specified then no
  * lookups for anchors or pinned certificates are done, and the resulting chain
  * will be neither anchored or pinned. Additionally no missing certificate
  * authorities are looked up in PKCS\#11
@@ -757,9 +760,12 @@ gcr_certificate_chain_build (GcrCertificateChain *self, const gchar *purpose,
  * gcr_certificate_chain_build_finish() to get the result of the operation.
  */
 void
-gcr_certificate_chain_build_async (GcrCertificateChain *self, const gchar *purpose,
-                                   const gchar *peer, guint flags,
-                                   GCancellable *cancellable, GAsyncReadyCallback callback,
+gcr_certificate_chain_build_async (GcrCertificateChain *self,
+                                   const gchar *purpose,
+                                   const gchar *peer,
+                                   GcrCertificateChainFlags flags,
+                                   GCancellable *cancellable,
+                                   GAsyncReadyCallback callback,
                                    gpointer user_data)
 {
 	GcrCertificateChainPrivate *pv;
diff --git a/gcr/gcr-certificate-chain.h b/gcr/gcr-certificate-chain.h
index a77df07..ef8bdcf 100644
--- a/gcr/gcr-certificate-chain.h
+++ b/gcr/gcr-certificate-chain.h
@@ -45,7 +45,8 @@ typedef enum {
 } GcrCertificateChainStatus;
 
 typedef enum {
-	GCR_CERTIFICATE_CHAIN_FLAG_NO_LOOKUPS = 1 << 0,
+	GCR_CERTIFICATE_CHAIN_NONE = 0,
+	GCR_CERTIFICATE_CHAIN_NO_LOOKUPS = 1 << 0,
 } GcrCertificateChainFlags;
 
 #define GCR_TYPE_CERTIFICATE_CHAIN               (gcr_certificate_chain_get_type ())
diff --git a/gcr/gcr-certificate-renderer.c b/gcr/gcr-certificate-renderer.c
index aaa9b9d..c55c72e 100644
--- a/gcr/gcr-certificate-renderer.c
+++ b/gcr/gcr-certificate-renderer.c
@@ -522,7 +522,7 @@ gcr_certificate_renderer_class_init (GcrCertificateRendererClass *klass)
 	gobject_class->get_property = gcr_certificate_renderer_get_property;
 
 	/**
-	 * GcrCertificateRenderer:certificate:
+	 * GcrCertificateRenderer:certificate: (allow-none)
 	 *
 	 * The certificate to display. May be %NULL.
 	 */
@@ -541,7 +541,7 @@ gcr_certificate_renderer_class_init (GcrCertificateRendererClass *klass)
 	                               GCK_TYPE_ATTRIBUTES, G_PARAM_READWRITE));
 
 	/**
-	 * GcrCertificateRenderer:label:
+	 * GcrCertificateRenderer:label: (allow-none)
 	 *
 	 * The label to display.
 	 */
@@ -801,7 +801,7 @@ gcr_certificate_renderer_new (GcrCertificate *certificate)
 
 /**
  * gcr_certificate_renderer_new_for_attributes:
- * @label: The label to display
+ * @label: (allow-none): the label to display
  * @attrs: The attributes to display
  *
  * Create a new certificate renderer to display the label and attributes. One
@@ -839,7 +839,7 @@ gcr_certificate_renderer_get_certificate (GcrCertificateRenderer *self)
 /**
  * gcr_certificate_renderer_set_certificate:
  * @self: The renderer
- * @certificate: The certificate to display
+ * @certificate: (allow-none): the certificate to display
  *
  * Set a certificate to display in the renderer.
  */
@@ -869,7 +869,7 @@ gcr_certificate_renderer_set_certificate (GcrCertificateRenderer *self, GcrCerti
  *
  * Get the PKCS\#11 attributes, if any, set for this renderer to display.
  *
- * Returns: (transfer none): the attributes, owned by the renderer
+ * Returns: (allow-none) (transfer none): the attributes, owned by the renderer
  */
 GckAttributes *
 gcr_certificate_renderer_get_attributes (GcrCertificateRenderer *self)
@@ -881,7 +881,7 @@ gcr_certificate_renderer_get_attributes (GcrCertificateRenderer *self)
 /**
  * gcr_certificate_renderer_set_attributes:
  * @self: The renderer
- * @attrs: Attributes to set
+ * @attrs: (allow-none): attributes to set
  *
  * Set the PKCS\#11 attributes for this renderer to display. One of the attributes
  * should be a CKA_VALUE type attribute containing a DER encoded certificate.
diff --git a/gcr/gcr-certificate-widget.c b/gcr/gcr-certificate-widget.c
index ad93b14..6ffdd44 100644
--- a/gcr/gcr-certificate-widget.c
+++ b/gcr/gcr-certificate-widget.c
@@ -192,7 +192,7 @@ gcr_certificate_widget_class_init (GcrCertificateWidgetClass *klass)
 
 /**
  * gcr_certificate_widget_new:
- * @certificate: Certificate to display, or %NULL
+ * @certificate: (allow-none): certificate to display, or %NULL
  *
  * Create a new certificate widget which displays a given certificate.
  *
@@ -211,7 +211,7 @@ gcr_certificate_widget_new (GcrCertificate *certificate)
  *
  * Get the certificate displayed in the widget.
  *
- * Returns: (transfer none): the certificate
+ * Returns: (allow-none) (transfer none): the certificate
  */
 GcrCertificate *
 gcr_certificate_widget_get_certificate (GcrCertificateWidget *self)
@@ -223,7 +223,7 @@ gcr_certificate_widget_get_certificate (GcrCertificateWidget *self)
 /**
  * gcr_certificate_widget_set_certificate:
  * @self: The certificate widget
- * @certificate: The certificate to display
+ * @certificate: (allow-none): the certificate to display
  *
  * Set the certificate displayed in the widget
  */
@@ -241,7 +241,7 @@ gcr_certificate_widget_set_certificate (GcrCertificateWidget *self, GcrCertifica
  * Get the attributes displayed in the widget. The attributes should contain
  * a certificate.
  *
- * Returns: (transfer none): the attributes, owned by the widget
+ * Returns: (allow-none) (transfer none): the attributes, owned by the widget
  */
 GckAttributes *
 gcr_certificate_widget_get_attributes (GcrCertificateWidget *self)
@@ -253,7 +253,7 @@ gcr_certificate_widget_get_attributes (GcrCertificateWidget *self)
 /**
  * gcr_certificate_widget_set_attributes:
  * @self: The certificate widget
- * @attrs: The attributes to display
+ * @attrs: (allow-none): the attributes to display
  *
  * Set the attributes displayed in the widget. The attributes should contain
  * a certificate.
diff --git a/gcr/gcr-certificate.c b/gcr/gcr-certificate.c
index 1e716df..f906dcc 100644
--- a/gcr/gcr-certificate.c
+++ b/gcr/gcr-certificate.c
@@ -391,8 +391,8 @@ gcr_certificate_get_columns (void)
 
 /**
  * gcr_certificate_compare:
- * @first: The certificate to compare
- * @other: The certificate to compare against
+ * @first: (allow-none): the certificate to compare
+ * @other: (allow-none): the certificate to compare against
  *
  * Compare one certificate against another. If the certificates are equal
  * then zero is returned. If one certificate is %NULL or not a certificate,
@@ -442,6 +442,7 @@ gcr_certificate_get_der_data (GcrCertificate *self,
                               gsize *n_data)
 {
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
+	g_return_val_if_fail (n_data != NULL, NULL);
 	g_return_val_if_fail (GCR_CERTIFICATE_GET_INTERFACE (self)->get_der_data, NULL);
 	return GCR_CERTIFICATE_GET_INTERFACE (self)->get_der_data (self, n_data);
 }
@@ -477,15 +478,17 @@ gcr_certificate_get_issuer_cn (GcrCertificate *self)
  * The string returned should be freed by the caller when no longer
  * required.
  * 
- * Returns: The allocated part of the issuer DN, or NULL if no such part is present.
+ * Returns: (allow-none): the allocated part of the issuer DN, or %NULL if no
+ *          such part is present
  */
-gchar*
+gchar *
 gcr_certificate_get_issuer_part (GcrCertificate *self, const char *part)
 {
 	GcrCertificateInfo *info;
 	
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	
+	g_return_val_if_fail (part != NULL, NULL);
+
 	info = certificate_info_load (self);
 	g_return_val_if_fail (info, NULL);
 
@@ -497,6 +500,9 @@ _gcr_certificate_get_issuer_const (GcrCertificate *self, gsize *n_data)
 {
 	GcrCertificateInfo *info;
 
+	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
+	g_return_val_if_fail (n_data != NULL, NULL);
+
 	info = certificate_info_load (self);
 	g_return_val_if_fail (info, NULL);
 
@@ -522,7 +528,7 @@ gcr_certificate_get_issuer_raw (GcrCertificate *self,
 	gconstpointer data;
 
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	g_return_val_if_fail (n_data, NULL);
+	g_return_val_if_fail (n_data != NULL, NULL);
 
 	data = _gcr_certificate_get_issuer_const (self, n_data);
 	return g_memdup (data, data ? *n_data : 0);
@@ -615,7 +621,8 @@ gcr_certificate_get_subject_cn (GcrCertificate *self)
  * The string returned should be freed by the caller when no longer
  * required.
  * 
- * Returns: The allocated part of the subject DN, or NULL if no such part is present.
+ * Returns: (allow-none): the allocated part of the subject DN, or %NULL if no
+ *          such part is present.
  */
 gchar* 
 gcr_certificate_get_subject_part (GcrCertificate *self, const char *part)
@@ -623,7 +630,8 @@ gcr_certificate_get_subject_part (GcrCertificate *self, const char *part)
 	GcrCertificateInfo *info;
 	
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	
+	g_return_val_if_fail (part != NULL, NULL);
+
 	info = certificate_info_load (self);
 	g_return_val_if_fail (info, NULL);
 
@@ -660,6 +668,9 @@ _gcr_certificate_get_subject_const (GcrCertificate *self, gsize *n_data)
 {
 	GcrCertificateInfo *info;
 
+	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
+	g_return_val_if_fail (n_data != NULL, NULL);
+
 	info = certificate_info_load (self);
 	g_return_val_if_fail (info, NULL);
 
@@ -685,7 +696,7 @@ gcr_certificate_get_subject_raw (GcrCertificate *self, gsize *n_data)
 	gconstpointer data;
 
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	g_return_val_if_fail (n_data, NULL);
+	g_return_val_if_fail (n_data != NULL, NULL);
 
 	info = certificate_info_load (self);
 	g_return_val_if_fail (info, NULL);
@@ -795,9 +806,9 @@ gcr_certificate_get_key_size (GcrCertificate *self)
  * The caller should free the returned data using g_free() when
  * it is no longer required.
  * 
- * Returns: the raw binary fingerprint.  
+ * Returns: (array length=n_length): the raw binary fingerprint
  **/
-guchar*
+guchar *
 gcr_certificate_get_fingerprint (GcrCertificate *self, GChecksumType type, gsize *n_length)
 {
 	GChecksum *sum;
@@ -805,7 +816,7 @@ gcr_certificate_get_fingerprint (GcrCertificate *self, GChecksumType type, gsize
 	gssize length;
 	
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	g_return_val_if_fail (n_length, NULL);
+	g_return_val_if_fail (n_length != NULL, NULL);
 	
 	sum = digest_certificate (self, type);
 	g_return_val_if_fail (sum, NULL);
@@ -869,15 +880,15 @@ gcr_certificate_get_fingerprint_hex (GcrCertificate *self, GChecksumType type)
  * The caller should free the returned data using g_free() when
  * it is no longer required.
  * 
- * Returns: the raw binary serial number.
+ * Returns: (array length=n_length): the raw binary serial number.
  */
-guchar*
+guchar *
 gcr_certificate_get_serial_number (GcrCertificate *self, gsize *n_length)
 {
 	GcrCertificateInfo *info;
 
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	g_return_val_if_fail (n_length, NULL);
+	g_return_val_if_fail (n_length != NULL, NULL);
 	
 	info = certificate_info_load (self);
 	g_return_val_if_fail (info, NULL);
@@ -948,7 +959,7 @@ gcr_certificate_get_icon (GcrCertificate *self)
  */
 
 /**
- * gcr_certificate_mixin_comparable_init:
+ * gcr_certificate_mixin_comparable_init: (skip)
  * @iface: The interface
  *
  * Initialize a #GcrComparableIface to compare the current certificate.
@@ -962,7 +973,7 @@ gcr_certificate_mixin_comparable_init (GcrComparableIface *iface)
 }
 
 /**
- * gcr_certificate_mixin_class_init:
+ * gcr_certificate_mixin_class_init: (skip)
  * @object_class: The GObjectClass for this class
  *
  * Initialize the certificate mixin for the class. This mixin implements the
@@ -993,7 +1004,7 @@ gcr_certificate_mixin_class_init (GObjectClass *object_class)
 }
 
 /**
- * gcr_certificate_mixin_get_property:
+ * gcr_certificate_mixin_get_property: (skip)
  * @obj: The object
  * @prop_id: The property id
  * @value: The value to fill in.
diff --git a/gcr/gcr-collection-model.c b/gcr/gcr-collection-model.c
index a423e26..79493e0 100644
--- a/gcr/gcr-collection-model.c
+++ b/gcr/gcr-collection-model.c
@@ -1241,7 +1241,7 @@ gcr_collection_model_class_init (GcrCollectionModelClass *klass)
  */
 
 /**
- * gcr_collection_model_new:
+ * gcr_collection_model_new: (skip)
  * @collection: The collection to represent
  * @...: The column names and types.
  *
@@ -1366,7 +1366,7 @@ GObject *
 gcr_collection_model_object_for_iter (GcrCollectionModel *self, const GtkTreeIter *iter)
 {
 	g_return_val_if_fail (GCR_IS_COLLECTION_MODEL (self), NULL);
-	g_return_val_if_fail (iter, NULL);
+	g_return_val_if_fail (iter != NULL, NULL);
 	g_return_val_if_fail (iter->stamp == COLLECTION_MODEL_STAMP, NULL);
 	g_return_val_if_fail (G_IS_OBJECT (iter->user_data), NULL);
 
@@ -1392,7 +1392,7 @@ gcr_collection_model_iter_for_object (GcrCollectionModel *self, GObject *object,
 
 	g_return_val_if_fail (GCR_IS_COLLECTION_MODEL (self), FALSE);
 	g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
-	g_return_val_if_fail (iter, FALSE);
+	g_return_val_if_fail (iter != NULL, FALSE);
 
 	seq = g_hash_table_lookup (self->pv->object_to_seq, object);
 	if (seq == NULL)
diff --git a/gcr/gcr-combo-selector.c b/gcr/gcr-combo-selector.c
index 302cc16..56e06fe 100644
--- a/gcr/gcr-combo-selector.c
+++ b/gcr/gcr-combo-selector.c
@@ -247,7 +247,7 @@ gcr_combo_selector_get_selected (GcrComboSelector *self)
 /**
  * gcr_combo_selector_set_selected:
  * @self: The selector
- * @selected: The object to select or %NULL.
+ * @selected: (allow-none): the object to select or %NULL
  *
  * Set the currently selected object in the selector, or clear the selection
  * if selected is set to %NULL.
diff --git a/gcr/gcr-failure-renderer.c b/gcr/gcr-failure-renderer.c
index 31d0331..4cf84bd 100644
--- a/gcr/gcr-failure-renderer.c
+++ b/gcr/gcr-failure-renderer.c
@@ -179,7 +179,7 @@ gcr_renderer_iface_init (GcrRendererIface *iface)
 
 /**
  * gcr_failure_renderer_new:
- * @label: the label for the failure
+ * @label: (allow-none): the label for the failure
  * @error: the error to display
  *
  * Create a new renderer for an error.
diff --git a/gcr/gcr-gnupg-collection.c b/gcr/gcr-gnupg-collection.c
index fe730a2..cd59fc5 100644
--- a/gcr/gcr-gnupg-collection.c
+++ b/gcr/gcr-gnupg-collection.c
@@ -141,7 +141,7 @@ _gcr_gnupg_collection_class_init (GcrGnupgCollectionClass *klass)
 	gobject_class->finalize = _gcr_gnupg_collection_finalize;
 
 	/**
-	 * GcrGnupgCollection:directory:
+	 * GcrGnupgCollection:directory: (allow-none)
 	 *
 	 * Directory to load the gnupg keys from, or %NULL for default
 	 * ~/.gnupg/ directory.
diff --git a/gcr/gcr-gnupg-importer.c b/gcr/gcr-gnupg-importer.c
index b9a0b55..d9563a2 100644
--- a/gcr/gcr-gnupg-importer.c
+++ b/gcr/gcr-gnupg-importer.c
@@ -301,6 +301,7 @@ gcr_gnupg_importer_iface (GcrImporterIface *iface)
 
 /**
  * _gcr_gnupg_importer_new:
+ * @directory: (allow-none): the directory to import to, or %NULL for default
  *
  * Returns: (transfer full) (type Gcr.GnupgImporter): the new importer
  */
diff --git a/gcr/gcr-gnupg-process.c b/gcr/gcr-gnupg-process.c
index 81423da..d903009 100644
--- a/gcr/gcr-gnupg-process.c
+++ b/gcr/gcr-gnupg-process.c
@@ -226,7 +226,7 @@ _gcr_gnupg_process_class_init (GcrGnupgProcessClass *klass)
 	gobject_class->finalize = _gcr_gnupg_process_finalize;
 
 	/**
-	 * GcrGnupgProcess:directory:
+	 * GcrGnupgProcess:directory: (allow-none)
 	 *
 	 * Directory to run as gnupg home directory, or %NULL for default
 	 * ~/.gnupg/ directory.
@@ -236,7 +236,7 @@ _gcr_gnupg_process_class_init (GcrGnupgProcessClass *klass)
 	                                NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	/**
-	 * GcrGnupgProcess:executable:
+	 * GcrGnupgProcess:executable: (allow-none)
 	 *
 	 * Path to the gnupg executable, or %NULL for default.
 	 */
@@ -245,7 +245,7 @@ _gcr_gnupg_process_class_init (GcrGnupgProcessClass *klass)
 	                                GPG_EXECUTABLE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	/**
-	 * GcrGnupgProcess:input-stream:
+	 * GcrGnupgProcess:input-stream: (allow-none)
 	 *
 	 * Input for gnupg, or %NULL for no input.
 	 */
@@ -254,7 +254,7 @@ _gcr_gnupg_process_class_init (GcrGnupgProcessClass *klass)
 	                                G_TYPE_INPUT_STREAM, G_PARAM_READWRITE));
 
 	/**
-	 * GcrGnupgProcess:output-stream:
+	 * GcrGnupgProcess:output-stream: (allow-none)
 	 *
 	 * Output from gnupg, or %NULL for ignored output.
 	 */
@@ -263,7 +263,7 @@ _gcr_gnupg_process_class_init (GcrGnupgProcessClass *klass)
 	                                G_TYPE_OUTPUT_STREAM, G_PARAM_READWRITE));
 
 	/**
-	 * GcrGnupgProcess:attribute-stream:
+	 * GcrGnupgProcess:attribute-stream: (allow-none)
 	 *
 	 * Output of attribute data from gnupg, or %NULL for ignored attributes.
 	 */
diff --git a/gcr/gcr-import-button.c b/gcr/gcr-import-button.c
index 9614634..79c9f5b 100644
--- a/gcr/gcr-import-button.c
+++ b/gcr/gcr-import-button.c
@@ -489,7 +489,7 @@ gcr_import_button_class_init (GcrImportButtonClass *klass)
 
 /**
  * gcr_import_button_new:
- * @label: label to display on the button
+ * @label: (allow-none): label to display on the button
  *
  * Create a new #GcrImportButton.
  *
diff --git a/gcr/gcr-key-renderer.c b/gcr/gcr-key-renderer.c
index aed920b..c23d77c 100644
--- a/gcr/gcr-key-renderer.c
+++ b/gcr/gcr-key-renderer.c
@@ -351,8 +351,8 @@ gcr_key_renderer_renderer_iface (GcrRendererIface *iface)
 
 /**
  * gcr_key_renderer_new:
- * @label: Label describing the key
- * @attrs: Key to display, or %NULL
+ * @label: (allow-none): label describing the key
+ * @attrs: (allow-none): key to display, or %NULL
  *
  * Create a new key renderer which renders a given key in the attributes.
  *
@@ -368,7 +368,7 @@ gcr_key_renderer_new (const gchar *label, GckAttributes *attrs)
 /**
  * gcr_key_renderer_set_attributes:
  * @self: The key renderer
- * @attrs: The attributes to display
+ * @attrs: (allow-none): the attributes to display
  *
  * Get the attributes displayed in the renderer. The attributes should represent
  * either an RSA or DSA key in PKCS\#11 style.
@@ -394,7 +394,7 @@ gcr_key_renderer_set_attributes (GcrKeyRenderer *self, GckAttributes *attrs)
  *
  * Get the attributes displayed in the renderer.
  *
- * Returns: (transfer none): the attributes, owned by the renderer
+ * Returns: (transfer none) (allow-none): the attributes, owned by the renderer
  */
 GckAttributes*
 gcr_key_renderer_get_attributes (GcrKeyRenderer *self)
diff --git a/gcr/gcr-key-widget.c b/gcr/gcr-key-widget.c
index be9139e..65b5791 100644
--- a/gcr/gcr-key-widget.c
+++ b/gcr/gcr-key-widget.c
@@ -180,7 +180,7 @@ gcr_key_widget_class_init (GcrKeyWidgetClass *klass)
 
 /**
  * gcr_key_widget_new:
- * @attrs: Key to display, or %NULL
+ * @attrs: (allow-none): key to display, or %NULL
  *
  * Create a new key widget which displays a given key in the attributes.
  *
@@ -196,7 +196,7 @@ gcr_key_widget_new (GckAttributes *attrs)
 /**
  * gcr_key_widget_set_attributes:
  * @self: The key widget
- * @attrs: The attributes to display
+ * @attrs: (allow-none): the attributes to display
  *
  * Get the attributes displayed in the widget. The attributes should represent
  * either an RSA or DSA key in PKCS\#11 style.
@@ -214,7 +214,7 @@ gcr_key_widget_set_attributes (GcrKeyWidget *self, GckAttributes *attrs)
  *
  * Get the attributes displayed in the widget.
  *
- * Returns: The attributes, owned by the widget.
+ * Returns: (allow-none) (transfer none): The attributes, owned by the widget.
  */
 GckAttributes*
 gcr_key_widget_get_attributes (GcrKeyWidget *self)
diff --git a/gcr/gcr-library.c b/gcr/gcr-library.c
index 1bde8dd..4910e6c 100644
--- a/gcr/gcr-library.c
+++ b/gcr/gcr-library.c
@@ -488,7 +488,7 @@ gcr_pkcs11_get_trust_lookup_slots (void)
  * Get the PKCS\#11 URI that is used to identify which slot to use for
  * storing trust storage.
  *
- * Returns: the uri which identifies trust storage slot
+ * Returns: (allow-none): the uri which identifies trust storage slot
  */
 const gchar*
 gcr_pkcs11_get_trust_store_uri (void)
@@ -499,7 +499,7 @@ gcr_pkcs11_get_trust_store_uri (void)
 
 /**
  * gcr_pkcs11_set_trust_store_uri:
- * @pkcs11_uri: the uri which identifies trust storage slot
+ * @pkcs11_uri: (allow-none): the uri which identifies trust storage slot
  *
  * Set the PKCS\#11 URI that is used to identify which slot to use for
  * storing trust assertions.
@@ -526,7 +526,7 @@ gcr_pkcs11_set_trust_store_uri (const gchar *pkcs11_uri)
  * Get the PKCS\#11 URIs that are used to identify which slots to use for
  * lookup trust assertions.
  *
- * Returns: (transfer none): the uri which identifies trust storage slot
+ * Returns: (allow-none) (transfer none): the uri which identifies trust storage slot
  */
 const gchar **
 gcr_pkcs11_get_trust_lookup_uris (void)
@@ -537,7 +537,7 @@ gcr_pkcs11_get_trust_lookup_uris (void)
 
 /**
  * gcr_pkcs11_set_trust_lookup_uris:
- * @pkcs11_uris: the uris which identifies trust lookup slots
+ * @pkcs11_uris: (allow-none): the uris which identifies trust lookup slots
  *
  * Set the PKCS\#11 URIs that are used to identify which slots to use for
  * lookup of trust assertions.
diff --git a/gcr/gcr-live-search.c b/gcr/gcr-live-search.c
index ca91e20..ef1919c 100644
--- a/gcr/gcr-live-search.c
+++ b/gcr/gcr-live-search.c
@@ -565,6 +565,7 @@ _gcr_live_search_init (GcrLiveSearch *self)
 
 /**
  * _gcr_live_search_new:
+ * @hook: (allow-none): the widget to hook
  *
  * Returns: (transfer full) (type Gcr.LiveSearch): The new widget
  */
diff --git a/gcr/gcr-menu-button.c b/gcr/gcr-menu-button.c
index 444e2dd..044d6d3 100644
--- a/gcr/gcr-menu-button.c
+++ b/gcr/gcr-menu-button.c
@@ -298,6 +298,7 @@ _gcr_menu_button_class_init (GcrMenuButtonClass *klass)
 
 /**
  * _gcr_menu_button_new:
+ * @label: (allow-none): the label
  *
  * Returns: (transfer full) (type Gcr.MenuButton): the new menu button
  */
diff --git a/gcr/gcr-parser.c b/gcr/gcr-parser.c
index ca1e809..916f4a5 100644
--- a/gcr/gcr-parser.c
+++ b/gcr/gcr-parser.c
@@ -1777,6 +1777,7 @@ parse_openssh_public (GcrParser *self,
 
 /**
  * GcrDataFormat:
+ * @GCR_FORMAT_ALL: Represents all the formats, when enabling or disabling
  * @GCR_FORMAT_INVALID: Not a valid format
  * @GCR_FORMAT_DER_PRIVATE_KEY: DER encoded private key
  * @GCR_FORMAT_DER_PRIVATE_KEY_RSA: DER encoded RSA private key
@@ -2094,7 +2095,7 @@ gcr_parser_new (void)
 /**
  * gcr_parser_add_password:
  * @self: The parser
- * @password: A password to try
+ * @password: (allow-none): a password to try
  *
  * Add a password to the set of passwords to try when parsing locked or encrypted
  * items. This is usually called from the GcrParser::authenticate signal.
@@ -2176,7 +2177,7 @@ gcr_parser_parse_data (GcrParser *self,
  * @self: The parser
  * @format: The format identifier
  *
- * Enable parsing of the given format. Use -1 to enable all the formats.
+ * Enable parsing of the given format. Use %GCR_FORMAT_ALL to enable all the formats.
  */
 void
 gcr_parser_format_enable (GcrParser *self,
@@ -2209,7 +2210,7 @@ gcr_parser_format_enable (GcrParser *self,
  * @self: The parser
  * @format: The format identifier
  *
- * Disable parsing of the given format. Use -1 to disable all the formats.
+ * Disable parsing of the given format. Use %GCR_FORMAT_ALL to disable all the formats.
  */
 void
 gcr_parser_format_disable (GcrParser *self,
@@ -2249,7 +2250,8 @@ gcr_parser_format_supported (GcrParser *self,
                              GcrDataFormat format)
 {
 	g_return_val_if_fail (GCR_IS_PARSER (self), FALSE);
-	g_return_val_if_fail (format != -1, FALSE);
+	g_return_val_if_fail (format != GCR_FORMAT_ALL, FALSE);
+	g_return_val_if_fail (format != GCR_FORMAT_INVALID, FALSE);
 	return parser_format_lookup (format) ? TRUE : FALSE;
 }
 
@@ -2366,8 +2368,8 @@ gcr_parsed_unref (gpointer parsed)
  * Get a description for the type of the currently parsed item. This is generally
  * only valid during the GcrParser::parsed signal.
  *
- * Returns: The description for the current item. This is owned by the parser
- *     and should not be freed.
+ * Returns: (allow-none): the description for the current item; this is owned by
+ *          the parser and should not be freed
  */
 const gchar*
 gcr_parser_get_parsed_description (GcrParser *self)
@@ -2384,7 +2386,7 @@ gcr_parser_get_parsed_description (GcrParser *self)
  *
  * Get the descirption for a parsed item.
  *
- * Returns: the description
+ * Returns: (allow-none): the description
  */
 const gchar*
 gcr_parsed_get_description (GcrParsed *parsed)
@@ -2405,8 +2407,8 @@ gcr_parsed_get_description (GcrParsed *parsed)
  * Get the attributes which make up the currently parsed item. This is generally
  * only valid during the GcrParser::parsed signal.
  *
- * Returns: (transfer none): the attributes for the current item, which are
- *          owned by the parser and should not be freed
+ * Returns: (transfer none) (allow-none): the attributes for the current item,
+ *          which are owned by the parser and should not be freed
  */
 GckAttributes *
 gcr_parser_get_parsed_attributes (GcrParser *self)
@@ -2423,8 +2425,8 @@ gcr_parser_get_parsed_attributes (GcrParser *self)
  *
  * Get the attributes which make up the parsed item.
  *
- * Returns: (transfer none): the attributes for the item; these are owned by
- *          the parsed item and should not be freed
+ * Returns: (transfer none) (allow-none): the attributes for the item; these
+ *          are owned by the parsed item and should not be freed
  */
 GckAttributes *
 gcr_parsed_get_attributes (GcrParsed *parsed)
@@ -2445,8 +2447,8 @@ gcr_parsed_get_attributes (GcrParsed *parsed)
  * Get the label of the currently parsed item. This is generally only valid
  * during the GcrParser::parsed signal.
  *
- * Returns: The label of the currently parsed item. The value is owned by
- *     the parser and should not be freed.
+ * Returns: (allow-none): the label of the currently parsed item. The value is
+ *          owned by the parser and should not be freed.
  */
 const gchar*
 gcr_parser_get_parsed_label (GcrParser *self)
@@ -2463,7 +2465,7 @@ gcr_parser_get_parsed_label (GcrParser *self)
  *
  * Get the label for the parsed item.
  *
- * Returns: the label for the item.
+ * Returns: (allow-none): the label for the item
  */
 const gchar*
 gcr_parsed_get_label (GcrParsed *parsed)
@@ -2485,8 +2487,9 @@ gcr_parsed_get_label (GcrParsed *parsed)
  * Get the raw data block that represents this parsed object. This is only
  * valid during the GcrParser::parsed signal.
  *
- * Returns: (transfer none) (array length=n_block): the raw data block of the
- *      currently parsed item; the value is owned by the parser and should not be freed
+ * Returns: (transfer none) (array length=n_block) (allow-none): the raw data
+ *          block of the currently parsed item; the value is owned by the parser
+ *          and should not be freed
  */
 const guchar *
 gcr_parser_get_parsed_block (GcrParser *self,
@@ -2506,8 +2509,8 @@ gcr_parser_get_parsed_block (GcrParser *self,
  *
  * Get the raw data block for the parsed item.
  *
- * Returns: (transfer full) (array length=n_data): the raw data of the parsed
- *          item, or %NULL
+ * Returns: (transfer full) (array length=n_data) (allow-none): the raw data of
+ *          the parsed item, or %NULL
  */
 const guchar *
 gcr_parsed_get_data (GcrParsed *parsed,
diff --git a/gcr/gcr-renderer.c b/gcr/gcr-renderer.c
index fe0386a..c98376b 100644
--- a/gcr/gcr-renderer.c
+++ b/gcr/gcr-renderer.c
@@ -206,14 +206,14 @@ sort_registered_by_n_attrs (gconstpointer a, gconstpointer b)
 
 /**
  * gcr_renderer_create:
- * @label: The label for the renderer
+ * @label: (allow-none): The label for the renderer
  * @attrs: The attributes to render
  *
  * Create and initialize a renderer for the given attributes and label. These
  * renderers should have been preregistered via gcr_renderer_register().
  *
- * Returns: (transfer full): a new renderer, or %NULL if no renderer matched
- *          the attributes; the render should be released with g_object_unref()
+ * Returns: (transfer full) (allow-none): a new renderer, or %NULL if no renderer
+ *          matched the attributes; the render should be released with g_object_unref()
  */
 GcrRenderer *
 gcr_renderer_create (const gchar *label, GckAttributes *attrs)
diff --git a/gcr/gcr-types.h b/gcr/gcr-types.h
index 0847b1b..cffed10 100644
--- a/gcr/gcr-types.h
+++ b/gcr/gcr-types.h
@@ -68,6 +68,7 @@ typedef enum {
 } GcrDataError;
 
 typedef enum {
+	GCR_FORMAT_ALL = -1,
 	GCR_FORMAT_INVALID = 0,
 
 	GCR_FORMAT_DER_PRIVATE_KEY = 100,
diff --git a/gcr/gcr-viewer-widget.c b/gcr/gcr-viewer-widget.c
index 8a0328e..6e06599 100644
--- a/gcr/gcr-viewer-widget.c
+++ b/gcr/gcr-viewer-widget.c
@@ -458,7 +458,7 @@ gcr_viewer_widget_load_file (GcrViewerWidget *self,
 /**
  * gcr_viewer_widget_load_data:
  * @self: a viewer widget
- * @display_name: label for the loaded data
+ * @display_name: (allow-none): label for the loaded data
  * @data: (array length=n_data): data to load
  * @n_data: length of data to load
  *
diff --git a/gcr/gcr-viewer.c b/gcr/gcr-viewer.c
index 7f52501..9cc2cec 100644
--- a/gcr/gcr-viewer.c
+++ b/gcr/gcr-viewer.c
@@ -122,7 +122,7 @@ gcr_viewer_add_renderer (GcrViewer *viewer,
  * gcr_viewer_insert_renderer:
  * @viewer: the viewer
  * @renderer: the renderer to insert
- * @before: the renderer to insert before
+ * @before: (allow-none): the renderer to insert before
  *
  * Insert a renderer at a specific point in the viewer
  */
diff --git a/gcr/tests/test-certificate-chain.c b/gcr/tests/test-certificate-chain.c
index 9b8735f..715bd49 100644
--- a/gcr/tests/test-certificate-chain.c
+++ b/gcr/tests/test-certificate-chain.c
@@ -532,7 +532,7 @@ test_without_lookups (Test *test, gconstpointer unused)
 
 	/* But we don't allow the lookup to happen */
 	if (!gcr_certificate_chain_build (chain, GCR_PURPOSE_CLIENT_AUTH,
-	                                  NULL, GCR_CERTIFICATE_CHAIN_FLAG_NO_LOOKUPS,
+	                                  NULL, GCR_CERTIFICATE_CHAIN_NO_LOOKUPS,
 	                                  NULL, &error))
 		g_assert_not_reached ();
 	g_assert_no_error (error);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]