[gupnp-igd/wip/remove-deprecated-apis: 6/7] Move to new style private data



commit d84e0d0ed2141f0a4e0cdb9f1076fc0571b85b12
Author: Olivier Crête <olivier crete collabora com>
Date:   Wed Mar 18 20:27:09 2020 -0400

    Move to new style private data
    
    Also now require GLib 2.38

 README                                 | 2 +-
 libgupnp-igd/gupnp-simple-igd-thread.c | 8 +++-----
 libgupnp-igd/gupnp-simple-igd.c        | 7 +++----
 meson.build                            | 2 +-
 4 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/README b/README
index 772c412..4b74b6f 100644
--- a/README
+++ b/README
@@ -6,4 +6,4 @@ It is supposed to have a very simple API. Read the gtk-doc.
 
 The only dependencies are:
  - GUPnP 1.2
- - GLib 2.32
+ - GLib 2.38
diff --git a/libgupnp-igd/gupnp-simple-igd-thread.c b/libgupnp-igd/gupnp-simple-igd-thread.c
index 3c025ac..77bfebd 100644
--- a/libgupnp-igd/gupnp-simple-igd-thread.c
+++ b/libgupnp-igd/gupnp-simple-igd-thread.c
@@ -88,8 +88,8 @@ struct _GUPnPSimpleIgdThreadPrivate
   g_mutex_unlock (&(o)->priv->thread_data->mutex)
 
 
-G_DEFINE_TYPE (GUPnPSimpleIgdThread, gupnp_simple_igd_thread,
-    GUPNP_TYPE_SIMPLE_IGD);
+G_DEFINE_TYPE_WITH_CODE (GUPnPSimpleIgdThread, gupnp_simple_igd_thread,
+    GUPNP_TYPE_SIMPLE_IGD, G_ADD_PRIVATE (GUPnPSimpleIgdThread));
 
 static void gupnp_simple_igd_thread_constructed (GObject *object);
 static GObject *gupnp_simple_igd_thread_constructor (GType type,
@@ -132,8 +132,6 @@ gupnp_simple_igd_thread_class_init (GUPnPSimpleIgdThreadClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GUPnPSimpleIgdClass *simple_igd_class = GUPNP_SIMPLE_IGD_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GUPnPSimpleIgdThreadPrivate));
-
   gobject_class->constructed = gupnp_simple_igd_thread_constructed;
   gobject_class->constructor = gupnp_simple_igd_thread_constructor;
   gobject_class->dispose = gupnp_simple_igd_thread_dispose;
@@ -149,7 +147,7 @@ gupnp_simple_igd_thread_class_init (GUPnPSimpleIgdThreadClass *klass)
 static void
 gupnp_simple_igd_thread_init (GUPnPSimpleIgdThread *self)
 {
-  self->priv = GUPNP_SIMPLE_IGD_THREAD_GET_PRIVATE (self);
+  self->priv = gupnp_simple_igd_thread_get_instance_private (self);
 
   self->priv->context = g_main_context_new ();
   g_cond_init (&self->priv->can_dispose_cond);
diff --git a/libgupnp-igd/gupnp-simple-igd.c b/libgupnp-igd/gupnp-simple-igd.c
index f7eed73..3a68dff 100644
--- a/libgupnp-igd/gupnp-simple-igd.c
+++ b/libgupnp-igd/gupnp-simple-igd.c
@@ -124,7 +124,8 @@ guint signals[LAST_SIGNAL] = { 0 };
    GUPnPSimpleIgdPrivate))
 
 
-G_DEFINE_TYPE (GUPnPSimpleIgd, gupnp_simple_igd, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_CODE (GUPnPSimpleIgd, gupnp_simple_igd, G_TYPE_OBJECT,
+    G_ADD_PRIVATE (GUPnPSimpleIgd));
 
 
 static void gupnp_simple_igd_constructed (GObject *object);
@@ -171,8 +172,6 @@ gupnp_simple_igd_class_init (GUPnPSimpleIgdClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GUPnPSimpleIgdPrivate));
-
   gobject_class->constructed = gupnp_simple_igd_constructed;
   gobject_class->dispose = gupnp_simple_igd_dispose;
   gobject_class->finalize = gupnp_simple_igd_finalize;
@@ -264,7 +263,7 @@ gupnp_simple_igd_class_init (GUPnPSimpleIgdClass *klass)
 static void
 gupnp_simple_igd_init (GUPnPSimpleIgd *self)
 {
-  self->priv = GUPNP_SIMPLE_IGD_GET_PRIVATE (self);
+  self->priv = gupnp_simple_igd_get_instance_private (self);
 
   self->priv->service_proxies = g_ptr_array_new ();
   self->priv->mappings = g_ptr_array_new ();
diff --git a/meson.build b/meson.build
index d6bde90..35da2f7 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project('gupnp-igd', 'c', version: '0.2.5')
 gnome = import('gnome')
 pkg = import('pkgconfig')
 
-glib_req = '>= 2.32'
+glib_req = '>= 2.38'
 dependencies = [
     dependency('glib-2.0', version: glib_req, required: true),
     dependency('gobject-2.0', version: glib_req, required: true),


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