[balsa] net-client: Use G_DEFINE_TYPE_WITH_PRIVATE



commit 162b1faf1960fb7e0dee217e2e793505d1d7ba8a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Jun 28 19:22:55 2018 -0400

    net-client: Use G_DEFINE_TYPE_WITH_PRIVATE
    
            * libnetclient/net-client.c (net_client_class_init),
            (net_client_init): g_type_class_add_private() is soon to be
            deprecated; use G_DEFINE_TYPE_WITH_PRIVATE intead;
            also use net_client_get_instance_private() instead of
            G_TYPE_INSTANCE_GET_PRIVATE().

 ChangeLog                 | 8 ++++++++
 libnetclient/net-client.c | 5 ++---
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bcacde1de..c06bed875 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-28  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       * libnetclient/net-client.c (net_client_class_init),
+       (net_client_init): g_type_class_add_private() is soon to be
+       deprecated; use G_DEFINE_TYPE_WITH_PRIVATE intead;
+       also use net_client_get_instance_private() instead of
+       G_TYPE_INSTANCE_GET_PRIVATE().
+
 2018-06-26  Peter Bloomfield  <pbloomfield bellsouth net>
 
        * src/main-window.c (about_activated): Update the 'about'
diff --git a/libnetclient/net-client.c b/libnetclient/net-client.c
index b7d77be3c..7b4c376da 100644
--- a/libnetclient/net-client.c
+++ b/libnetclient/net-client.c
@@ -56,7 +56,7 @@ struct _NetClientPrivate {
 static guint signals[3];
 
 
-G_DEFINE_TYPE(NetClient, net_client, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(NetClient, net_client, G_TYPE_OBJECT)
 
 
 static void net_client_finalise(GObject *object);
@@ -589,7 +589,6 @@ net_client_class_init(NetClientClass *klass)
 {
        GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
-       g_type_class_add_private(klass, sizeof(NetClientPrivate));
        gobject_class->finalize = net_client_finalise;
        signals[0] = g_signal_new("cert-check", NET_CLIENT_TYPE, G_SIGNAL_RUN_LAST, 0U, NULL, NULL, NULL, 
G_TYPE_BOOLEAN, 2U,
                G_TYPE_TLS_CERTIFICATE, G_TYPE_TLS_CERTIFICATE_FLAGS);
@@ -602,7 +601,7 @@ net_client_class_init(NetClientClass *klass)
 static void
 net_client_init(NetClient *self)
 {
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, NET_CLIENT_TYPE, NetClientPrivate);
+       self->priv = net_client_get_instance_private(self);
        self->priv->sock = g_socket_client_new();
        if (self->priv->sock != NULL) {
                g_socket_client_set_timeout(self->priv->sock, 180U);


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