[gnome-keyring/wip/nielsdg/fix-warnings: 1/3] Don't use g_type_class_add_private()



commit 26b6ff638936402db8930452c367e73cb11e57af
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Thu Jan 2 22:08:38 2020 +0100

    Don't use g_type_class_add_private()
    
    This was deprecated some time ago in favor of `G_ADD_PRIVATE()`, so by
    migrating to that fixes quite a bit of warnings.

 daemon/dbus/gkd-secret-prompt.c         | 5 ++---
 pkcs11/gkm/gkm-assertion.c              | 6 ++----
 pkcs11/gkm/gkm-certificate-key.c        | 6 ++----
 pkcs11/gkm/gkm-certificate.c            | 6 ++----
 pkcs11/gkm/gkm-credential.c             | 7 ++-----
 pkcs11/gkm/gkm-dh-key.c                 | 8 ++------
 pkcs11/gkm/gkm-manager.c                | 7 ++-----
 pkcs11/gkm/gkm-module.c                 | 7 ++-----
 pkcs11/gkm/gkm-object.c                 | 7 ++-----
 pkcs11/gkm/gkm-private-xsa-key.c        | 7 ++-----
 pkcs11/gkm/gkm-secret-key.c             | 8 ++------
 pkcs11/gkm/gkm-session.c                | 7 ++-----
 pkcs11/gkm/gkm-sexp-key.c               | 7 ++-----
 pkcs11/gkm/gkm-store.c                  | 6 ++----
 pkcs11/secret-store/gkm-secret-object.c | 7 ++-----
 pkcs11/xdg-store/gkm-xdg-trust.c        | 6 +++---
 16 files changed, 33 insertions(+), 74 deletions(-)
---
diff --git a/daemon/dbus/gkd-secret-prompt.c b/daemon/dbus/gkd-secret-prompt.c
index c96d911a..0d1911c1 100644
--- a/daemon/dbus/gkd-secret-prompt.c
+++ b/daemon/dbus/gkd-secret-prompt.c
@@ -60,6 +60,7 @@ struct _GkdSecretPromptPrivate {
 
 static void gkd_secret_dispatch_iface (GkdSecretDispatchIface *iface);
 G_DEFINE_TYPE_WITH_CODE (GkdSecretPrompt, gkd_secret_prompt, GCR_TYPE_SYSTEM_PROMPT,
+                        G_ADD_PRIVATE (GkdSecretPrompt)
                         G_IMPLEMENT_INTERFACE (GKD_SECRET_TYPE_DISPATCH, gkd_secret_dispatch_iface));
 
 static guint unique_prompt_number = 0;
@@ -213,7 +214,7 @@ gkd_secret_prompt_unexport (GkdSecretPrompt *self)
 static void
 gkd_secret_prompt_init (GkdSecretPrompt *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKD_SECRET_TYPE_PROMPT, GkdSecretPromptPrivate);
+       self->pv = gkd_secret_prompt_get_instance_private (self);
        self->pv->cancellable = g_cancellable_new ();
 }
 
@@ -314,8 +315,6 @@ gkd_secret_prompt_class_init (GkdSecretPromptClass *klass)
        klass->encode_result = gkd_secret_prompt_real_encode_result;
        klass->prompt_ready = gkd_secret_prompt_real_prompt_ready;
 
-       g_type_class_add_private (klass, sizeof (GkdSecretPromptPrivate));
-
        g_object_class_install_property (gobject_class, PROP_CALLER,
                g_param_spec_string ("caller", "Caller", "DBus caller name",
                                     NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY ));
diff --git a/pkcs11/gkm/gkm-assertion.c b/pkcs11/gkm/gkm-assertion.c
index 73b73a67..4d6323cf 100644
--- a/pkcs11/gkm/gkm-assertion.c
+++ b/pkcs11/gkm/gkm-assertion.c
@@ -48,7 +48,7 @@ struct _GkmAssertionPrivate {
        gchar *peer;
 };
 
-G_DEFINE_TYPE (GkmAssertion, gkm_assertion, GKM_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmAssertion, gkm_assertion, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -113,7 +113,7 @@ gkm_assertion_constructor (GType type, guint n_props, GObjectConstructParam *pro
 static void
 gkm_assertion_init (GkmAssertion *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_ASSERTION, GkmAssertionPrivate);
+       self->pv = gkm_assertion_get_instance_private (self);
 }
 
 static void
@@ -216,8 +216,6 @@ gkm_assertion_class_init (GkmAssertionClass *klass)
        g_object_class_install_property (gobject_class, PROP_PEER,
                 g_param_spec_string ("peer", "Peer", "Optional peer this assertion applies to",
                                      NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-       g_type_class_add_private (klass, sizeof (GkmAssertionPrivate));
 }
 
 /* -----------------------------------------------------------------------------
diff --git a/pkcs11/gkm/gkm-certificate-key.c b/pkcs11/gkm/gkm-certificate-key.c
index c6431a1d..b46321bd 100644
--- a/pkcs11/gkm/gkm-certificate-key.c
+++ b/pkcs11/gkm/gkm-certificate-key.c
@@ -38,7 +38,7 @@ struct _GkmCertificateKeyPrivate {
        GkmCertificate *certificate;
 };
 
-G_DEFINE_TYPE (GkmCertificateKey, gkm_certificate_key, GKM_TYPE_PUBLIC_XSA_KEY);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmCertificateKey, gkm_certificate_key, GKM_TYPE_PUBLIC_XSA_KEY);
 
 /* -----------------------------------------------------------------------------
  * OBJECT
@@ -62,7 +62,7 @@ gkm_certificate_key_get_attribute (GkmObject *base, GkmSession *session, CK_ATTR
 static void
 gkm_certificate_key_init (GkmCertificateKey *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_CERTIFICATE_KEY, GkmCertificateKeyPrivate);
+       self->pv = gkm_certificate_key_get_instance_private (self);
 }
 
 static void
@@ -124,8 +124,6 @@ gkm_certificate_key_class_init (GkmCertificateKeyClass *klass)
 
        gkm_class->get_attribute = gkm_certificate_key_get_attribute;
 
-       g_type_class_add_private (klass, sizeof (GkmCertificateKeyPrivate));
-
        g_object_class_install_property (gobject_class, PROP_CERTIFICATE,
                   g_param_spec_object ("certificate", "Certificate", "Certificate this key belongs to",
                                        GKM_TYPE_CERTIFICATE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
diff --git a/pkcs11/gkm/gkm-certificate.c b/pkcs11/gkm/gkm-certificate.c
index bf98258f..28ae0960 100644
--- a/pkcs11/gkm/gkm-certificate.c
+++ b/pkcs11/gkm/gkm-certificate.c
@@ -64,6 +64,7 @@ static GQuark OID_ENHANCED_USAGE;
 static void gkm_certificate_serializable (GkmSerializableIface *iface);
 
 G_DEFINE_TYPE_EXTENDED (GkmCertificate, gkm_certificate, GKM_TYPE_OBJECT, 0,
+               G_ADD_PRIVATE (GkmCertificate)
                G_IMPLEMENT_INTERFACE (GKM_TYPE_SERIALIZABLE, gkm_certificate_serializable));
 
 /* -----------------------------------------------------------------------------
@@ -281,7 +282,7 @@ gkm_certificate_constructor (GType type, guint n_props, GObjectConstructParam *p
 static void
 gkm_certificate_init (GkmCertificate *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_CERTIFICATE, GkmCertificatePrivate);
+       self->pv = gkm_certificate_get_instance_private (self);
 
 }
 
@@ -352,9 +353,6 @@ gkm_certificate_class_init (GkmCertificateClass *klass)
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
        GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-       gkm_certificate_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmCertificatePrivate));
-
        gobject_class->constructor = gkm_certificate_constructor;
        gobject_class->dispose = gkm_certificate_dispose;
        gobject_class->finalize = gkm_certificate_finalize;
diff --git a/pkcs11/gkm/gkm-credential.c b/pkcs11/gkm/gkm-credential.c
index 16baa1af..0d2a09f1 100644
--- a/pkcs11/gkm/gkm-credential.c
+++ b/pkcs11/gkm/gkm-credential.c
@@ -48,7 +48,7 @@ struct _GkmCredentialPrivate {
        gpointer user_data;
 };
 
-G_DEFINE_TYPE (GkmCredential, gkm_credential, GKM_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmCredential, gkm_credential, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -197,7 +197,7 @@ gkm_credential_constructor (GType type, guint n_props, GObjectConstructParam *pr
 static void
 gkm_credential_init (GkmCredential *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_CREDENTIAL, GkmCredentialPrivate);
+       self->pv = gkm_credential_get_instance_private (self);
 }
 
 static void
@@ -279,9 +279,6 @@ gkm_credential_class_init (GkmCredentialClass *klass)
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
        GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-       gkm_credential_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmCredentialPrivate));
-
        gobject_class->constructor = gkm_credential_constructor;
        gobject_class->dispose = gkm_credential_dispose;
        gobject_class->finalize = gkm_credential_finalize;
diff --git a/pkcs11/gkm/gkm-dh-key.c b/pkcs11/gkm/gkm-dh-key.c
index 6b4dbaa5..9ecbaf50 100644
--- a/pkcs11/gkm/gkm-dh-key.c
+++ b/pkcs11/gkm/gkm-dh-key.c
@@ -36,7 +36,7 @@ struct _GkmDhKeyPrivate {
        gsize n_id;
 };
 
-G_DEFINE_TYPE (GkmDhKey, gkm_dh_key, GKM_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmDhKey, gkm_dh_key, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -90,7 +90,7 @@ gkm_dh_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUT
 static void
 gkm_dh_key_init (GkmDhKey *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_DH_KEY, GkmDhKeyPrivate);
+       self->pv = gkm_dh_key_get_instance_private (self);
 }
 
 static void
@@ -117,13 +117,9 @@ gkm_dh_key_class_init (GkmDhKeyClass *klass)
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
        GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-       gkm_dh_key_parent_class = g_type_class_peek_parent (klass);
-
        gobject_class->finalize = gkm_dh_key_finalize;
 
        gkm_class->get_attribute = gkm_dh_key_real_get_attribute;
-
-       g_type_class_add_private (klass, sizeof (GkmDhKeyPrivate));
 }
 
 /* -----------------------------------------------------------------------------
diff --git a/pkcs11/gkm/gkm-manager.c b/pkcs11/gkm/gkm-manager.c
index 6b87c78d..1c7a4b18 100644
--- a/pkcs11/gkm/gkm-manager.c
+++ b/pkcs11/gkm/gkm-manager.c
@@ -70,7 +70,7 @@ typedef struct _Finder {
        GkmSession *session;
 } Finder;
 
-G_DEFINE_TYPE(GkmManager, gkm_manager, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmManager, gkm_manager, G_TYPE_OBJECT);
 
 /* Friend functions for GkmObject */
 void  _gkm_manager_register_object    (GkmManager *self, GkmObject *object);
@@ -646,7 +646,7 @@ find_one_for_property (GkmManager *self, const gchar *property, CK_ATTRIBUTE_PTR
 static void
 gkm_manager_init (GkmManager *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE(self, GKM_TYPE_MANAGER, GkmManagerPrivate);
+       self->pv = gkm_manager_get_instance_private (self);
        self->pv->index_by_attribute = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
                                                              gkm_util_ulong_free, index_free);
        self->pv->index_by_property = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -724,14 +724,11 @@ gkm_manager_class_init (GkmManagerClass *klass)
        GObjectClass *gobject_class;
        gobject_class = (GObjectClass*)klass;
 
-       gkm_manager_parent_class = g_type_class_peek_parent (klass);
        gobject_class->dispose = gkm_manager_dispose;
        gobject_class->get_property = gkm_manager_get_property;
        gobject_class->set_property = gkm_manager_set_property;
        gobject_class->finalize = gkm_manager_finalize;
 
-       g_type_class_add_private (gobject_class, sizeof (GkmManagerPrivate));
-
        g_object_class_install_property (gobject_class, PROP_FOR_TOKEN,
                 g_param_spec_boolean ("for-token", "For Token", "Whether this manager is for token objects 
or not",
                                       FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
diff --git a/pkcs11/gkm/gkm-module.c b/pkcs11/gkm/gkm-module.c
index f8177d2e..08ba4360 100644
--- a/pkcs11/gkm/gkm-module.c
+++ b/pkcs11/gkm/gkm-module.c
@@ -84,7 +84,7 @@ typedef struct _Apartment {
        CK_USER_TYPE logged_in;
 } Apartment;
 
-G_DEFINE_TYPE (GkmModule, gkm_module, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmModule, gkm_module, G_TYPE_OBJECT);
 
 /* These info blocks are used unless derived class overrides */
 
@@ -603,7 +603,7 @@ gkm_module_init (GkmModule *self)
 {
        gkm_timer_initialize ();
 
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_MODULE, GkmModulePrivate);
+       self->pv = gkm_module_get_instance_private (self);
        self->pv->token_manager = g_object_new (GKM_TYPE_MANAGER, "for-token", TRUE, NULL);
        self->pv->sessions_by_handle = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
                                                              gkm_util_ulong_free, g_object_unref);
@@ -723,9 +723,6 @@ gkm_module_class_init (GkmModuleClass *klass)
 {
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-       gkm_module_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmModulePrivate));
-
        gobject_class->constructor = gkm_module_constructor;
        gobject_class->dispose = gkm_module_dispose;
        gobject_class->finalize = gkm_module_finalize;
diff --git a/pkcs11/gkm/gkm-object.c b/pkcs11/gkm/gkm-object.c
index 9de2b241..7ca68989 100644
--- a/pkcs11/gkm/gkm-object.c
+++ b/pkcs11/gkm/gkm-object.c
@@ -72,7 +72,7 @@ struct _GkmObjectPrivate {
        GkmObjectTransient *transient;
 };
 
-G_DEFINE_TYPE (GkmObject, gkm_object, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmObject, gkm_object, G_TYPE_OBJECT);
 
 /* Private friend functions from the manager */
 void  _gkm_manager_register_object   (GkmManager *self, GkmObject *object);
@@ -396,7 +396,7 @@ gkm_object_constructor (GType type, guint n_props, GObjectConstructParam *props)
 static void
 gkm_object_init (GkmObject *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_OBJECT, GkmObjectPrivate);
+       self->pv = gkm_object_get_instance_private (self);
 
 }
 
@@ -539,9 +539,6 @@ gkm_object_class_init (GkmObjectClass *klass)
 {
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-       gkm_object_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmObjectPrivate));
-
        gobject_class->constructor = gkm_object_constructor;
        gobject_class->dispose = gkm_object_dispose;
        gobject_class->finalize = gkm_object_finalize;
diff --git a/pkcs11/gkm/gkm-private-xsa-key.c b/pkcs11/gkm/gkm-private-xsa-key.c
index 3dbbd12a..08506a7a 100644
--- a/pkcs11/gkm/gkm-private-xsa-key.c
+++ b/pkcs11/gkm/gkm-private-xsa-key.c
@@ -37,7 +37,7 @@ struct _GkmPrivateXsaKeyPrivate {
        GkmSexp *sexp;
 };
 
-G_DEFINE_TYPE (GkmPrivateXsaKey, gkm_private_xsa_key, GKM_TYPE_SEXP_KEY);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmPrivateXsaKey, gkm_private_xsa_key, GKM_TYPE_SEXP_KEY);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -395,7 +395,7 @@ gkm_private_xsa_key_real_acquire_crypto_sexp (GkmSexpKey *base, GkmSession *sess
 static void
 gkm_private_xsa_key_init (GkmPrivateXsaKey *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_PRIVATE_XSA_KEY, GkmPrivateXsaKeyPrivate);
+       self->pv = gkm_private_xsa_key_get_instance_private (self);
 }
 
 static void
@@ -427,9 +427,6 @@ gkm_private_xsa_key_class_init (GkmPrivateXsaKeyClass *klass)
        GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
        GkmSexpKeyClass *key_class = GKM_SEXP_KEY_CLASS (klass);
 
-       gkm_private_xsa_key_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmPrivateXsaKeyPrivate));
-
        gobject_class->dispose = gkm_private_xsa_key_dispose;
        gobject_class->finalize = gkm_private_xsa_key_finalize;
 
diff --git a/pkcs11/gkm/gkm-secret-key.c b/pkcs11/gkm/gkm-secret-key.c
index 2d277a63..d91d05bb 100644
--- a/pkcs11/gkm/gkm-secret-key.c
+++ b/pkcs11/gkm/gkm-secret-key.c
@@ -35,7 +35,7 @@ struct _GkmSecretKeyPrivate {
        gsize n_id;
 };
 
-G_DEFINE_TYPE (GkmSecretKey, gkm_secret_key, GKM_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmSecretKey, gkm_secret_key, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -128,7 +128,7 @@ gkm_secret_key_real_create_attributes (GkmObject *object, GkmSession *session, G
 static void
 gkm_secret_key_init (GkmSecretKey *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SECRET_KEY, GkmSecretKeyPrivate);
+       self->pv = gkm_secret_key_get_instance_private (self);
 }
 
 static void
@@ -149,14 +149,10 @@ gkm_secret_key_class_init (GkmSecretKeyClass *klass)
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
        GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-       gkm_secret_key_parent_class = g_type_class_peek_parent (klass);
-
        gobject_class->finalize = gkm_secret_key_finalize;
 
        gkm_class->get_attribute = gkm_secret_key_real_get_attribute;
        gkm_class->create_attributes = gkm_secret_key_real_create_attributes;
-
-       g_type_class_add_private (klass, sizeof (GkmSecretKeyPrivate));
 }
 
 /* -----------------------------------------------------------------------------
diff --git a/pkcs11/gkm/gkm-session.c b/pkcs11/gkm/gkm-session.c
index 6ec8737d..7fdc3662 100644
--- a/pkcs11/gkm/gkm-session.c
+++ b/pkcs11/gkm/gkm-session.c
@@ -80,7 +80,7 @@ struct _GkmSessionPrivate {
        CK_ATTRIBUTE_TYPE crypto_method;
 };
 
-G_DEFINE_TYPE (GkmSession, gkm_session, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmSession, gkm_session, G_TYPE_OBJECT);
 
 static void add_object (GkmSession *self, GkmTransaction *transaction, GkmObject *object);
 static void remove_object (GkmSession *self, GkmTransaction *transaction, GkmObject *object);
@@ -377,7 +377,7 @@ gkm_session_constructor (GType type, guint n_props, GObjectConstructParam *props
 static void
 gkm_session_init (GkmSession *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SESSION, GkmSessionPrivate);
+       self->pv = gkm_session_get_instance_private (self);
        self->pv->objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, 
gkm_util_dispose_unref);
        self->pv->flags = 0;
 
@@ -511,9 +511,6 @@ gkm_session_class_init (GkmSessionClass *klass)
 {
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-       gkm_session_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmSessionPrivate));
-
        gobject_class->constructor = gkm_session_constructor;
        gobject_class->dispose = gkm_session_dispose;
        gobject_class->finalize = gkm_session_finalize;
diff --git a/pkcs11/gkm/gkm-sexp-key.c b/pkcs11/gkm/gkm-sexp-key.c
index 8b98bdc2..dae61f39 100644
--- a/pkcs11/gkm/gkm-sexp-key.c
+++ b/pkcs11/gkm/gkm-sexp-key.c
@@ -42,7 +42,7 @@ struct _GkmSexpKeyPrivate {
        GkmSexp *base_sexp;
 };
 
-G_DEFINE_TYPE (GkmSexpKey, gkm_sexp_key, GKM_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmSexpKey, gkm_sexp_key, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -123,7 +123,7 @@ gkm_sexp_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIB
 static void
 gkm_sexp_key_init (GkmSexpKey *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SEXP_KEY, GkmSexpKeyPrivate);
+       self->pv = gkm_sexp_key_get_instance_private (self);
 }
 
 static void
@@ -179,9 +179,6 @@ gkm_sexp_key_class_init (GkmSexpKeyClass *klass)
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
        GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-       gkm_sexp_key_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmSexpKeyPrivate));
-
        gobject_class->finalize = gkm_sexp_key_finalize;
        gobject_class->set_property = gkm_sexp_key_set_property;
        gobject_class->get_property = gkm_sexp_key_get_property;
diff --git a/pkcs11/gkm/gkm-store.c b/pkcs11/gkm/gkm-store.c
index 930ca436..cb1c14de 100644
--- a/pkcs11/gkm/gkm-store.c
+++ b/pkcs11/gkm/gkm-store.c
@@ -40,7 +40,7 @@ struct _GkmStorePrivate {
        GHashTable *schemas;
 };
 
-G_DEFINE_TYPE (GkmStore, gkm_store, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmStore, gkm_store, G_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -75,7 +75,7 @@ gkm_store_constructor (GType type, guint n_props, GObjectConstructParam *props)
 static void
 gkm_store_init (GkmStore *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_STORE, GkmStorePrivate);
+       self->pv = gkm_store_get_instance_private (self);
        self->pv->schemas = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
                                                   NULL, schema_free);
 }
@@ -132,8 +132,6 @@ gkm_store_class_init (GkmStoreClass *klass)
        gobject_class->finalize = gkm_store_finalize;
        gobject_class->set_property = gkm_store_set_property;
        gobject_class->get_property = gkm_store_get_property;
-
-       g_type_class_add_private (klass, sizeof (GkmStorePrivate));
 }
 
 /* -----------------------------------------------------------------------------
diff --git a/pkcs11/secret-store/gkm-secret-object.c b/pkcs11/secret-store/gkm-secret-object.c
index 0cf7ebf6..acc63707 100644
--- a/pkcs11/secret-store/gkm-secret-object.c
+++ b/pkcs11/secret-store/gkm-secret-object.c
@@ -45,7 +45,7 @@ struct _GkmSecretObjectPrivate {
        glong modified;
 };
 
-G_DEFINE_TYPE (GkmSecretObject, gkm_secret_object, GKM_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GkmSecretObject, gkm_secret_object, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -187,7 +187,7 @@ gkm_secret_object_real_is_locked (GkmSecretObject *self, GkmSession *session)
 static void
 gkm_secret_object_init (GkmSecretObject *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SECRET_OBJECT, GkmSecretObjectPrivate);
+       self->pv = gkm_secret_object_get_instance_private (self);
 }
 
 static GObject*
@@ -282,9 +282,6 @@ gkm_secret_object_class_init (GkmSecretObjectClass *klass)
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
        GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-       gkm_secret_object_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (GkmSecretObjectPrivate));
-
        gobject_class->constructor = gkm_secret_object_constructor;
        gobject_class->finalize = gkm_secret_object_finalize;
        gobject_class->set_property = gkm_secret_object_set_property;
diff --git a/pkcs11/xdg-store/gkm-xdg-trust.c b/pkcs11/xdg-store/gkm-xdg-trust.c
index 68d97213..518e3151 100644
--- a/pkcs11/xdg-store/gkm-xdg-trust.c
+++ b/pkcs11/xdg-store/gkm-xdg-trust.c
@@ -54,7 +54,8 @@ struct _GkmXdgTrustPrivate {
 static void gkm_xdg_trust_serializable (GkmSerializableIface *iface);
 
 G_DEFINE_TYPE_EXTENDED (GkmXdgTrust, gkm_xdg_trust, GKM_TYPE_TRUST, 0,
-                        G_IMPLEMENT_INTERFACE (GKM_TYPE_SERIALIZABLE, gkm_xdg_trust_serializable));
+                        G_IMPLEMENT_INTERFACE (GKM_TYPE_SERIALIZABLE, gkm_xdg_trust_serializable)
+                                               G_ADD_PRIVATE (GkmXdgTrust));
 
 static GQuark QDATA_ASSERTION_KEY = 0;
 
@@ -690,7 +691,7 @@ gkm_xdg_trust_get_level (GkmTrust *base, const gchar *purpose)
 static void
 gkm_xdg_trust_init (GkmXdgTrust *self)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_XDG_TYPE_TRUST, GkmXdgTrustPrivate);
+       self->pv = gkm_xdg_trust_get_instance_private (self);
        self->pv->assertions = create_assertions ();
 }
 
@@ -727,7 +728,6 @@ gkm_xdg_trust_class_init (GkmXdgTrustClass *klass)
        trust_class->get_trust_level = gkm_xdg_trust_get_level;
 
        QDATA_ASSERTION_KEY = g_quark_from_static_string ("gkm-xdg-trust-assertion-key");
-       g_type_class_add_private (klass, sizeof (GkmXdgTrustPrivate));
 
        init_quarks ();
 }


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