[gcr/wip/nielsdg/autoptr-funcs: 8/9] gcr: Provide support for g_autoptr for all types



commit f73a656858a3dc803d7344fcef61f39159355af8
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Jan 7 07:56:07 2020 +0100

    gcr: Provide support for g_autoptr for all types

 gcr/gcr-callback-output-stream.c |  4 ----
 gcr/gcr-callback-output-stream.h | 15 ++++-----------
 gcr/gcr-certificate-chain.h      |  2 ++
 gcr/gcr-certificate-request.c    | 10 ----------
 gcr/gcr-certificate-request.h    | 11 ++++-------
 gcr/gcr-certificate.h            |  2 ++
 gcr/gcr-filter-collection.h      |  2 ++
 gcr/gcr-gnupg-collection.h       |  2 ++
 gcr/gcr-gnupg-importer.h         |  2 ++
 gcr/gcr-gnupg-key.h              |  2 ++
 gcr/gcr-gnupg-process.h          |  2 ++
 gcr/gcr-memory-icon.h            |  2 ++
 gcr/gcr-mock-prompter.c          | 19 ++++---------------
 gcr/gcr-parser.h                 |  2 ++
 gcr/gcr-pkcs11-certificate.h     |  2 ++
 gcr/gcr-pkcs11-importer.c        |  6 ------
 gcr/gcr-pkcs11-importer.h        | 15 ++++-----------
 gcr/gcr-secret-exchange.h        |  2 ++
 gcr/gcr-simple-certificate.h     |  2 ++
 gcr/gcr-simple-collection.h      |  2 ++
 gcr/gcr-single-collection.c      |  4 ----
 gcr/gcr-single-collection.h      | 15 ++++-----------
 gcr/gcr-ssh-askpass.c            |  4 ----
 gcr/gcr-ssh-askpass.h            | 15 ++++-----------
 gcr/gcr-system-prompt.h          |  2 ++
 gcr/gcr-system-prompter.h        |  2 ++
 gcr/gcr-union-collection.h       |  2 ++
 27 files changed, 56 insertions(+), 94 deletions(-)
---
diff --git a/gcr/gcr-callback-output-stream.c b/gcr/gcr-callback-output-stream.c
index ac85eab..3b5b3c7 100644
--- a/gcr/gcr-callback-output-stream.c
+++ b/gcr/gcr-callback-output-stream.c
@@ -32,10 +32,6 @@ struct _GcrCallbackOutputStream {
        GDestroyNotify destroy_func;
 };
 
-struct _GcrCallbackOutputStreamClass {
-       GOutputStreamClass parent_class;
-};
-
 G_DEFINE_TYPE (GcrCallbackOutputStream, _gcr_callback_output_stream, G_TYPE_OUTPUT_STREAM);
 
 static void
diff --git a/gcr/gcr-callback-output-stream.h b/gcr/gcr-callback-output-stream.h
index 63a48dd..b4ba031 100644
--- a/gcr/gcr-callback-output-stream.h
+++ b/gcr/gcr-callback-output-stream.h
@@ -28,17 +28,10 @@
 
 G_BEGIN_DECLS
 
-#define GCR_TYPE_CALLBACK_OUTPUT_STREAM               (_gcr_callback_output_stream_get_type ())
-#define GCR_CALLBACK_OUTPUT_STREAM(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GCR_TYPE_CALLBACK_OUTPUT_STREAM, GcrCallbackOutputStream))
-#define GCR_CALLBACK_OUTPUT_STREAM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), 
GCR_TYPE_CALLBACK_OUTPUT_STREAM, GcrCallbackOutputStreamClass))
-#define GCR_IS_CALLBACK_OUTPUT_STREAM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GCR_TYPE_CALLBACK_OUTPUT_STREAM))
-#define GCR_IS_CALLBACK_OUTPUT_STREAM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GCR_TYPE_CALLBACK_OUTPUT_STREAM))
-#define GCR_CALLBACK_OUTPUT_STREAM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GCR_TYPE_CALLBACK_OUTPUT_STREAM, GcrCallbackOutputStreamClass))
-
-typedef struct _GcrCallbackOutputStream GcrCallbackOutputStream;
-typedef struct _GcrCallbackOutputStreamClass GcrCallbackOutputStreamClass;
-
-GType               _gcr_callback_output_stream_get_type   (void);
+#define GCR_TYPE_CALLBACK_OUTPUT_STREAM (_gcr_callback_output_stream_get_type ())
+G_DECLARE_FINAL_TYPE (GcrCallbackOutputStream, _gcr_callback_output_stream,
+                      GCR, CALLBACK_OUTPUT_STREAM,
+                      GOutputStream)
 
 typedef gssize      (*GcrCallbackOutputFunc)               (gconstpointer buffer,
                                                             gsize count,
diff --git a/gcr/gcr-certificate-chain.h b/gcr/gcr-certificate-chain.h
index 9d922da..002db1b 100644
--- a/gcr/gcr-certificate-chain.h
+++ b/gcr/gcr-certificate-chain.h
@@ -106,6 +106,8 @@ gboolean                  gcr_certificate_chain_build_finish       (GcrCertifica
                                                                     GAsyncResult *result,
                                                                     GError **error);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrCertificateChain, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_CERTIFICATE_CHAIN_H__ */
diff --git a/gcr/gcr-certificate-request.c b/gcr/gcr-certificate-request.c
index a1d93e7..9a663aa 100644
--- a/gcr/gcr-certificate-request.c
+++ b/gcr/gcr-certificate-request.c
@@ -61,12 +61,6 @@
  * The format of a certificate request. Currently only PKCS\#10 is supported.
  */
 
-#define GCR_CERTIFICATE_REQUEST_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), 
GCR_TYPE_CERTIFICATE_REQUEST, GcrCertificateRequestClass))
-#define GCR_IS_CERTIFICATE_REQUEST_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GCR_TYPE_CERTIFICATE_REQUEST))
-#define GCR_CERTIFICATE_REQUEST_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GCR_TYPE_CERTIFICATE_REQUEST, GcrCertificateRequestClass))
-
-typedef struct _GcrCertificateRequestClass GcrCertificateRequestClass;
-
 struct _GcrCertificateRequest {
        GObject parent;
 
@@ -76,10 +70,6 @@ struct _GcrCertificateRequest {
        gulong n_mechanisms;
 };
 
-struct _GcrCertificateRequestClass {
-       GObjectClass parent_class;
-};
-
 enum {
        PROP_0,
        PROP_FORMAT,
diff --git a/gcr/gcr-certificate-request.h b/gcr/gcr-certificate-request.h
index 8128efc..d8acdbd 100644
--- a/gcr/gcr-certificate-request.h
+++ b/gcr/gcr-certificate-request.h
@@ -34,11 +34,10 @@ typedef enum {
        GCR_CERTIFICATE_REQUEST_PKCS10 = 1,
 } GcrCertificateRequestFormat;
 
-#define GCR_TYPE_CERTIFICATE_REQUEST               (gcr_certificate_request_get_type ())
-#define GCR_CERTIFICATE_REQUEST(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GCR_TYPE_CERTIFICATE_REQUEST, GcrCertificateRequest))
-#define GCR_IS_CERTIFICATE_REQUEST(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GCR_TYPE_CERTIFICATE_REQUEST))
-
-typedef struct _GcrCertificateRequest GcrCertificateRequest;
+#define GCR_TYPE_CERTIFICATE_REQUEST (gcr_certificate_request_get_type ())
+G_DECLARE_FINAL_TYPE (GcrCertificateRequest, gcr_certificate_request,
+                      GCR, CERTIFICATE_REQUEST,
+                      GObject)
 
 gboolean                     gcr_certificate_request_capable          (GckObject *private_key,
                                                                        GCancellable *cancellable,
@@ -53,8 +52,6 @@ void                         gcr_certificate_request_capable_async    (GckObject
 gboolean                     gcr_certificate_request_capable_finish   (GAsyncResult *result,
                                                                        GError **error);
 
-GType                        gcr_certificate_request_get_type         (void) G_GNUC_CONST;
-
 GcrCertificateRequest *      gcr_certificate_request_prepare          (GcrCertificateRequestFormat format,
                                                                        GckObject *private_key);
 
diff --git a/gcr/gcr-certificate.h b/gcr/gcr-certificate.h
index 05946a4..373a3e2 100644
--- a/gcr/gcr-certificate.h
+++ b/gcr/gcr-certificate.h
@@ -149,6 +149,8 @@ void                gcr_certificate_mixin_get_property     (GObject *obj,
                                                             GValue *value,
                                                             GParamSpec *pspec);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrCertificate, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_CERTIFICATE_H__ */
diff --git a/gcr/gcr-filter-collection.h b/gcr/gcr-filter-collection.h
index 9666a92..65e37db 100644
--- a/gcr/gcr-filter-collection.h
+++ b/gcr/gcr-filter-collection.h
@@ -69,6 +69,8 @@ void                gcr_filter_collection_refilter                (GcrFilterColl
 
 GcrCollection *     gcr_filter_collection_get_underlying          (GcrFilterCollection *self);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrFilterCollection, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_FILTER_COLLECTION_H__ */
diff --git a/gcr/gcr-gnupg-collection.h b/gcr/gcr-gnupg-collection.h
index e0b4367..ca22a9b 100644
--- a/gcr/gcr-gnupg-collection.h
+++ b/gcr/gcr-gnupg-collection.h
@@ -62,6 +62,8 @@ gboolean            _gcr_gnupg_collection_load_finish             (GcrGnupgColle
                                                                    GAsyncResult *result,
                                                                    GError **error);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrGnupgCollection, g_object_unref)
+
 G_END_DECLS
 
 #endif /* GCR_GNUPG_COLLECTION_H */
diff --git a/gcr/gcr-gnupg-importer.h b/gcr/gcr-gnupg-importer.h
index 5b37ea0..4bb9550 100644
--- a/gcr/gcr-gnupg-importer.h
+++ b/gcr/gcr-gnupg-importer.h
@@ -60,6 +60,8 @@ GcrImporter *           _gcr_gnupg_importer_new              (const gchar *direc
 
 const gchar **          _gcr_gnupg_importer_get_imported     (GcrGnupgImporter *self);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrGnupgImporter, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_IMPORTER_H__ */
diff --git a/gcr/gcr-gnupg-key.h b/gcr/gcr-gnupg-key.h
index 7f546c0..1daed6d 100644
--- a/gcr/gcr-gnupg-key.h
+++ b/gcr/gcr-gnupg-key.h
@@ -74,6 +74,8 @@ void                _gcr_gnupg_key_set_secret_records            (GcrGnupgKey *s
 
 GIcon*              _gcr_gnupg_key_get_icon                      (GcrGnupgKey *self);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrGnupgKey, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_GNUPG_KEY_H__ */
diff --git a/gcr/gcr-gnupg-process.h b/gcr/gcr-gnupg-process.h
index 4fab849..81bdee2 100644
--- a/gcr/gcr-gnupg-process.h
+++ b/gcr/gcr-gnupg-process.h
@@ -96,6 +96,8 @@ gboolean            _gcr_gnupg_process_run_finish              (GcrGnupgProcess
                                                                 GAsyncResult *result,
                                                                 GError **error);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrGnupgProcess, g_object_unref)
+
 G_END_DECLS
 
 #endif /* GCR_GNUPG_PROCESS_H */
diff --git a/gcr/gcr-memory-icon.h b/gcr/gcr-memory-icon.h
index 579db93..afe85ba 100644
--- a/gcr/gcr-memory-icon.h
+++ b/gcr/gcr-memory-icon.h
@@ -59,6 +59,8 @@ GIcon*              _gcr_memory_icon_new_full             (const gchar *image_ty
                                                            goffset offset,
                                                            GDestroyNotify destroy);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrMemoryIcon, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_MEMORY_ICON_H__ */
diff --git a/gcr/gcr-mock-prompter.c b/gcr/gcr-mock-prompter.c
index 81a14c3..cdc7db9 100644
--- a/gcr/gcr-mock-prompter.c
+++ b/gcr/gcr-mock-prompter.c
@@ -46,17 +46,10 @@
  * provide a response.
  */
 
-GType   _gcr_mock_prompt_get_type       (void) G_GNUC_CONST;
-#define GCR_TYPE_MOCK_PROMPT            (_gcr_mock_prompt_get_type ())
-#define GCR_MOCK_PROMPT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_MOCK_PROMPT, 
GcrMockPrompt))
-#define GCR_IS_MOCK_PROMPT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_MOCK_PROMPT))
-#define GCR_IS_MOCK_PROMPT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_MOCK_PROMPT))
-#define GCR_MOCK_PROMPT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_MOCK_PROMPT, 
GcrMockPromptClass))
-#define GCR_MOCK_PROMPT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_MOCK_PROMPT, 
GcrMockPromptClass))
-
-typedef struct _GcrMockPrompt GcrMockPrompt;
-typedef struct _GcrMockPromptClass GcrMockPromptClass;
-typedef struct _GcrMockPromptPrivate GcrMockPromptPrivate;
+#define GCR_TYPE_MOCK_PROMPT (_gcr_mock_prompt_get_type ())
+G_DECLARE_FINAL_TYPE (GcrMockPrompt, _gcr_mock_prompt,
+                      GCR, MOCK_PROMPT,
+                      GObject)
 
 enum {
        PROP_0,
@@ -80,10 +73,6 @@ struct _GcrMockPrompt {
        gboolean disposed;
 };
 
-struct _GcrMockPromptClass {
-       GObjectClass parent_class;
-};
-
 typedef struct {
        gboolean close;
        gboolean proceed;
diff --git a/gcr/gcr-parser.h b/gcr/gcr-parser.h
index 4f53a78..a19a98f 100644
--- a/gcr/gcr-parser.h
+++ b/gcr/gcr-parser.h
@@ -144,6 +144,8 @@ GcrDataFormat            gcr_parsed_get_format             (GcrParsed *parsed);
 
 const gchar*             gcr_parsed_get_filename           (GcrParsed *parsed);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrParsed, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_PARSER_H__ */
diff --git a/gcr/gcr-pkcs11-certificate.h b/gcr/gcr-pkcs11-certificate.h
index 5928a87..a1cd444 100644
--- a/gcr/gcr-pkcs11-certificate.h
+++ b/gcr/gcr-pkcs11-certificate.h
@@ -72,6 +72,8 @@ void                    gcr_pkcs11_certificate_lookup_issuer_async    (GcrCertif
 GcrCertificate*         gcr_pkcs11_certificate_lookup_issuer_finish   (GAsyncResult *result,
                                                                        GError **error);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrPkcs11Certificate, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_PKCS11_CERTIFICATE_H__ */
diff --git a/gcr/gcr-pkcs11-importer.c b/gcr/gcr-pkcs11-importer.c
index 7cf3295..7a7cc3b 100644
--- a/gcr/gcr-pkcs11-importer.c
+++ b/gcr/gcr-pkcs11-importer.c
@@ -50,8 +50,6 @@ enum {
        PROP_URI
 };
 
-typedef struct _GcrPkcs11ImporterClass GcrPkcs11ImporterClass;
-
 struct _GcrPkcs11Importer {
        GObject parent;
        GckSlot *slot;
@@ -62,10 +60,6 @@ struct _GcrPkcs11Importer {
        gboolean any_private;
 };
 
-struct _GcrPkcs11ImporterClass {
-       GObjectClass parent_class;
-};
-
 typedef struct  {
        GcrPkcs11Importer *importer;
        GCancellable *cancellable;
diff --git a/gcr/gcr-pkcs11-importer.h b/gcr/gcr-pkcs11-importer.h
index 20f0381..3b1780d 100644
--- a/gcr/gcr-pkcs11-importer.h
+++ b/gcr/gcr-pkcs11-importer.h
@@ -31,17 +31,10 @@
 
 G_BEGIN_DECLS
 
-#define GCR_TYPE_PKCS11_IMPORTER               (_gcr_pkcs11_importer_get_type ())
-#define GCR_PKCS11_IMPORTER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_PKCS11_IMPORTER, 
GcrPkcs11Importer))
-#define GCR_PKCS11_IMPORTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_PKCS11_IMPORTER, 
GcrPkcs11ImporterClass))
-#define GCR_IS_PKCS11_IMPORTER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_PKCS11_IMPORTER))
-#define GCR_IS_PKCS11_IMPORTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_PKCS11_IMPORTER))
-#define GCR_PKCS11_IMPORTER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_PKCS11_IMPORTER, 
GcrPkcs11ImporterClass))
-
-typedef struct _GcrPkcs11Importer GcrPkcs11Importer;
-
-
-GType                     _gcr_pkcs11_importer_get_type        (void);
+#define GCR_TYPE_PKCS11_IMPORTER (_gcr_pkcs11_importer_get_type ())
+G_DECLARE_FINAL_TYPE (GcrPkcs11Importer, _gcr_pkcs11_importer,
+                      GCR, PKCS11_IMPORTER,
+                      GObject);
 
 GcrImporter *             _gcr_pkcs11_importer_new             (GckSlot *slot);
 
diff --git a/gcr/gcr-secret-exchange.h b/gcr/gcr-secret-exchange.h
index bf8a876..582558f 100644
--- a/gcr/gcr-secret-exchange.h
+++ b/gcr/gcr-secret-exchange.h
@@ -106,6 +106,8 @@ gchar *             gcr_secret_exchange_send            (GcrSecretExchange *self
 const gchar *       gcr_secret_exchange_get_secret      (GcrSecretExchange *self,
                                                          gsize *secret_len);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrSecretExchange, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_SECRET_EXCHANGE_H__ */
diff --git a/gcr/gcr-simple-certificate.h b/gcr/gcr-simple-certificate.h
index 9e6d2fc..14e54c6 100644
--- a/gcr/gcr-simple-certificate.h
+++ b/gcr/gcr-simple-certificate.h
@@ -60,6 +60,8 @@ GcrCertificate *    gcr_simple_certificate_new                    (const guchar
 GcrCertificate *    gcr_simple_certificate_new_static             (const guchar *data,
                                                                    gsize n_data);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrSimpleCertificate, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_SIMPLE_CERTIFICATE_H__ */
diff --git a/gcr/gcr-simple-collection.h b/gcr/gcr-simple-collection.h
index 4799b62..4623dae 100644
--- a/gcr/gcr-simple-collection.h
+++ b/gcr/gcr-simple-collection.h
@@ -58,6 +58,8 @@ void                gcr_simple_collection_add                     (GcrSimpleColl
 void                gcr_simple_collection_remove                  (GcrSimpleCollection *self,
                                                                    GObject *object);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrSimpleCollection, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_SIMPLE_COLLECTION_H__ */
diff --git a/gcr/gcr-single-collection.c b/gcr/gcr-single-collection.c
index 85a0ebb..478af1e 100644
--- a/gcr/gcr-single-collection.c
+++ b/gcr/gcr-single-collection.c
@@ -42,10 +42,6 @@ struct _GcrSingleCollection {
  * The class for #GcrSingleCollection.
  */
 
-struct _GcrSingleCollectionClass {
-       GObjectClass parent_class;
-};
-
 static void _gcr_single_collection_iface (GcrCollectionIface *iface);
 G_DEFINE_TYPE_WITH_CODE (GcrSingleCollection, _gcr_single_collection, G_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (GCR_TYPE_COLLECTION, _gcr_single_collection_iface));
diff --git a/gcr/gcr-single-collection.h b/gcr/gcr-single-collection.h
index a2392f5..7dee26e 100644
--- a/gcr/gcr-single-collection.h
+++ b/gcr/gcr-single-collection.h
@@ -28,17 +28,10 @@
 
 G_BEGIN_DECLS
 
-#define GCR_TYPE_SINGLE_COLLECTION               (_gcr_single_collection_get_type ())
-#define GCR_SINGLE_COLLECTION(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_COLLECTION, 
GcrSingleCollection))
-#define GCR_SINGLE_COLLECTION_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_COLLECTION, 
GcrSingleCollectionClass))
-#define GCR_IS_SINGLE_COLLECTION(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_COLLECTION))
-#define GCR_IS_SINGLE_COLLECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_COLLECTION))
-#define GCR_SINGLE_COLLECTION_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_COLLECTION, 
GcrSingleCollectionClass))
-
-typedef struct _GcrSingleCollection GcrSingleCollection;
-typedef struct _GcrSingleCollectionClass GcrSingleCollectionClass;
-
-GType               _gcr_single_collection_get_type                (void);
+#define GCR_TYPE_SINGLE_COLLECTION (_gcr_single_collection_get_type ())
+G_DECLARE_FINAL_TYPE (GcrSingleCollection, _gcr_single_collection,
+                      GCR, SINGLE_COLLECTION,
+                      GObject)
 
 GcrCollection *     _gcr_single_collection_new                     (GObject *object);
 
diff --git a/gcr/gcr-ssh-askpass.c b/gcr/gcr-ssh-askpass.c
index b79b4c2..fd9e20b 100644
--- a/gcr/gcr-ssh-askpass.c
+++ b/gcr/gcr-ssh-askpass.c
@@ -71,10 +71,6 @@ struct _GcrSshAskpass {
        GMainContext *context;
 };
 
-struct _GcrSshAskpassClass {
-       GObjectClass parent;
-};
-
 G_DEFINE_TYPE (GcrSshAskpass, gcr_ssh_askpass, G_TYPE_OBJECT);
 
 static void
diff --git a/gcr/gcr-ssh-askpass.h b/gcr/gcr-ssh-askpass.h
index 634011d..b766974 100644
--- a/gcr/gcr-ssh-askpass.h
+++ b/gcr/gcr-ssh-askpass.h
@@ -30,17 +30,10 @@
 
 G_BEGIN_DECLS
 
-#define GCR_TYPE_SSH_ASKPASS               (gcr_ssh_askpass_get_type ())
-#define GCR_SSH_ASKPASS(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_SSH_ASKPASS, 
GcrSshAskpass))
-#define GCR_SSH_ASKPASS_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_SSH_ASKPASS, 
GcrSshAskpassClass))
-#define GCR_IS_SSH_ASKPASS(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_SSH_ASKPASS))
-#define GCR_IS_SSH_ASKPASS_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_SSH_ASKPASS))
-#define GCR_SSH_ASKPASS_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_SSH_ASKPASS, 
GcrSshAskpassClass))
-
-typedef struct _GcrSshAskpass GcrSshAskpass;
-typedef struct _GcrSshAskpassClass GcrSshAskpassClass;
-
-GType               gcr_ssh_askpass_get_type        (void);
+#define GCR_TYPE_SSH_ASKPASS (gcr_ssh_askpass_get_type ())
+G_DECLARE_FINAL_TYPE (GcrSshAskpass, gcr_ssh_askpass,
+                      GCR, SSH_ASKPASS,
+                      GObject)
 
 GcrSshAskpass *     gcr_ssh_askpass_new             (GTlsInteraction *interaction);
 
diff --git a/gcr/gcr-system-prompt.h b/gcr/gcr-system-prompt.h
index 4a6f9ef..0d20782 100644
--- a/gcr/gcr-system-prompt.h
+++ b/gcr/gcr-system-prompt.h
@@ -104,6 +104,8 @@ gboolean             gcr_system_prompt_close_finish              (GcrSystemPromp
                                                                   GAsyncResult *result,
                                                                   GError **error);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrSystemPrompt, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_SYSTEM_PROMPT_H__ */
diff --git a/gcr/gcr-system-prompter.h b/gcr/gcr-system-prompter.h
index 66fafd9..72b7c69 100644
--- a/gcr/gcr-system-prompter.h
+++ b/gcr/gcr-system-prompter.h
@@ -85,6 +85,8 @@ void                   gcr_system_prompter_register                (GcrSystemPro
 void                   gcr_system_prompter_unregister              (GcrSystemPrompter *self,
                                                                     gboolean wait);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrSystemPrompter, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_SYSTEM_PROMPTER_H__ */
diff --git a/gcr/gcr-union-collection.h b/gcr/gcr-union-collection.h
index bae1a58..2ca740c 100644
--- a/gcr/gcr-union-collection.h
+++ b/gcr/gcr-union-collection.h
@@ -70,6 +70,8 @@ guint               gcr_union_collection_size                    (GcrUnionCollec
 
 GList *             gcr_union_collection_elements                (GcrUnionCollection *self);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GcrUnionCollection, g_object_unref)
+
 G_END_DECLS
 
 #endif /* __GCR_UNION_COLLECTION_H__ */


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