[gnome-control-center/gbsneto/cleanup-network-panel: 4/23] net-device: Remove macro to get private field



commit f4027b9a257eda1005ff6a49836fe10b29b06d53
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Oct 31 20:12:42 2018 -0300

    net-device: Remove macro to get private field
    
    We can just use the standard, non-deprecated G_DEFINE_TYPE_WITH_PRIVATE
    and avoid g_type_class_add_private(), which is deprecated now.

 panels/network/net-device.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index 95b556eca..bce12f6bf 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -30,8 +30,6 @@
 
 #include "net-device.h"
 
-#define NET_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NET_TYPE_DEVICE, NetDevicePrivate))
-
 struct _NetDevicePrivate
 {
         NMDevice                        *nm_device;
@@ -44,7 +42,7 @@ enum {
         PROP_LAST
 };
 
-G_DEFINE_TYPE (NetDevice, net_device, NET_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (NetDevice, net_device, NET_TYPE_OBJECT)
 
 /* return value must be freed by caller with g_free() */
 static gchar *
@@ -290,14 +288,12 @@ net_device_class_init (NetDeviceClass *klass)
                                      NM_TYPE_DEVICE,
                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
         g_object_class_install_property (object_class, PROP_DEVICE, pspec);
-
-        g_type_class_add_private (klass, sizeof (NetDevicePrivate));
 }
 
 static void
 net_device_init (NetDevice *device)
 {
-        device->priv = NET_DEVICE_GET_PRIVATE (device);
+        device->priv = net_device_get_instance_private (device);
 }
 
 NetDevice *


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