[librest] rest-proxy-auth: Use G_DEFINE_TYPE_WITH_PRIVATE



commit d091b23d1acdc108c03386221e2448d6dceb1bec
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 4 14:09:22 2017 +0200

    rest-proxy-auth: Use G_DEFINE_TYPE_WITH_PRIVATE
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785818

 rest/rest-proxy-auth.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/rest/rest-proxy-auth.c b/rest/rest-proxy-auth.c
index 79f21e0..b96e443 100644
--- a/rest/rest-proxy-auth.c
+++ b/rest/rest-proxy-auth.c
@@ -24,10 +24,7 @@
 #include <rest/rest-proxy-auth-private.h>
 #include "rest-private.h"
 
-G_DEFINE_TYPE (RestProxyAuth, rest_proxy_auth, G_TYPE_OBJECT)
-
-#define REST_PROXY_AUTH_GET_PRIVATE(o) \
-  (G_TYPE_INSTANCE_GET_PRIVATE ((o), REST_TYPE_PROXY_AUTH, RestProxyAuthPrivate))
+#define GET_PRIVATE(o) rest_proxy_auth_get_instance_private(REST_PROXY_AUTH(o))
 
 struct _RestProxyAuthPrivate {
   /* used to hold state during async authentication */
@@ -38,6 +35,8 @@ struct _RestProxyAuthPrivate {
   gboolean paused;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (RestProxyAuth, rest_proxy_auth, G_TYPE_OBJECT)
+
 static void
 rest_proxy_auth_dispose (GObject *object)
 {
@@ -56,15 +55,13 @@ rest_proxy_auth_class_init (RestProxyAuthClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (RestProxyAuthPrivate));
-
   object_class->dispose = rest_proxy_auth_dispose;
 }
 
 static void
 rest_proxy_auth_init (RestProxyAuth *proxy)
 {
-  proxy->priv = REST_PROXY_AUTH_GET_PRIVATE (proxy);
+  proxy->priv = GET_PRIVATE (proxy);
 }
 
 G_GNUC_INTERNAL RestProxyAuth*


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