[glib/wip/private-rework-3: 2/4] gio: Use the new private instance data declaration



commit a2d9488a10dc497999ac2c6d7f039adf1ebc7b50
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Jun 11 00:29:58 2013 +0100

    gio: Use the new private instance data declaration
    
    Use the newly added macros, and remove the explicit calls to
    g_type_class_add_private().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700035

 gio/gappinfo.c                   |   12 +++++-------
 gio/gapplication.c               |    7 ++-----
 gio/gapplicationcommandline.c    |   11 +++--------
 gio/gbufferedinputstream.c       |    7 ++-----
 gio/gbufferedoutputstream.c      |    8 ++------
 gio/gcancellable.c               |    8 ++------
 gio/gconverterinputstream.c      |   10 +++-------
 gio/gconverteroutputstream.c     |   10 +++-------
 gio/gdatainputstream.c           |   13 ++++---------
 gio/gdataoutputstream.c          |    8 ++------
 gio/gdbus-2.0/codegen/codegen.py |   18 ++++++++----------
 gio/gdbusauth.c                  |    7 ++-----
 gio/gdbusauthmechanism.c         |    9 ++-------
 gio/gdbusauthmechanismanon.c     |    8 ++------
 gio/gdbusauthmechanismexternal.c |    8 ++------
 gio/gdbusauthmechanismsha1.c     |    8 ++------
 gio/gdbusinterfaceskeleton.c     |    7 +++----
 gio/gdbusobjectmanagerclient.c   |    7 ++-----
 gio/gdbusobjectmanagerserver.c   |    9 +++------
 gio/gdbusobjectproxy.c           |    9 +++------
 gio/gdbusobjectskeleton.c        |    7 +++----
 gio/gdbusproxy.c                 |    8 +++-----
 gio/gdelayedsettingsbackend.c    |   13 ++++---------
 gio/gemblemedicon.c              |    7 ++-----
 gio/gfileenumerator.c            |   27 +++++++++++----------------
 gio/gfileinputstream.c           |    6 +-----
 gio/gfileiostream.c              |   15 ++++++---------
 gio/gfilemonitor.c               |   18 +++++++-----------
 gio/gfileoutputstream.c          |   15 ++++++---------
 gio/gfilterinputstream.c         |   34 +++++++++++++++-------------------
 gio/gfilteroutputstream.c        |   29 ++++++++++++++---------------
 gio/ginetaddress.c               |   24 ++++++++++--------------
 gio/ginetaddressmask.c           |   19 ++++++++-----------
 gio/ginetsocketaddress.c         |   38 ++++++++++++--------------------------
 gio/ginputstream.c               |   17 +++--------------
 gio/giostream.c                  |   15 ++-------------
 gio/glocalfileinputstream.c      |   32 +++++++++-----------------------
 gio/glocalfileoutputstream.c     |   35 +++++++++++++++--------------------
 gio/gmemoryinputstream.c         |    7 ++-----
 gio/gmemoryoutputstream.c        |    7 ++-----
 gio/gmenumodel.c                 |   16 ++++++----------
 gio/gmountoperation.c            |   10 +++-------
 gio/gnetworkaddress.c            |    6 ++----
 gio/gnetworkmonitorbase.c        |   30 +++++++++++++-----------------
 gio/gnetworkmonitornetlink.c     |   31 ++++++++++++++-----------------
 gio/gnetworkservice.c            |    6 ++----
 gio/goutputstream.c              |   19 ++++---------------
 gio/gpermission.c                |   10 +++-------
 gio/gproxyaddress.c              |    9 +++------
 gio/gproxyaddressenumerator.c    |   11 +++--------
 gio/gresolver.c                  |    5 ++---
 gio/gsettings.c                  |    9 ++-------
 gio/gsettingsbackend.c           |   10 +++-------
 gio/gsimpleactiongroup.c         |    7 ++-----
 gio/gsimpleproxyresolver.c       |    7 ++-----
 gio/gsocket.c                    |   15 +++++++--------
 gio/gsocketclient.c              |   13 ++++---------
 gio/gsocketconnection.c          |   10 +++-------
 gio/gsocketinputstream.c         |   29 ++++++++++++++---------------
 gio/gsocketlistener.c            |   10 +++-------
 gio/gsocketoutputstream.c        |   29 ++++++++++++++---------------
 gio/gsocketservice.c             |   19 +++++++------------
 gio/gtcpconnection.c             |   16 ++++++----------
 gio/gtcpwrapperconnection.c      |   19 +++++++------------
 gio/gtestdbus.c                  |    8 ++------
 gio/gthreadedsocketservice.c     |   26 ++++++++++----------------
 gio/gtlsinteraction.c            |    7 ++-----
 gio/gtlspassword.c               |    7 ++-----
 gio/gunixcredentialsmessage.c    |    9 ++-------
 gio/gunixfdlist.c                |   11 +++--------
 gio/gunixfdmessage.c             |   12 +++---------
 gio/gunixinputstream.c           |   27 ++++++++-------------------
 gio/gunixoutputstream.c          |   27 ++++++++-------------------
 gio/gunixsocketaddress.c         |    9 +++------
 gio/gwin32inputstream.c          |   18 +++---------------
 gio/gwin32outputstream.c         |   19 +++----------------
 76 files changed, 370 insertions(+), 713 deletions(-)
---
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index 9472c0c..0cb0603 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -788,14 +788,14 @@ enum {
   LAST_SIGNAL
 };
 
-guint signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (GAppLaunchContext, g_app_launch_context, G_TYPE_OBJECT);
-
 struct _GAppLaunchContextPrivate {
   char **envp;
 };
 
+static guint signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE_WITH_PRIVATE (GAppLaunchContext, g_app_launch_context, G_TYPE_OBJECT)
+
 /**
  * g_app_launch_context_new:
  * 
@@ -825,8 +825,6 @@ g_app_launch_context_class_init (GAppLaunchContextClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GAppLaunchContextPrivate));
-
   object_class->finalize = g_app_launch_context_finalize;
 
   /*
@@ -873,7 +871,7 @@ g_app_launch_context_class_init (GAppLaunchContextClass *klass)
 static void
 g_app_launch_context_init (GAppLaunchContext *context)
 {
-  context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context, G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextPrivate);
+  context->priv = g_app_launch_context_get_private (context);
 }
 
 /**
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 5218348..8c2ba15 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -278,6 +278,7 @@ static guint g_application_signals[NR_SIGNALS];
 static void g_application_action_group_iface_init (GActionGroupInterface *);
 static void g_application_action_map_iface_init (GActionMapInterface *);
 G_DEFINE_TYPE_WITH_CODE (GApplication, g_application, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GApplication)
  G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_application_action_group_iface_init)
  G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_MAP, g_application_action_map_iface_init))
 
@@ -692,9 +693,7 @@ g_application_finalize (GObject *object)
 static void
 g_application_init (GApplication *application)
 {
-  application->priv = G_TYPE_INSTANCE_GET_PRIVATE (application,
-                                                   G_TYPE_APPLICATION,
-                                                   GApplicationPrivate);
+  application->priv = g_application_get_private (application);
 
   application->priv->actions = g_application_exported_actions_new (application);
 
@@ -845,8 +844,6 @@ g_application_class_init (GApplicationClass *class)
                   g_signal_accumulator_first_wins, NULL,
                   NULL,
                   G_TYPE_INT, 1, G_TYPE_APPLICATION_COMMAND_LINE);
-
-  g_type_class_add_private (class, sizeof (GApplicationPrivate));
 }
 
 static GVariant *
diff --git a/gio/gapplicationcommandline.c b/gio/gapplicationcommandline.c
index c1fbbb7..7de0caf 100644
--- a/gio/gapplicationcommandline.c
+++ b/gio/gapplicationcommandline.c
@@ -39,8 +39,6 @@
 #include "gwin32inputstream.h"
 #endif
 
-G_DEFINE_TYPE (GApplicationCommandLine, g_application_command_line, G_TYPE_OBJECT)
-
 /**
  * SECTION:gapplicationcommandline
  * @title: GApplicationCommandLine
@@ -156,6 +154,8 @@ struct _GApplicationCommandLinePrivate
   gint exit_status;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GApplicationCommandLine, g_application_command_line, G_TYPE_OBJECT)
+
 /* All subclasses represent remote invocations of some kind. */
 #define IS_REMOTE(cmdline) (G_TYPE_FROM_INSTANCE (cmdline) != \
                             G_TYPE_APPLICATION_COMMAND_LINE)
@@ -282,10 +282,7 @@ g_application_command_line_finalize (GObject *object)
 static void
 g_application_command_line_init (GApplicationCommandLine *cmdline)
 {
-  cmdline->priv =
-    G_TYPE_INSTANCE_GET_PRIVATE (cmdline,
-                                 G_TYPE_APPLICATION_COMMAND_LINE,
-                                 GApplicationCommandLinePrivate);
+  cmdline->priv = g_application_command_line_get_private (cmdline);
 }
 
 static void
@@ -340,8 +337,6 @@ g_application_command_line_class_init (GApplicationCommandLineClass *class)
                           P_("TRUE if this is a remote commandline"),
                           FALSE,
                           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  g_type_class_add_private (class, sizeof (GApplicationCommandLinePrivate));
 }
 
 
diff --git a/gio/gbufferedinputstream.c b/gio/gbufferedinputstream.c
index 2013118..daeba85 100644
--- a/gio/gbufferedinputstream.c
+++ b/gio/gbufferedinputstream.c
@@ -136,6 +136,7 @@ static void compact_buffer (GBufferedInputStream *stream);
 G_DEFINE_TYPE_WITH_CODE (GBufferedInputStream,
                         g_buffered_input_stream,
                         G_TYPE_FILTER_INPUT_STREAM,
+                         G_ADD_PRIVATE (GBufferedInputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
                                                g_buffered_input_stream_seekable_iface_init))
 
@@ -146,8 +147,6 @@ g_buffered_input_stream_class_init (GBufferedInputStreamClass *klass)
   GInputStreamClass *istream_class;
   GBufferedInputStreamClass *bstream_class;
 
-  g_type_class_add_private (klass, sizeof (GBufferedInputStreamPrivate));
-
   object_class = G_OBJECT_CLASS (klass);
   object_class->get_property = g_buffered_input_stream_get_property;
   object_class->set_property = g_buffered_input_stream_set_property;
@@ -317,9 +316,7 @@ g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface)
 static void
 g_buffered_input_stream_init (GBufferedInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                              G_TYPE_BUFFERED_INPUT_STREAM,
-                                              GBufferedInputStreamPrivate);
+  stream->priv = g_buffered_input_stream_get_private (stream);
 }
 
 
diff --git a/gio/gbufferedoutputstream.c b/gio/gbufferedoutputstream.c
index 64fafbf..2be1eba 100644
--- a/gio/gbufferedoutputstream.c
+++ b/gio/gbufferedoutputstream.c
@@ -124,6 +124,7 @@ static gboolean g_buffered_output_stream_truncate            (GSeekable       *s
 G_DEFINE_TYPE_WITH_CODE (GBufferedOutputStream,
                         g_buffered_output_stream,
                         G_TYPE_FILTER_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GBufferedOutputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
                                                g_buffered_output_stream_seekable_iface_init))
 
@@ -133,8 +134,6 @@ g_buffered_output_stream_class_init (GBufferedOutputStreamClass *klass)
 {
   GObjectClass *object_class;
   GOutputStreamClass *ostream_class;
- 
-  g_type_class_add_private (klass, sizeof (GBufferedOutputStreamPrivate));
 
   object_class = G_OBJECT_CLASS (klass);
   object_class->get_property = g_buffered_output_stream_get_property;
@@ -345,10 +344,7 @@ g_buffered_output_stream_finalize (GObject *object)
 static void
 g_buffered_output_stream_init (GBufferedOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                              G_TYPE_BUFFERED_OUTPUT_STREAM,
-                                              GBufferedOutputStreamPrivate);
-
+  stream->priv = g_buffered_output_stream_get_private (stream);
 }
 
 static void
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index 0ba3a01..847e8ed 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -55,7 +55,7 @@ struct _GCancellablePrivate
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (GCancellable, g_cancellable, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GCancellable, g_cancellable, G_TYPE_OBJECT)
 
 static GPrivate current_cancellable;
 static GMutex cancellable_mutex;
@@ -77,8 +77,6 @@ g_cancellable_class_init (GCancellableClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GCancellablePrivate));
-
   gobject_class->finalize = g_cancellable_finalize;
 
   /**
@@ -153,9 +151,7 @@ g_cancellable_class_init (GCancellableClass *klass)
 static void
 g_cancellable_init (GCancellable *cancellable)
 {
-  cancellable->priv = G_TYPE_INSTANCE_GET_PRIVATE (cancellable,
-                                                  G_TYPE_CANCELLABLE,
-                                                  GCancellablePrivate);
+  cancellable->priv = g_cancellable_get_private (cancellable);
 }
 
 /**
diff --git a/gio/gconverterinputstream.c b/gio/gconverterinputstream.c
index 0c04bfe..2743170 100644
--- a/gio/gconverterinputstream.c
+++ b/gio/gconverterinputstream.c
@@ -99,9 +99,9 @@ static void g_converter_input_stream_pollable_iface_init  (GPollableInputStreamI
 G_DEFINE_TYPE_WITH_CODE (GConverterInputStream,
                         g_converter_input_stream,
                         G_TYPE_FILTER_INPUT_STREAM,
+                         G_ADD_PRIVATE (GConverterInputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
-                                               g_converter_input_stream_pollable_iface_init);
-                        )
+                                               g_converter_input_stream_pollable_iface_init))
 
 static void
 g_converter_input_stream_class_init (GConverterInputStreamClass *klass)
@@ -109,8 +109,6 @@ g_converter_input_stream_class_init (GConverterInputStreamClass *klass)
   GObjectClass *object_class;
   GInputStreamClass *istream_class;
 
-  g_type_class_add_private (klass, sizeof (GConverterInputStreamPrivate));
-
   object_class = G_OBJECT_CLASS (klass);
   object_class->get_property = g_converter_input_stream_get_property;
   object_class->set_property = g_converter_input_stream_set_property;
@@ -207,9 +205,7 @@ g_converter_input_stream_get_property (GObject    *object,
 static void
 g_converter_input_stream_init (GConverterInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_CONVERTER_INPUT_STREAM,
-                                             GConverterInputStreamPrivate);
+  stream->priv = g_converter_input_stream_get_private (stream);
 }
 
 /**
diff --git a/gio/gconverteroutputstream.c b/gio/gconverteroutputstream.c
index 9199010..0d7e0b2 100644
--- a/gio/gconverteroutputstream.c
+++ b/gio/gconverteroutputstream.c
@@ -114,9 +114,9 @@ static void g_converter_output_stream_pollable_iface_init (GPollableOutputStream
 G_DEFINE_TYPE_WITH_CODE (GConverterOutputStream,
                         g_converter_output_stream,
                         G_TYPE_FILTER_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GConverterOutputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM,
-                                               g_converter_output_stream_pollable_iface_init);
-                        )
+                                               g_converter_output_stream_pollable_iface_init))
 
 static void
 g_converter_output_stream_class_init (GConverterOutputStreamClass *klass)
@@ -124,8 +124,6 @@ g_converter_output_stream_class_init (GConverterOutputStreamClass *klass)
   GObjectClass *object_class;
   GOutputStreamClass *istream_class;
 
-  g_type_class_add_private (klass, sizeof (GConverterOutputStreamPrivate));
-
   object_class = G_OBJECT_CLASS (klass);
   object_class->get_property = g_converter_output_stream_get_property;
   object_class->set_property = g_converter_output_stream_set_property;
@@ -223,9 +221,7 @@ g_converter_output_stream_get_property (GObject    *object,
 static void
 g_converter_output_stream_init (GConverterOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_CONVERTER_OUTPUT_STREAM,
-                                             GConverterOutputStreamPrivate);
+  stream->priv = g_converter_output_stream_get_private (stream);
 }
 
 /**
diff --git a/gio/gdatainputstream.c b/gio/gdatainputstream.c
index 46b62b7..9f16d83 100644
--- a/gio/gdatainputstream.c
+++ b/gio/gdatainputstream.c
@@ -63,9 +63,9 @@ static void g_data_input_stream_get_property (GObject      *object,
                                              GValue       *value,
                                              GParamSpec   *pspec);
 
-G_DEFINE_TYPE (GDataInputStream,
-               g_data_input_stream,
-               G_TYPE_BUFFERED_INPUT_STREAM)
+G_DEFINE_TYPE_WITH_PRIVATE (GDataInputStream,
+                            g_data_input_stream,
+                            G_TYPE_BUFFERED_INPUT_STREAM)
 
 
 static void
@@ -73,8 +73,6 @@ g_data_input_stream_class_init (GDataInputStreamClass *klass)
 {
   GObjectClass *object_class;
 
-  g_type_class_add_private (klass, sizeof (GDataInputStreamPrivate));
-
   object_class = G_OBJECT_CLASS (klass);
   object_class->get_property = g_data_input_stream_get_property;
   object_class->set_property = g_data_input_stream_set_property;
@@ -169,10 +167,7 @@ g_data_input_stream_get_property (GObject    *object,
 static void
 g_data_input_stream_init (GDataInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                              G_TYPE_DATA_INPUT_STREAM,
-                                              GDataInputStreamPrivate);
-
+  stream->priv = g_data_input_stream_get_private (stream);
   stream->priv->byte_order = G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN;
   stream->priv->newline_type = G_DATA_STREAM_NEWLINE_TYPE_LF;
 }
diff --git a/gio/gdataoutputstream.c b/gio/gdataoutputstream.c
index 5abf68f..bbcd588 100644
--- a/gio/gdataoutputstream.c
+++ b/gio/gdataoutputstream.c
@@ -77,6 +77,7 @@ static gboolean g_data_output_stream_truncate            (GSeekable       *seeka
 G_DEFINE_TYPE_WITH_CODE (GDataOutputStream,
                         g_data_output_stream,
                         G_TYPE_FILTER_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GDataOutputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
                                                g_data_output_stream_seekable_iface_init))
 
@@ -86,8 +87,6 @@ g_data_output_stream_class_init (GDataOutputStreamClass *klass)
 {
   GObjectClass *object_class;
 
-  g_type_class_add_private (klass, sizeof (GDataOutputStreamPrivate));
-
   object_class = G_OBJECT_CLASS (klass);
   object_class->get_property = g_data_output_stream_get_property;
   object_class->set_property = g_data_output_stream_set_property;
@@ -158,10 +157,7 @@ g_data_output_stream_get_property (GObject    *object,
 static void
 g_data_output_stream_init (GDataOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                              G_TYPE_DATA_OUTPUT_STREAM,
-                                              GDataOutputStreamPrivate);
-
+  stream->priv = g_data_output_stream_get_private (stream);
   stream->priv->byte_order = G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN;
 }
 
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 2c1c52e..5508b76 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -1570,6 +1570,7 @@ class CodeGenerator:
         self.c.write('static void %s_proxy_iface_init (%sIface *iface);\n'
                      '\n'%(i.name_lower, i.camel_name))
         self.c.write('G_DEFINE_TYPE_WITH_CODE (%sProxy, %s_proxy, G_TYPE_DBUS_PROXY,\n'%(i.camel_name, 
i.name_lower))
+        self.c.write('                         G_ADD_PRIVATE (%sProxy)\n'%(i.camel_name))
         self.c.write('                         G_IMPLEMENT_INTERFACE (%sTYPE_%s, 
%s_proxy_iface_init));\n\n'%(i.ns_upper, i.name_upper, i.name_lower))
 
         # finalize
@@ -1794,12 +1795,12 @@ class CodeGenerator:
         self.c.write('static void\n'
                      '%s_proxy_init (%sProxy *proxy)\n'
                      '{\n'
-                     '  proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, %sTYPE_%s_PROXY, 
%sProxyPrivate);\n'
+                     '  proxy->priv = %s_proxy_get_private (proxy);\n'
                      '  g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), %s_interface_info ());\n'
                      '}\n'
                      '\n'
                      %(i.name_lower, i.camel_name,
-                       i.ns_upper, i.name_upper, i.camel_name,
+                       i.name_lower,
                        i.name_lower))
         self.c.write('static void\n'
                      '%s_proxy_class_init (%sProxyClass *klass)\n'
@@ -1807,8 +1808,6 @@ class CodeGenerator:
                      '  GObjectClass *gobject_class;\n'
                      '  GDBusProxyClass *proxy_class;\n'
                      '\n'
-                     '  g_type_class_add_private (klass, sizeof (%sProxyPrivate));\n'
-                     '\n'
                      '  gobject_class = G_OBJECT_CLASS (klass);\n'
                      '  gobject_class->finalize     = %s_proxy_finalize;\n'
                      '  gobject_class->get_property = %s_proxy_get_property;\n'
@@ -1818,7 +1817,6 @@ class CodeGenerator:
                      '  proxy_class->g_signal = %s_proxy_g_signal;\n'
                      '  proxy_class->g_properties_changed = %s_proxy_g_properties_changed;\n'
                      '\n'%(i.name_lower, i.camel_name,
-                           i.camel_name,
                            i.name_lower, i.name_lower, i.name_lower, i.name_lower, i.name_lower))
         if len(i.properties) > 0:
             self.c.write('\n'
@@ -2341,6 +2339,7 @@ class CodeGenerator:
                      %(i.name_lower, i.camel_name))
 
         self.c.write('G_DEFINE_TYPE_WITH_CODE (%sSkeleton, %s_skeleton, 
G_TYPE_DBUS_INTERFACE_SKELETON,\n'%(i.camel_name, i.name_lower))
+        self.c.write('                         G_ADD_PRIVATE (%sSkeleton)\n'%(i.camel_name))
         self.c.write('                         G_IMPLEMENT_INTERFACE (%sTYPE_%s, 
%s_skeleton_iface_init));\n\n'%(i.ns_upper, i.name_upper, i.name_lower))
 
         # finalize
@@ -2534,8 +2533,9 @@ class CodeGenerator:
         self.c.write('static void\n'
                      '%s_skeleton_init (%sSkeleton *skeleton)\n'
                      '{\n'
-                     '  skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, %sTYPE_%s_SKELETON, 
%sSkeletonPrivate);\n'
-                     %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper, i.camel_name))
+                     '  skeleton->priv = %s_skeleton_get_private (skeleton);\n'
+                     %(i.name_lower, i.camel_name,
+                       i.name_lower))
         self.c.write('  g_mutex_init (&skeleton->priv->lock);\n')
         self.c.write('  skeleton->priv->context = g_main_context_ref_thread_default ();\n')
         if len(i.properties) > 0:
@@ -2571,11 +2571,9 @@ class CodeGenerator:
                      '  GObjectClass *gobject_class;\n'
                      '  GDBusInterfaceSkeletonClass *skeleton_class;\n'
                      '\n'
-                     '  g_type_class_add_private (klass, sizeof (%sSkeletonPrivate));\n'
-                     '\n'
                      '  gobject_class = G_OBJECT_CLASS (klass);\n'
                      '  gobject_class->finalize = %s_skeleton_finalize;\n'
-                     %(i.name_lower, i.camel_name, i.camel_name, i.name_lower))
+                     %(i.name_lower, i.camel_name, i.name_lower))
         if len(i.properties) > 0:
             self.c.write('  gobject_class->get_property = %s_skeleton_get_property;\n'
                          '  gobject_class->set_property = %s_skeleton_set_property;\n'
diff --git a/gio/gdbusauth.c b/gio/gdbusauth.c
index 4b84a9e..bccb9e0 100644
--- a/gio/gdbusauth.c
+++ b/gio/gdbusauth.c
@@ -104,7 +104,7 @@ enum
   PROP_STREAM
 };
 
-G_DEFINE_TYPE (GDBusAuth, _g_dbus_auth, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuth, _g_dbus_auth, G_TYPE_OBJECT)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -166,8 +166,6 @@ _g_dbus_auth_class_init (GDBusAuthClass *klass)
 {
   GObjectClass *gobject_class;
 
-  g_type_class_add_private (klass, sizeof (GDBusAuthPrivate));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->get_property = _g_dbus_auth_get_property;
   gobject_class->set_property = _g_dbus_auth_set_property;
@@ -226,8 +224,7 @@ mech_compare_func (Mechanism *a, Mechanism *b)
 static void
 _g_dbus_auth_init (GDBusAuth *auth)
 {
-  auth->priv = G_TYPE_INSTANCE_GET_PRIVATE (auth, G_TYPE_DBUS_AUTH, GDBusAuthPrivate);
-
+  auth->priv = _g_dbus_auth_get_private (auth);
 }
 
 static void
diff --git a/gio/gdbusauthmechanism.c b/gio/gdbusauthmechanism.c
index c255992..e3772be 100644
--- a/gio/gdbusauthmechanism.c
+++ b/gio/gdbusauthmechanism.c
@@ -45,7 +45,7 @@ enum
   PROP_CREDENTIALS
 };
 
-G_DEFINE_ABSTRACT_TYPE (GDBusAuthMechanism, _g_dbus_auth_mechanism, G_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GDBusAuthMechanism, _g_dbus_auth_mechanism, G_TYPE_OBJECT)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -115,8 +115,6 @@ _g_dbus_auth_mechanism_class_init (GDBusAuthMechanismClass *klass)
 {
   GObjectClass *gobject_class;
 
-  g_type_class_add_private (klass, sizeof (GDBusAuthMechanismPrivate));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->get_property = _g_dbus_auth_mechanism_get_property;
   gobject_class->set_property = _g_dbus_auth_mechanism_set_property;
@@ -161,10 +159,7 @@ _g_dbus_auth_mechanism_class_init (GDBusAuthMechanismClass *klass)
 static void
 _g_dbus_auth_mechanism_init (GDBusAuthMechanism *mechanism)
 {
-  /* not used for now */
-  mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism,
-                                                 G_TYPE_DBUS_AUTH_MECHANISM,
-                                                 GDBusAuthMechanismPrivate);
+  mechanism->priv = _g_dbus_auth_mechanism_get_private (mechanism);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/gdbusauthmechanismanon.c b/gio/gdbusauthmechanismanon.c
index 3cc8f25..adc743a 100644
--- a/gio/gdbusauthmechanismanon.c
+++ b/gio/gdbusauthmechanismanon.c
@@ -70,7 +70,7 @@ static void                     mechanism_client_shutdown           (GDBusAuthMe
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-G_DEFINE_TYPE (GDBusAuthMechanismAnon, _g_dbus_auth_mechanism_anon, G_TYPE_DBUS_AUTH_MECHANISM);
+G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuthMechanismAnon, _g_dbus_auth_mechanism_anon, G_TYPE_DBUS_AUTH_MECHANISM)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -89,8 +89,6 @@ _g_dbus_auth_mechanism_anon_class_init (GDBusAuthMechanismAnonClass *klass)
   GObjectClass *gobject_class;
   GDBusAuthMechanismClass *mechanism_class;
 
-  g_type_class_add_private (klass, sizeof (GDBusAuthMechanismAnonPrivate));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->finalize = _g_dbus_auth_mechanism_anon_finalize;
 
@@ -116,9 +114,7 @@ _g_dbus_auth_mechanism_anon_class_init (GDBusAuthMechanismAnonClass *klass)
 static void
 _g_dbus_auth_mechanism_anon_init (GDBusAuthMechanismAnon *mechanism)
 {
-  mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism,
-                                                 G_TYPE_DBUS_AUTH_MECHANISM_ANON,
-                                                 GDBusAuthMechanismAnonPrivate);
+  mechanism->priv = _g_dbus_auth_mechanism_anon_get_private (mechanism);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/gdbusauthmechanismexternal.c b/gio/gdbusauthmechanismexternal.c
index 3fcb1ee..cdd0445 100644
--- a/gio/gdbusauthmechanismexternal.c
+++ b/gio/gdbusauthmechanismexternal.c
@@ -77,7 +77,7 @@ static void                     mechanism_client_shutdown           (GDBusAuthMe
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-G_DEFINE_TYPE (GDBusAuthMechanismExternal, _g_dbus_auth_mechanism_external, G_TYPE_DBUS_AUTH_MECHANISM);
+G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuthMechanismExternal, _g_dbus_auth_mechanism_external, 
G_TYPE_DBUS_AUTH_MECHANISM)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -96,8 +96,6 @@ _g_dbus_auth_mechanism_external_class_init (GDBusAuthMechanismExternalClass *kla
   GObjectClass *gobject_class;
   GDBusAuthMechanismClass *mechanism_class;
 
-  g_type_class_add_private (klass, sizeof (GDBusAuthMechanismExternalPrivate));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->finalize = _g_dbus_auth_mechanism_external_finalize;
 
@@ -123,9 +121,7 @@ _g_dbus_auth_mechanism_external_class_init (GDBusAuthMechanismExternalClass *kla
 static void
 _g_dbus_auth_mechanism_external_init (GDBusAuthMechanismExternal *mechanism)
 {
-  mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism,
-                                                 G_TYPE_DBUS_AUTH_MECHANISM_EXTERNAL,
-                                                 GDBusAuthMechanismExternalPrivate);
+  mechanism->priv = _g_dbus_auth_mechanism_external_get_private (mechanism);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c
index ddd1bd9..80663b1 100644
--- a/gio/gdbusauthmechanismsha1.c
+++ b/gio/gdbusauthmechanismsha1.c
@@ -93,7 +93,7 @@ static void                     mechanism_client_shutdown           (GDBusAuthMe
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-G_DEFINE_TYPE (GDBusAuthMechanismSha1, _g_dbus_auth_mechanism_sha1, G_TYPE_DBUS_AUTH_MECHANISM);
+G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuthMechanismSha1, _g_dbus_auth_mechanism_sha1, G_TYPE_DBUS_AUTH_MECHANISM)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -117,8 +117,6 @@ _g_dbus_auth_mechanism_sha1_class_init (GDBusAuthMechanismSha1Class *klass)
   GObjectClass *gobject_class;
   GDBusAuthMechanismClass *mechanism_class;
 
-  g_type_class_add_private (klass, sizeof (GDBusAuthMechanismSha1Private));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->finalize = _g_dbus_auth_mechanism_sha1_finalize;
 
@@ -144,9 +142,7 @@ _g_dbus_auth_mechanism_sha1_class_init (GDBusAuthMechanismSha1Class *klass)
 static void
 _g_dbus_auth_mechanism_sha1_init (GDBusAuthMechanismSha1 *mechanism)
 {
-  mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism,
-                                                 G_TYPE_DBUS_AUTH_MECHANISM_SHA1,
-                                                 GDBusAuthMechanismSha1Private);
+  mechanism->priv = _g_dbus_auth_mechanism_sha1_get_private (mechanism);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/gdbusinterfaceskeleton.c b/gio/gdbusinterfaceskeleton.c
index 5eb63d9..0d3df4d 100644
--- a/gio/gdbusinterfaceskeleton.c
+++ b/gio/gdbusinterfaceskeleton.c
@@ -91,7 +91,8 @@ static void     skeleton_intercept_handle_method_call              (GDBusConnect
 
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GDBusInterfaceSkeleton, g_dbus_interface_skeleton, G_TYPE_OBJECT,
-                                  G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, 
dbus_interface_interface_init));
+                                  G_ADD_PRIVATE (GDBusInterfaceSkeleton)
+                                  G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, 
dbus_interface_interface_init))
 
 static void
 g_dbus_interface_skeleton_finalize (GObject *object)
@@ -253,14 +254,12 @@ g_dbus_interface_skeleton_class_init (GDBusInterfaceSkeletonClass *klass)
                   G_TYPE_BOOLEAN,
                   1,
                   G_TYPE_DBUS_METHOD_INVOCATION);
-
-  g_type_class_add_private (klass, sizeof (GDBusInterfaceSkeletonPrivate));
 }
 
 static void
 g_dbus_interface_skeleton_init (GDBusInterfaceSkeleton *interface)
 {
-  interface->priv = G_TYPE_INSTANCE_GET_PRIVATE (interface, G_TYPE_DBUS_INTERFACE_SKELETON, 
GDBusInterfaceSkeletonPrivate);
+  interface->priv = g_dbus_interface_skeleton_get_private (interface);
   g_mutex_init (&interface->priv->lock);
 }
 
diff --git a/gio/gdbusobjectmanagerclient.c b/gio/gdbusobjectmanagerclient.c
index 5a60281..7ce7de7 100644
--- a/gio/gdbusobjectmanagerclient.c
+++ b/gio/gdbusobjectmanagerclient.c
@@ -174,6 +174,7 @@ static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface
 static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerClient, g_dbus_object_manager_client, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GDBusObjectManagerClient)
                          G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
                          G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
                          G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, 
dbus_object_manager_interface_init));
@@ -564,16 +565,12 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass)
                   G_TYPE_DBUS_PROXY,
                   G_TYPE_VARIANT,
                   G_TYPE_STRV);
-
-  g_type_class_add_private (klass, sizeof (GDBusObjectManagerClientPrivate));
 }
 
 static void
 g_dbus_object_manager_client_init (GDBusObjectManagerClient *manager)
 {
-  manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
-                                               G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
-                                               GDBusObjectManagerClientPrivate);
+  manager->priv = g_dbus_object_manager_client_get_private (manager);
   g_mutex_init (&manager->priv->lock);
   manager->priv->map_object_path_to_object_proxy = g_hash_table_new_full (g_str_hash,
                                                                           g_str_equal,
diff --git a/gio/gdbusobjectmanagerserver.c b/gio/gdbusobjectmanagerserver.c
index 4802c65..9412b0e 100644
--- a/gio/gdbusobjectmanagerserver.c
+++ b/gio/gdbusobjectmanagerserver.c
@@ -99,7 +99,8 @@ enum
 static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerServer, g_dbus_object_manager_server, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, 
dbus_object_manager_interface_init));
+                         G_ADD_PRIVATE (GDBusObjectManagerServer)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, 
dbus_object_manager_interface_init))
 
 static void g_dbus_object_manager_server_constructed (GObject *object);
 
@@ -220,16 +221,12 @@ g_dbus_object_manager_server_class_init (GDBusObjectManagerServerClass *klass)
                                                         G_PARAM_WRITABLE |
                                                         G_PARAM_CONSTRUCT_ONLY |
                                                         G_PARAM_STATIC_STRINGS));
-
-  g_type_class_add_private (klass, sizeof (GDBusObjectManagerServerPrivate));
 }
 
 static void
 g_dbus_object_manager_server_init (GDBusObjectManagerServer *manager)
 {
-  manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
-                                               G_TYPE_DBUS_OBJECT_MANAGER_SERVER,
-                                               GDBusObjectManagerServerPrivate);
+  manager->priv = g_dbus_object_manager_server_get_private (manager);
   g_mutex_init (&manager->priv->lock);
   manager->priv->map_object_path_to_data = g_hash_table_new_full (g_str_hash,
                                                                   g_str_equal,
diff --git a/gio/gdbusobjectproxy.c b/gio/gdbusobjectproxy.c
index 9f28074..5844a6b 100644
--- a/gio/gdbusobjectproxy.c
+++ b/gio/gdbusobjectproxy.c
@@ -62,7 +62,8 @@ enum
 static void dbus_object_interface_init (GDBusObjectIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GDBusObjectProxy, g_dbus_object_proxy, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init));
+                         G_ADD_PRIVATE (GDBusObjectProxy)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init))
 
 static void
 g_dbus_object_proxy_finalize (GObject *object)
@@ -177,16 +178,12 @@ g_dbus_object_proxy_class_init (GDBusObjectProxyClass *klass)
                                                         G_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY |
                                                         G_PARAM_STATIC_STRINGS));
-
-  g_type_class_add_private (klass, sizeof (GDBusObjectProxyPrivate));
 }
 
 static void
 g_dbus_object_proxy_init (GDBusObjectProxy *proxy)
 {
-  proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy,
-                                             G_TYPE_DBUS_OBJECT_PROXY,
-                                             GDBusObjectProxyPrivate);
+  proxy->priv = g_dbus_object_proxy_get_private (proxy);
   g_mutex_init (&proxy->priv->lock);
   proxy->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash,
                                                           g_str_equal,
diff --git a/gio/gdbusobjectskeleton.c b/gio/gdbusobjectskeleton.c
index 3152f8f..1553001 100644
--- a/gio/gdbusobjectskeleton.c
+++ b/gio/gdbusobjectskeleton.c
@@ -69,7 +69,8 @@ static guint signals[LAST_SIGNAL] = {0};
 static void dbus_object_interface_init (GDBusObjectIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GDBusObjectSkeleton, g_dbus_object_skeleton, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init));
+                         G_ADD_PRIVATE (GDBusObjectSkeleton)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init))
 
 
 static void
@@ -196,14 +197,12 @@ g_dbus_object_skeleton_class_init (GDBusObjectSkeletonClass *klass)
                   2,
                   G_TYPE_DBUS_INTERFACE_SKELETON,
                   G_TYPE_DBUS_METHOD_INVOCATION);
-
-  g_type_class_add_private (klass, sizeof (GDBusObjectSkeletonPrivate));
 }
 
 static void
 g_dbus_object_skeleton_init (GDBusObjectSkeleton *object)
 {
-  object->priv = G_TYPE_INSTANCE_GET_PRIVATE (object, G_TYPE_DBUS_OBJECT_SKELETON, 
GDBusObjectSkeletonPrivate);
+  object->priv = g_dbus_object_skeleton_get_private (object);
   g_mutex_init (&object->priv->lock);
   object->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash,
                                                            g_str_equal,
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index f83188e..a7ad659 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -187,10 +187,10 @@ static void initable_iface_init       (GInitableIface *initable_iface);
 static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface);
 
 G_DEFINE_TYPE_WITH_CODE (GDBusProxy, g_dbus_proxy, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GDBusProxy)
                          G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, dbus_interface_iface_init)
                          G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
-                         G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
-                         );
+                         G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init))
 
 static void
 g_dbus_proxy_dispose (GObject *object)
@@ -633,14 +633,12 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
                                          G_TYPE_STRING,
                                          G_TYPE_VARIANT);
 
-
-  g_type_class_add_private (klass, sizeof (GDBusProxyPrivate));
 }
 
 static void
 g_dbus_proxy_init (GDBusProxy *proxy)
 {
-  proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, G_TYPE_DBUS_PROXY, GDBusProxyPrivate);
+  proxy->priv = g_dbus_proxy_get_private (proxy);
   proxy->priv->signal_subscription_data = g_slice_new0 (SignalSubscriptionData);
   proxy->priv->signal_subscription_data->ref_count = 1;
   proxy->priv->signal_subscription_data->proxy = proxy;
diff --git a/gio/gdelayedsettingsbackend.c b/gio/gdelayedsettingsbackend.c
index 6f3c411..83d0262 100644
--- a/gio/gdelayedsettingsbackend.c
+++ b/gio/gdelayedsettingsbackend.c
@@ -37,9 +37,9 @@ struct _GDelayedSettingsBackendPrivate
   gpointer owner;
 };
 
-G_DEFINE_TYPE (GDelayedSettingsBackend,
-               g_delayed_settings_backend,
-               G_TYPE_SETTINGS_BACKEND)
+G_DEFINE_TYPE_WITH_PRIVATE (GDelayedSettingsBackend,
+                            g_delayed_settings_backend,
+                            G_TYPE_SETTINGS_BACKEND)
 
 static gboolean
 invoke_notify_unapplied (gpointer data)
@@ -428,8 +428,6 @@ g_delayed_settings_backend_class_init (GDelayedSettingsBackendClass *class)
   GSettingsBackendClass *backend_class = G_SETTINGS_BACKEND_CLASS (class);
   GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-  g_type_class_add_private (class, sizeof (GDelayedSettingsBackendPrivate));
-
   backend_class->read = g_delayed_settings_backend_read;
   backend_class->write = g_delayed_settings_backend_write;
   backend_class->write_tree = g_delayed_settings_backend_write_tree;
@@ -445,10 +443,7 @@ g_delayed_settings_backend_class_init (GDelayedSettingsBackendClass *class)
 static void
 g_delayed_settings_backend_init (GDelayedSettingsBackend *delayed)
 {
-  delayed->priv =
-    G_TYPE_INSTANCE_GET_PRIVATE (delayed, G_TYPE_DELAYED_SETTINGS_BACKEND,
-                                 GDelayedSettingsBackendPrivate);
-
+  delayed->priv = g_delayed_settings_backend_get_private (delayed);
   delayed->priv->delayed = g_settings_backend_create_tree ();
   g_mutex_init (&delayed->priv->lock);
 }
diff --git a/gio/gemblemedicon.c b/gio/gemblemedicon.c
index 6f977fd..9407b41 100644
--- a/gio/gemblemedicon.c
+++ b/gio/gemblemedicon.c
@@ -61,6 +61,7 @@ static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
 static void g_emblemed_icon_icon_iface_init (GIconIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GEmblemedIcon, g_emblemed_icon, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GEmblemedIcon)
                          G_IMPLEMENT_INTERFACE (G_TYPE_ICON,
                          g_emblemed_icon_icon_iface_init))
 
@@ -133,16 +134,12 @@ g_emblemed_icon_class_init (GEmblemedIconClass *klass)
                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
-
-  g_type_class_add_private (klass, sizeof (GEmblemedIconPrivate));
 }
 
 static void
 g_emblemed_icon_init (GEmblemedIcon *emblemed)
 {
-  emblemed->priv =
-    G_TYPE_INSTANCE_GET_PRIVATE (emblemed, G_TYPE_EMBLEMED_ICON,
-                                 GEmblemedIconPrivate);
+  emblemed->priv = g_emblemed_icon_get_private (emblemed);
 }
 
 /**
diff --git a/gio/gfileenumerator.c b/gio/gfileenumerator.c
index b87335c..565c4a2 100644
--- a/gio/gfileenumerator.c
+++ b/gio/gfileenumerator.c
@@ -29,6 +29,14 @@
 #include "gioerror.h"
 #include "glibintl.h"
 
+struct _GFileEnumeratorPrivate {
+  /* TODO: Should be public for subclasses? */
+  GFile *container;
+  guint closed : 1;
+  guint pending : 1;
+  GAsyncReadyCallback outstanding_callback;
+  GError *outstanding_error;
+};
 
 /**
  * SECTION:gfileenumerator
@@ -64,16 +72,7 @@
  * 
  **/ 
 
-G_DEFINE_TYPE (GFileEnumerator, g_file_enumerator, G_TYPE_OBJECT);
-
-struct _GFileEnumeratorPrivate {
-  /* TODO: Should be public for subclasses? */
-  GFile *container;
-  guint closed : 1;
-  guint pending : 1;
-  GAsyncReadyCallback outstanding_callback;
-  GError *outstanding_error;
-};
+G_DEFINE_TYPE_WITH_PRIVATE (GFileEnumerator, g_file_enumerator, G_TYPE_OBJECT)
 
 enum {
   PROP_0,
@@ -150,9 +149,7 @@ static void
 g_file_enumerator_class_init (GFileEnumeratorClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  
-  g_type_class_add_private (klass, sizeof (GFileEnumeratorPrivate));
-  
+
   gobject_class->set_property = g_file_enumerator_set_property;
   gobject_class->dispose = g_file_enumerator_dispose;
   gobject_class->finalize = g_file_enumerator_finalize;
@@ -175,9 +172,7 @@ g_file_enumerator_class_init (GFileEnumeratorClass *klass)
 static void
 g_file_enumerator_init (GFileEnumerator *enumerator)
 {
-  enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator,
-                                                 G_TYPE_FILE_ENUMERATOR,
-                                                 GFileEnumeratorPrivate);
+  enumerator->priv = g_file_enumerator_get_private (enumerator);
 }
 
 /**
diff --git a/gio/gfileinputstream.c b/gio/gfileinputstream.c
index 73e7b78..cd045d2 100644
--- a/gio/gfileinputstream.c
+++ b/gio/gfileinputstream.c
@@ -84,8 +84,6 @@ struct _GFileInputStreamPrivate {
 static void
 g_file_input_stream_class_init (GFileInputStreamClass *klass)
 {
-  g_type_class_add_private (klass, sizeof (GFileInputStreamPrivate));
-
   klass->query_info_async = g_file_input_stream_real_query_info_async;
   klass->query_info_finish = g_file_input_stream_real_query_info_finish;
 }
@@ -103,9 +101,7 @@ g_file_input_stream_seekable_iface_init (GSeekableIface *iface)
 static void
 g_file_input_stream_init (GFileInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_FILE_INPUT_STREAM,
-                                             GFileInputStreamPrivate);
+  stream->priv = g_file_input_stream_get_private (stream);
 }
 
 /**
diff --git a/gio/gfileiostream.c b/gio/gfileiostream.c
index 7eb6186..44871a1 100644
--- a/gio/gfileiostream.c
+++ b/gio/gfileiostream.c
@@ -85,14 +85,15 @@ static GFileInfo *g_file_io_stream_real_query_info_finish (GFileIOStream    *str
                                                           GAsyncResult         *result,
                                                           GError              **error);
 
-G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM,
-                        G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
-                                               g_file_io_stream_seekable_iface_init));
-
 struct _GFileIOStreamPrivate {
   GAsyncReadyCallback outstanding_callback;
 };
 
+G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM,
+                         G_ADD_PRIVATE (GFileIOStream)
+                        G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
+                                               g_file_io_stream_seekable_iface_init))
+
 static void
 g_file_io_stream_seekable_iface_init (GSeekableIface *iface)
 {
@@ -106,9 +107,7 @@ g_file_io_stream_seekable_iface_init (GSeekableIface *iface)
 static void
 g_file_io_stream_init (GFileIOStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_FILE_IO_STREAM,
-                                             GFileIOStreamPrivate);
+  stream->priv = g_file_io_stream_get_private (stream);
 }
 
 /**
@@ -654,8 +653,6 @@ g_file_io_stream_real_query_info_finish (GFileIOStream     *stream,
 static void
 g_file_io_stream_class_init (GFileIOStreamClass *klass)
 {
-  g_type_class_add_private (klass, sizeof (GFileIOStreamPrivate));
-
   klass->tell = g_file_io_stream_real_tell;
   klass->can_seek = g_file_io_stream_real_can_seek;
   klass->seek = g_file_io_stream_real_seek;
diff --git a/gio/gfilemonitor.c b/gio/gfilemonitor.c
index 55d4d6f..cb4c805 100644
--- a/gio/gfilemonitor.c
+++ b/gio/gfilemonitor.c
@@ -62,11 +62,6 @@ enum {
   LAST_SIGNAL
 };
 
-/* work around a limitation of the aliasing foo */
-#undef g_file_monitor
-
-G_DEFINE_ABSTRACT_TYPE (GFileMonitor, g_file_monitor, G_TYPE_OBJECT);
-
 typedef struct {
   GFile *file;
   guint32 last_sent_change_time; /* 0 == not sent */
@@ -97,6 +92,11 @@ enum {
   PROP_CANCELLED
 };
 
+/* work around a limitation of the aliasing foo */
+#undef g_file_monitor
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFileMonitor, g_file_monitor, G_TYPE_OBJECT)
+
 static void
 g_file_monitor_set_property (GObject      *object,
                              guint         prop_id,
@@ -210,9 +210,7 @@ static void
 g_file_monitor_class_init (GFileMonitorClass *klass)
 {
   GObjectClass *object_class;
-  
-  g_type_class_add_private (klass, sizeof (GFileMonitorPrivate));
-  
+
   object_class = G_OBJECT_CLASS (klass);
   object_class->finalize = g_file_monitor_finalize;
   object_class->dispose = g_file_monitor_dispose;
@@ -267,9 +265,7 @@ g_file_monitor_class_init (GFileMonitorClass *klass)
 static void
 g_file_monitor_init (GFileMonitor *monitor)
 {
-  monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor,
-                                              G_TYPE_FILE_MONITOR,
-                                              GFileMonitorPrivate);
+  monitor->priv = g_file_monitor_get_private (monitor);
   monitor->priv->rate_limit_msec = DEFAULT_RATE_LIMIT_MSECS;
   monitor->priv->rate_limiter = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal,
                                                       NULL, (GDestroyNotify) rate_limiter_free);
diff --git a/gio/gfileoutputstream.c b/gio/gfileoutputstream.c
index 7b77ba5..28bae4e 100644
--- a/gio/gfileoutputstream.c
+++ b/gio/gfileoutputstream.c
@@ -77,19 +77,18 @@ static GFileInfo *g_file_output_stream_real_query_info_finish (GFileOutputStream
                                                               GAsyncResult         *result,
                                                               GError              **error);
 
-G_DEFINE_TYPE_WITH_CODE (GFileOutputStream, g_file_output_stream, G_TYPE_OUTPUT_STREAM,
-                        G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
-                                               g_file_output_stream_seekable_iface_init));
-
 struct _GFileOutputStreamPrivate {
   GAsyncReadyCallback outstanding_callback;
 };
 
+G_DEFINE_TYPE_WITH_CODE (GFileOutputStream, g_file_output_stream, G_TYPE_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GFileOutputStream)
+                        G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
+                                               g_file_output_stream_seekable_iface_init));
+
 static void
 g_file_output_stream_class_init (GFileOutputStreamClass *klass)
 {
-  g_type_class_add_private (klass, sizeof (GFileOutputStreamPrivate));
-
   klass->query_info_async = g_file_output_stream_real_query_info_async;
   klass->query_info_finish = g_file_output_stream_real_query_info_finish;
 }
@@ -107,9 +106,7 @@ g_file_output_stream_seekable_iface_init (GSeekableIface *iface)
 static void
 g_file_output_stream_init (GFileOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_FILE_OUTPUT_STREAM,
-                                             GFileOutputStreamPrivate);
+  stream->priv = g_file_output_stream_get_private (stream);
 }
 
 /**
diff --git a/gio/gfilterinputstream.c b/gio/gfilterinputstream.c
index 890fb6e..2839b24 100644
--- a/gio/gfilterinputstream.c
+++ b/gio/gfilterinputstream.c
@@ -68,16 +68,13 @@ static gboolean g_filter_input_stream_close        (GInputStream         *stream
                                                     GCancellable         *cancellable,
                                                     GError              **error);
 
-G_DEFINE_ABSTRACT_TYPE (GFilterInputStream, g_filter_input_stream, G_TYPE_INPUT_STREAM)
-
-#define GET_PRIVATE(inst) G_TYPE_INSTANCE_GET_PRIVATE (inst, \
-  G_TYPE_FILTER_INPUT_STREAM, GFilterInputStreamPrivate)
-
 typedef struct
 {
   gboolean close_base;
 } GFilterInputStreamPrivate;
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFilterInputStream, g_filter_input_stream, G_TYPE_INPUT_STREAM)
+
 static void
 g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
 {
@@ -94,8 +91,6 @@ g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
   istream_class->skip  = g_filter_input_stream_skip;
   istream_class->close_fn = g_filter_input_stream_close;
 
-  g_type_class_add_private (klass, sizeof (GFilterInputStreamPrivate));
-
   g_object_class_install_property (object_class,
                                    PROP_BASE_STREAM,
                                    g_param_spec_object ("base-stream",
@@ -151,8 +146,10 @@ g_filter_input_stream_get_property (GObject    *object,
                                     GParamSpec *pspec)
 {
   GFilterInputStream *filter_stream;
+  GFilterInputStreamPrivate *priv;
 
   filter_stream = G_FILTER_INPUT_STREAM (object);
+  priv = g_filter_input_stream_get_private (filter_stream);
 
   switch (prop_id)
     {
@@ -161,7 +158,7 @@ g_filter_input_stream_get_property (GObject    *object,
       break;
 
     case PROP_CLOSE_BASE:
-      g_value_set_boolean (value, GET_PRIVATE (filter_stream)->close_base);
+      g_value_set_boolean (value, priv->close_base);
       break;
 
     default:
@@ -186,7 +183,6 @@ g_filter_input_stream_finalize (GObject *object)
 static void
 g_filter_input_stream_init (GFilterInputStream *stream)
 {
-
 }
 
 /**
@@ -217,9 +213,13 @@ g_filter_input_stream_get_base_stream (GFilterInputStream *stream)
 gboolean
 g_filter_input_stream_get_close_base_stream (GFilterInputStream *stream)
 {
+  GFilterInputStreamPrivate *priv;
+
   g_return_val_if_fail (G_IS_FILTER_INPUT_STREAM (stream), FALSE);
 
-  return GET_PRIVATE (stream)->close_base;
+  priv = g_filter_input_stream_get_private (stream);
+
+  return priv->close_base;
 }
 
 /**
@@ -239,7 +239,7 @@ g_filter_input_stream_set_close_base_stream (GFilterInputStream *stream,
 
   close_base = !!close_base;
  
-  priv = GET_PRIVATE (stream);
+  priv = g_filter_input_stream_get_private (stream);
 
   if (priv->close_base != close_base)
     {
@@ -296,17 +296,13 @@ g_filter_input_stream_close (GInputStream  *stream,
                              GCancellable  *cancellable,
                              GError       **error)
 {
+  GFilterInputStream *filter_stream = G_FILTER_INPUT_STREAM (stream);
+  GFilterInputStreamPrivate *priv = g_filter_input_stream_get_private (filter_stream);
   gboolean res = TRUE;
 
-  if (GET_PRIVATE (stream)->close_base)
+  if (priv->close_base)
     {
-      GFilterInputStream *filter_stream;
-      GInputStream       *base_stream;
-
-      filter_stream = G_FILTER_INPUT_STREAM (stream);
-      base_stream = filter_stream->base_stream;
-
-      res = g_input_stream_close (base_stream,
+      res = g_input_stream_close (filter_stream->base_stream,
                                   cancellable,
                                   error);
     }
diff --git a/gio/gfilteroutputstream.c b/gio/gfilteroutputstream.c
index 6f32ce9..d5fa642 100644
--- a/gio/gfilteroutputstream.c
+++ b/gio/gfilteroutputstream.c
@@ -67,16 +67,13 @@ static gboolean g_filter_output_stream_close        (GOutputStream  *stream,
                                                      GCancellable   *cancellable,
                                                      GError        **error);
 
-G_DEFINE_ABSTRACT_TYPE (GFilterOutputStream, g_filter_output_stream, G_TYPE_OUTPUT_STREAM)
-
-#define GET_PRIVATE(inst) G_TYPE_INSTANCE_GET_PRIVATE (inst, \
-  G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStreamPrivate)
-
 typedef struct
 {
   gboolean close_base;
 } GFilterOutputStreamPrivate;
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFilterOutputStream, g_filter_output_stream, G_TYPE_OUTPUT_STREAM)
+
 static void
 g_filter_output_stream_class_init (GFilterOutputStreamClass *klass)
 {
@@ -93,8 +90,6 @@ g_filter_output_stream_class_init (GFilterOutputStreamClass *klass)
   ostream_class->flush = g_filter_output_stream_flush;
   ostream_class->close_fn = g_filter_output_stream_close;
 
-  g_type_class_add_private (klass, sizeof (GFilterOutputStreamPrivate));
-
   g_object_class_install_property (object_class,
                                    PROP_BASE_STREAM,
                                    g_param_spec_object ("base-stream",
@@ -150,8 +145,10 @@ g_filter_output_stream_get_property (GObject    *object,
                                      GParamSpec *pspec)
 {
   GFilterOutputStream *filter_stream;
+  GFilterOutputStreamPrivate *priv;
 
   filter_stream = G_FILTER_OUTPUT_STREAM (object);
+  priv = g_filter_output_stream_get_private (filter_stream);
 
   switch (prop_id)
     {
@@ -160,7 +157,7 @@ g_filter_output_stream_get_property (GObject    *object,
       break;
 
     case PROP_CLOSE_BASE:
-      g_value_set_boolean (value, GET_PRIVATE (filter_stream)->close_base);
+      g_value_set_boolean (value, priv->close_base);
       break;
 
     default:
@@ -220,9 +217,13 @@ g_filter_output_stream_get_base_stream (GFilterOutputStream *stream)
 gboolean
 g_filter_output_stream_get_close_base_stream (GFilterOutputStream *stream)
 {
+  GFilterOutputStreamPrivate *priv;
+
   g_return_val_if_fail (G_IS_FILTER_OUTPUT_STREAM (stream), FALSE);
 
-  return GET_PRIVATE (stream)->close_base;
+  priv = g_filter_output_stream_get_private (stream);
+
+  return priv->close_base;
 }
 
 /**
@@ -242,7 +243,7 @@ g_filter_output_stream_set_close_base_stream (GFilterOutputStream *stream,
 
   close_base = !!close_base;
 
-  priv = GET_PRIVATE (stream);
+  priv = g_filter_output_stream_get_private (stream);
 
   if (priv->close_base != close_base)
     {
@@ -294,14 +295,12 @@ g_filter_output_stream_close (GOutputStream  *stream,
                               GCancellable   *cancellable,
                               GError        **error)
 {
+  GFilterOutputStream *filter_stream = G_FILTER_OUTPUT_STREAM (stream);
+  GFilterOutputStreamPrivate *priv = g_filter_output_stream_get_private (filter_stream);
   gboolean res = TRUE;
 
-  if (GET_PRIVATE (stream)->close_base)
+  if (priv->close_base)
     {
-      GFilterOutputStream *filter_stream;
-
-      filter_stream = G_FILTER_OUTPUT_STREAM (stream);
-
       res = g_output_stream_close (filter_stream->base_stream,
                                    cancellable,
                                    error);
diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
index e5357c8..24eb1c2 100644
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -33,6 +33,14 @@
 #include "glibintl.h"
 #include "gnetworkingprivate.h"
 
+struct _GInetAddressPrivate
+{
+  GSocketFamily family;
+  union {
+    struct in_addr ipv4;
+    struct in6_addr ipv6;
+  } addr;
+};
 
 /**
  * SECTION:ginetaddress
@@ -57,17 +65,9 @@
  */
 
 G_DEFINE_TYPE_WITH_CODE (GInetAddress, g_inet_address, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GInetAddress)
                         g_networking_init ();)
 
-struct _GInetAddressPrivate
-{
-  GSocketFamily family;
-  union {
-    struct in_addr ipv4;
-    struct in6_addr ipv6;
-  } addr;
-};
-
 enum
 {
   PROP_0,
@@ -181,8 +181,6 @@ g_inet_address_class_init (GInetAddressClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GInetAddressPrivate));
-
   gobject_class->set_property = g_inet_address_set_property;
   gobject_class->get_property = g_inet_address_get_property;
 
@@ -369,9 +367,7 @@ g_inet_address_class_init (GInetAddressClass *klass)
 static void
 g_inet_address_init (GInetAddress *address)
 {
-  address->priv = G_TYPE_INSTANCE_GET_PRIVATE (address,
-                                               G_TYPE_INET_ADDRESS,
-                                               GInetAddressPrivate);
+  address->priv = g_inet_address_get_private (address);
 }
 
 /**
diff --git a/gio/ginetaddressmask.c b/gio/ginetaddressmask.c
index 560f47c..0e2404d 100644
--- a/gio/ginetaddressmask.c
+++ b/gio/ginetaddressmask.c
@@ -49,18 +49,19 @@
  * Since: 2.32
  */
 
-static void     g_inet_address_mask_initable_iface_init (GInitableIface  *iface);
-
-G_DEFINE_TYPE_WITH_CODE (GInetAddressMask, g_inet_address_mask, G_TYPE_OBJECT,
-                        G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
-                                               g_inet_address_mask_initable_iface_init));
-
 struct _GInetAddressMaskPrivate
 {
   GInetAddress *addr;
   guint         length;
 };
 
+static void     g_inet_address_mask_initable_iface_init (GInitableIface  *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GInetAddressMask, g_inet_address_mask, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GInetAddressMask)
+                        G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+                                               g_inet_address_mask_initable_iface_init))
+
 enum
 {
   PROP_0,
@@ -138,8 +139,6 @@ g_inet_address_mask_class_init (GInetAddressMaskClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GInetAddressMaskPrivate));
-
   gobject_class->set_property = g_inet_address_mask_set_property;
   gobject_class->get_property = g_inet_address_mask_get_property;
   gobject_class->dispose = g_inet_address_mask_dispose;
@@ -238,9 +237,7 @@ g_inet_address_mask_initable_iface_init (GInitableIface  *iface)
 static void
 g_inet_address_mask_init (GInetAddressMask *mask)
 {
-  mask->priv = G_TYPE_INSTANCE_GET_PRIVATE (mask,
-                                           G_TYPE_INET_ADDRESS_MASK,
-                                           GInetAddressMaskPrivate);
+  mask->priv = g_inet_address_mask_get_private (mask);
 }
 
 /**
diff --git a/gio/ginetsocketaddress.c b/gio/ginetsocketaddress.c
index 9b45aa2..1a46212 100644
--- a/gio/ginetsocketaddress.c
+++ b/gio/ginetsocketaddress.c
@@ -46,15 +46,6 @@
  * An IPv4 or IPv6 socket address, corresponding to a <type>struct
  * sockaddr_in</type> or <type>struct sockaddr_in6</type>.
  */
-G_DEFINE_TYPE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS);
-
-enum {
-  PROP_0,
-  PROP_ADDRESS,
-  PROP_PORT,
-  PROP_FLOWINFO,
-  PROP_SCOPE_ID
-};
 
 struct _GInetSocketAddressPrivate
 {
@@ -64,24 +55,24 @@ struct _GInetSocketAddressPrivate
   guint32       scope_id;
 };
 
-static void
-g_inet_socket_address_finalize (GObject *object)
-{
-  GInetSocketAddress *address G_GNUC_UNUSED = G_INET_SOCKET_ADDRESS (object);
+G_DEFINE_TYPE_WITH_PRIVATE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS)
 
-  if (G_OBJECT_CLASS (g_inet_socket_address_parent_class)->finalize)
-    (*G_OBJECT_CLASS (g_inet_socket_address_parent_class)->finalize) (object);
-}
+enum {
+  PROP_0,
+  PROP_ADDRESS,
+  PROP_PORT,
+  PROP_FLOWINFO,
+  PROP_SCOPE_ID
+};
 
 static void
 g_inet_socket_address_dispose (GObject *object)
 {
-  GInetSocketAddress *address G_GNUC_UNUSED = G_INET_SOCKET_ADDRESS (object);
+  GInetSocketAddress *address = G_INET_SOCKET_ADDRESS (object);
 
-  g_object_unref (address->priv->address);
+  g_clear_object (&(address->priv->address));
 
-  if (G_OBJECT_CLASS (g_inet_socket_address_parent_class)->dispose)
-    (*G_OBJECT_CLASS (g_inet_socket_address_parent_class)->dispose) (object);
+  G_OBJECT_CLASS (g_inet_socket_address_parent_class)->dispose (object);
 }
 
 static void
@@ -246,9 +237,6 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GSocketAddressClass *gsocketaddress_class = G_SOCKET_ADDRESS_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GInetSocketAddressPrivate));
-
-  gobject_class->finalize = g_inet_socket_address_finalize;
   gobject_class->dispose = g_inet_socket_address_dispose;
   gobject_class->set_property = g_inet_socket_address_set_property;
   gobject_class->get_property = g_inet_socket_address_get_property;
@@ -317,9 +305,7 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass)
 static void
 g_inet_socket_address_init (GInetSocketAddress *address)
 {
-  address->priv = G_TYPE_INSTANCE_GET_PRIVATE (address,
-                                               G_TYPE_INET_SOCKET_ADDRESS,
-                                               GInetSocketAddressPrivate);
+  address->priv = g_inet_socket_address_get_private (address);
 }
 
 /**
diff --git a/gio/ginputstream.c b/gio/ginputstream.c
index 5fbf025..3789f07 100644
--- a/gio/ginputstream.c
+++ b/gio/ginputstream.c
@@ -46,14 +46,14 @@
  * All of these functions have async variants too.
  **/
 
-G_DEFINE_ABSTRACT_TYPE (GInputStream, g_input_stream, G_TYPE_OBJECT);
-
 struct _GInputStreamPrivate {
   guint closed : 1;
   guint pending : 1;
   GAsyncReadyCallback outstanding_callback;
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GInputStream, g_input_stream, G_TYPE_OBJECT)
+
 static gssize   g_input_stream_real_skip         (GInputStream         *stream,
                                                  gsize                 count,
                                                  GCancellable         *cancellable,
@@ -87,12 +87,6 @@ static gboolean g_input_stream_real_close_finish (GInputStream         *stream,
                                                  GError              **error);
 
 static void
-g_input_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_input_stream_parent_class)->finalize (object);
-}
-
-static void
 g_input_stream_dispose (GObject *object)
 {
   GInputStream *stream;
@@ -111,9 +105,6 @@ g_input_stream_class_init (GInputStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   
-  g_type_class_add_private (klass, sizeof (GInputStreamPrivate));
-  
-  gobject_class->finalize = g_input_stream_finalize;
   gobject_class->dispose = g_input_stream_dispose;
   
   klass->skip = g_input_stream_real_skip;
@@ -128,9 +119,7 @@ g_input_stream_class_init (GInputStreamClass *klass)
 static void
 g_input_stream_init (GInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_INPUT_STREAM,
-                                             GInputStreamPrivate);
+  stream->priv = g_input_stream_get_private (stream);
 }
 
 /**
diff --git a/gio/giostream.c b/gio/giostream.c
index 49bca9b..4a535d9 100644
--- a/gio/giostream.c
+++ b/gio/giostream.c
@@ -30,8 +30,6 @@
 #include "gasyncresult.h"
 #include "gtask.h"
 
-G_DEFINE_ABSTRACT_TYPE (GIOStream, g_io_stream, G_TYPE_OBJECT);
-
 /**
  * SECTION:giostream
  * @short_description: Base class for implementing read/write streams
@@ -92,11 +90,7 @@ static gboolean g_io_stream_real_close_finish (GIOStream            *stream,
                                               GAsyncResult         *result,
                                               GError              **error);
 
-static void
-g_io_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_io_stream_parent_class)->finalize (object);
-}
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GIOStream, g_io_stream, G_TYPE_OBJECT)
 
 static void
 g_io_stream_dispose (GObject *object)
@@ -114,9 +108,7 @@ g_io_stream_dispose (GObject *object)
 static void
 g_io_stream_init (GIOStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_IO_STREAM,
-                                             GIOStreamPrivate);
+  stream->priv = g_io_stream_get_private (stream);
 }
 
 static void
@@ -151,9 +143,6 @@ g_io_stream_class_init (GIOStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GIOStreamPrivate));
-
-  gobject_class->finalize = g_io_stream_finalize;
   gobject_class->dispose = g_io_stream_dispose;
   gobject_class->get_property = g_io_stream_get_property;
 
diff --git a/gio/glocalfileinputstream.c b/gio/glocalfileinputstream.c
index bb05bb6..b96c079 100644
--- a/gio/glocalfileinputstream.c
+++ b/gio/glocalfileinputstream.c
@@ -47,7 +47,10 @@
 #include <io.h>
 #endif
 
-
+struct _GLocalFileInputStreamPrivate {
+  int fd;
+  guint do_close : 1;
+};
 
 #ifdef G_OS_UNIX
 static void       g_file_descriptor_based_iface_init   (GFileDescriptorBasedIface *iface);
@@ -56,18 +59,14 @@ static void       g_file_descriptor_based_iface_init   (GFileDescriptorBasedIfac
 #define g_local_file_input_stream_get_type _g_local_file_input_stream_get_type
 #ifdef G_OS_UNIX
 G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,
+                         G_ADD_PRIVATE (GLocalFileInputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
-                                               g_file_descriptor_based_iface_init)
-);
+                                               g_file_descriptor_based_iface_init))
 #else
-G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,);
+G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,
+                         G_ADD_PRIVATE (GLocalFileInputStream))
 #endif
 
-struct _GLocalFileInputStreamPrivate {
-  int fd;
-  guint do_close : 1;
-};
-
 static gssize     g_local_file_input_stream_read       (GInputStream      *stream,
                                                        void              *buffer,
                                                        gsize              count,
@@ -95,12 +94,6 @@ static GFileInfo *g_local_file_input_stream_query_info (GFileInputStream  *strea
 static int        g_local_file_input_stream_get_fd     (GFileDescriptorBased *stream);
 #endif
 
-static void
-g_local_file_input_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_local_file_input_stream_parent_class)->finalize (object);
-}
-
 void
 _g_local_file_input_stream_set_do_close (GLocalFileInputStream *in,
                                          gboolean do_close)
@@ -111,13 +104,8 @@ _g_local_file_input_stream_set_do_close (GLocalFileInputStream *in,
 static void
 g_local_file_input_stream_class_init (GLocalFileInputStreamClass *klass)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
   GFileInputStreamClass *file_stream_class = G_FILE_INPUT_STREAM_CLASS (klass);
-  
-  g_type_class_add_private (klass, sizeof (GLocalFileInputStreamPrivate));
-  
-  gobject_class->finalize = g_local_file_input_stream_finalize;
 
   stream_class->read_fn = g_local_file_input_stream_read;
   stream_class->skip = g_local_file_input_stream_skip;
@@ -139,9 +127,7 @@ g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface)
 static void
 g_local_file_input_stream_init (GLocalFileInputStream *info)
 {
-  info->priv = G_TYPE_INSTANCE_GET_PRIVATE (info,
-                                           G_TYPE_LOCAL_FILE_INPUT_STREAM,
-                                           GLocalFileInputStreamPrivate);
+  info->priv = g_local_file_input_stream_get_private (info);
   info->priv->do_close = TRUE;
 }
 
diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
index ccee49d..ec8b9b1 100644
--- a/gio/glocalfileoutputstream.c
+++ b/gio/glocalfileoutputstream.c
@@ -58,6 +58,15 @@
 #define O_BINARY 0
 #endif
 
+struct _GLocalFileOutputStreamPrivate {
+  char *tmp_filename;
+  char *original_filename;
+  char *backup_filename;
+  char *etag;
+  guint sync_on_close : 1;
+  guint do_close : 1;
+  int fd;
+};
 
 #ifdef G_OS_UNIX
 static void       g_file_descriptor_based_iface_init   (GFileDescriptorBasedIface *iface);
@@ -66,11 +75,12 @@ static void       g_file_descriptor_based_iface_init   (GFileDescriptorBasedIfac
 #define g_local_file_output_stream_get_type _g_local_file_output_stream_get_type
 #ifdef G_OS_UNIX
 G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GLocalFileOutputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
-                                               g_file_descriptor_based_iface_init)
-                           );
+                                               g_file_descriptor_based_iface_init))
 #else
-G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,);
+G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GLocalFileOutputStream))
 #endif
 
 
@@ -80,16 +90,6 @@ G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_T
 
 #define BACKUP_EXTENSION "~"
 
-struct _GLocalFileOutputStreamPrivate {
-  char *tmp_filename;
-  char *original_filename;
-  char *backup_filename;
-  char *etag;
-  guint sync_on_close : 1;
-  guint do_close : 1;
-  int fd;
-};
-
 static gssize     g_local_file_output_stream_write        (GOutputStream      *stream,
                                                           const void         *buffer,
                                                           gsize               count,
@@ -134,16 +134,13 @@ g_local_file_output_stream_finalize (GObject *object)
   G_OBJECT_CLASS (g_local_file_output_stream_parent_class)->finalize (object);
 }
 
-
 static void
 g_local_file_output_stream_class_init (GLocalFileOutputStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
   GFileOutputStreamClass *file_stream_class = G_FILE_OUTPUT_STREAM_CLASS (klass);
-  
-  g_type_class_add_private (klass, sizeof (GLocalFileOutputStreamPrivate));
-  
+
   gobject_class->finalize = g_local_file_output_stream_finalize;
 
   stream_class->write_fn = g_local_file_output_stream_write;
@@ -168,9 +165,7 @@ g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface)
 static void
 g_local_file_output_stream_init (GLocalFileOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_LOCAL_FILE_OUTPUT_STREAM,
-                                             GLocalFileOutputStreamPrivate);
+  stream->priv = g_local_file_output_stream_get_private (stream);
   stream->priv->do_close = TRUE;
 }
 
diff --git a/gio/gmemoryinputstream.c b/gio/gmemoryinputstream.c
index a4feb99..1227a28 100644
--- a/gio/gmemoryinputstream.c
+++ b/gio/gmemoryinputstream.c
@@ -102,6 +102,7 @@ static GSource *g_memory_input_stream_create_source       (GPollableInputStream
 static void     g_memory_input_stream_finalize            (GObject         *object);
 
 G_DEFINE_TYPE_WITH_CODE (GMemoryInputStream, g_memory_input_stream, G_TYPE_INPUT_STREAM,
+                         G_ADD_PRIVATE (GMemoryInputStream)
                          G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
                                                 g_memory_input_stream_seekable_iface_init);
                          G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
@@ -115,8 +116,6 @@ g_memory_input_stream_class_init (GMemoryInputStreamClass *klass)
   GObjectClass *object_class;
   GInputStreamClass *istream_class;
 
-  g_type_class_add_private (klass, sizeof (GMemoryInputStreamPrivate));
-
   object_class = G_OBJECT_CLASS (klass);
   object_class->finalize     = g_memory_input_stream_finalize;
   
@@ -165,9 +164,7 @@ g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface)
 static void
 g_memory_input_stream_init (GMemoryInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                              G_TYPE_MEMORY_INPUT_STREAM,
-                                              GMemoryInputStreamPrivate);
+  stream->priv = g_memory_input_stream_get_private (stream);
 }
 
 /**
diff --git a/gio/gmemoryoutputstream.c b/gio/gmemoryoutputstream.c
index 6576bdc..07d7db2 100644
--- a/gio/gmemoryoutputstream.c
+++ b/gio/gmemoryoutputstream.c
@@ -119,6 +119,7 @@ static GSource *g_memory_output_stream_create_source     (GPollableOutputStream
 static void g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GMemoryOutputStream, g_memory_output_stream, G_TYPE_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GMemoryOutputStream)
                          G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
                                                 g_memory_output_stream_seekable_iface_init);
                          G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM,
@@ -131,8 +132,6 @@ g_memory_output_stream_class_init (GMemoryOutputStreamClass *klass)
   GOutputStreamClass *ostream_class;
   GObjectClass *gobject_class;
 
-  g_type_class_add_private (klass, sizeof (GMemoryOutputStreamPrivate));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->set_property = g_memory_output_stream_set_property;
   gobject_class->get_property = g_memory_output_stream_get_property;
@@ -326,9 +325,7 @@ g_memory_output_stream_seekable_iface_init (GSeekableIface *iface)
 static void
 g_memory_output_stream_init (GMemoryOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                              G_TYPE_MEMORY_OUTPUT_STREAM,
-                                              GMemoryOutputStreamPrivate);
+  stream->priv = g_memory_output_stream_get_private (stream);
   stream->priv->pos = 0;
   stream->priv->valid_len = 0;
 }
diff --git a/gio/gmenumodel.c b/gio/gmenumodel.c
index 17cab30..1affa6d 100644
--- a/gio/gmenumodel.c
+++ b/gio/gmenumodel.c
@@ -706,8 +706,6 @@ g_menu_model_items_changed (GMenuModel *model,
   g_signal_emit (model, g_menu_model_items_changed_signal, 0, position, removed, added);
 }
 
-G_DEFINE_ABSTRACT_TYPE (GMenuAttributeIter, g_menu_attribute_iter, G_TYPE_OBJECT)
-
 struct _GMenuAttributeIterPrivate
 {
   GQuark name;
@@ -715,6 +713,8 @@ struct _GMenuAttributeIterPrivate
   gboolean valid;
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GMenuAttributeIter, g_menu_attribute_iter, G_TYPE_OBJECT)
+
 /**
  * g_menu_attribute_iter_get_next:
  * @iter: a #GMenuAttributeIter
@@ -851,7 +851,7 @@ g_menu_attribute_iter_finalize (GObject *object)
 static void
 g_menu_attribute_iter_init (GMenuAttributeIter *iter)
 {
-  iter->priv = G_TYPE_INSTANCE_GET_PRIVATE (iter, G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterPrivate);
+  iter->priv = g_menu_attribute_iter_get_private (iter);
 }
 
 static void
@@ -860,12 +860,8 @@ g_menu_attribute_iter_class_init (GMenuAttributeIterClass *class)
   GObjectClass *object_class = G_OBJECT_CLASS (class);
 
   object_class->finalize = g_menu_attribute_iter_finalize;
-
-  g_type_class_add_private (class, sizeof (GMenuAttributeIterPrivate));
 }
 
-G_DEFINE_ABSTRACT_TYPE (GMenuLinkIter, g_menu_link_iter, G_TYPE_OBJECT)
-
 struct _GMenuLinkIterPrivate
 {
   GQuark name;
@@ -873,6 +869,8 @@ struct _GMenuLinkIterPrivate
   gboolean valid;
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GMenuLinkIter, g_menu_link_iter, G_TYPE_OBJECT)
+
 /**
  * g_menu_link_iter_get_next:
  * @iter: a #GMenuLinkIter
@@ -1007,7 +1005,7 @@ g_menu_link_iter_finalize (GObject *object)
 static void
 g_menu_link_iter_init (GMenuLinkIter *iter)
 {
-  iter->priv = G_TYPE_INSTANCE_GET_PRIVATE (iter, G_TYPE_MENU_LINK_ITER, GMenuLinkIterPrivate);
+  iter->priv = g_menu_link_iter_get_private (iter);
 }
 
 static void
@@ -1016,6 +1014,4 @@ g_menu_link_iter_class_init (GMenuLinkIterClass *class)
   GObjectClass *object_class = G_OBJECT_CLASS (class);
 
   object_class->finalize = g_menu_link_iter_finalize;
-
-  g_type_class_add_private (class, sizeof (GMenuLinkIterPrivate));
 }
diff --git a/gio/gmountoperation.c b/gio/gmountoperation.c
index ec7f5ff..6829bf2 100644
--- a/gio/gmountoperation.c
+++ b/gio/gmountoperation.c
@@ -51,8 +51,6 @@
  * passed, see each method taking a #GMountOperation for details.
  */
 
-G_DEFINE_TYPE (GMountOperation, g_mount_operation, G_TYPE_OBJECT);
-
 enum {
   ASK_PASSWORD,
   ASK_QUESTION,
@@ -84,6 +82,8 @@ enum {
   PROP_CHOICE
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GMountOperation, g_mount_operation, G_TYPE_OBJECT)
+
 static void 
 g_mount_operation_set_property (GObject      *object,
                                 guint         prop_id,
@@ -253,8 +253,6 @@ static void
 g_mount_operation_class_init (GMountOperationClass *klass)
 {
   GObjectClass *object_class;
-  
-  g_type_class_add_private (klass, sizeof (GMountOperationPrivate));
  
   object_class = G_OBJECT_CLASS (klass);
   object_class->finalize = g_mount_operation_finalize;
@@ -513,9 +511,7 @@ g_mount_operation_class_init (GMountOperationClass *klass)
 static void
 g_mount_operation_init (GMountOperation *operation)
 {
-  operation->priv = G_TYPE_INSTANCE_GET_PRIVATE (operation,
-                                                G_TYPE_MOUNT_OPERATION,
-                                                GMountOperationPrivate);
+  operation->priv = g_mount_operation_get_private (operation);
 }
 
 /**
diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c
index 2e4042c..2eca2fd 100644
--- a/gio/gnetworkaddress.c
+++ b/gio/gnetworkaddress.c
@@ -90,6 +90,7 @@ static GSocketAddressEnumerator *g_network_address_connectable_enumerate
 static GSocketAddressEnumerator        *g_network_address_connectable_proxy_enumerate  (GSocketConnectable   
   *connectable);
 
 G_DEFINE_TYPE_WITH_CODE (GNetworkAddress, g_network_address, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GNetworkAddress)
                          G_IMPLEMENT_INTERFACE (G_TYPE_SOCKET_CONNECTABLE,
                                                 g_network_address_connectable_iface_init))
 
@@ -118,8 +119,6 @@ g_network_address_class_init (GNetworkAddressClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GNetworkAddressPrivate));
-
   gobject_class->set_property = g_network_address_set_property;
   gobject_class->get_property = g_network_address_get_property;
   gobject_class->finalize = g_network_address_finalize;
@@ -161,8 +160,7 @@ g_network_address_connectable_iface_init (GSocketConnectableIface *connectable_i
 static void
 g_network_address_init (GNetworkAddress *addr)
 {
-  addr->priv = G_TYPE_INSTANCE_GET_PRIVATE (addr, G_TYPE_NETWORK_ADDRESS,
-                                            GNetworkAddressPrivate);
+  addr->priv = g_network_address_get_private (addr);
 }
 
 static void
diff --git a/gio/gnetworkmonitorbase.c b/gio/gnetworkmonitorbase.c
index f363e02..7e8b010 100644
--- a/gio/gnetworkmonitorbase.c
+++ b/gio/gnetworkmonitorbase.c
@@ -36,17 +36,6 @@
 static void g_network_monitor_base_iface_init (GNetworkMonitorInterface *iface);
 static void g_network_monitor_base_initable_iface_init (GInitableIface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorBase, g_network_monitor_base, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
-                                                g_network_monitor_base_initable_iface_init)
-                         G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
-                                                g_network_monitor_base_iface_init)
-                         _g_io_modules_ensure_extension_points_registered ();
-                         g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
-                                                         g_define_type_id,
-                                                         "base",
-                                                         0))
-
 enum
 {
   PROP_0,
@@ -70,13 +59,22 @@ static guint network_changed_signal = 0;
 
 static void queue_network_changed (GNetworkMonitorBase *monitor);
 
+G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorBase, g_network_monitor_base, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GNetworkMonitorBase)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+                                                g_network_monitor_base_initable_iface_init)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
+                                                g_network_monitor_base_iface_init)
+                         _g_io_modules_ensure_extension_points_registered ();
+                         g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
+                                                         g_define_type_id,
+                                                         "base",
+                                                         0))
+
 static void
 g_network_monitor_base_init (GNetworkMonitorBase *monitor)
 {
-  monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor,
-                                               G_TYPE_NETWORK_MONITOR_BASE,
-                                               GNetworkMonitorBasePrivate);
-
+  monitor->priv = g_network_monitor_base_get_private (monitor);
   monitor->priv->networks = g_ptr_array_new_with_free_func (g_object_unref);
   monitor->priv->context = g_main_context_get_thread_default ();
   if (monitor->priv->context)
@@ -150,8 +148,6 @@ g_network_monitor_base_class_init (GNetworkMonitorBaseClass *monitor_class)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (monitor_class);
 
-  g_type_class_add_private (monitor_class, sizeof (GNetworkMonitorBasePrivate));
-
   gobject_class->constructed  = g_network_monitor_base_constructed;
   gobject_class->get_property = g_network_monitor_base_get_property;
   gobject_class->finalize     = g_network_monitor_base_finalize;
diff --git a/gio/gnetworkmonitornetlink.c b/gio/gnetworkmonitornetlink.c
index 17df1da..0b0a9d3 100644
--- a/gio/gnetworkmonitornetlink.c
+++ b/gio/gnetworkmonitornetlink.c
@@ -43,18 +43,6 @@
 static void g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *iface);
 static void g_network_monitor_netlink_initable_iface_init (GInitableIface *iface);
 
-#define g_network_monitor_netlink_get_type _g_network_monitor_netlink_get_type
-G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorNetlink, g_network_monitor_netlink, G_TYPE_NETWORK_MONITOR_BASE,
-                         G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
-                                                g_network_monitor_netlink_iface_init)
-                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
-                                                g_network_monitor_netlink_initable_iface_init)
-                         _g_io_modules_ensure_extension_points_registered ();
-                         g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
-                                                         g_define_type_id,
-                                                         "netlink",
-                                                         20))
-
 struct _GNetworkMonitorNetlinkPrivate
 {
   GSocket *sock;
@@ -69,12 +57,23 @@ static gboolean read_netlink_messages (GSocket             *socket,
 static gboolean request_dump (GNetworkMonitorNetlink  *nl,
                               GError                 **error);
 
+#define g_network_monitor_netlink_get_type _g_network_monitor_netlink_get_type
+G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorNetlink, g_network_monitor_netlink, G_TYPE_NETWORK_MONITOR_BASE,
+                         G_ADD_PRIVATE (GNetworkMonitorNetlink)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
+                                                g_network_monitor_netlink_iface_init)
+                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+                                                g_network_monitor_netlink_initable_iface_init)
+                         _g_io_modules_ensure_extension_points_registered ();
+                         g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
+                                                         g_define_type_id,
+                                                         "netlink",
+                                                         20))
+
 static void
 g_network_monitor_netlink_init (GNetworkMonitorNetlink *nl)
 {
-  nl->priv = G_TYPE_INSTANCE_GET_PRIVATE (nl,
-                                          G_TYPE_NETWORK_MONITOR_NETLINK,
-                                          GNetworkMonitorNetlinkPrivate);
+  nl->priv = g_network_monitor_netlink_get_private (nl);
 }
 
 
@@ -451,8 +450,6 @@ g_network_monitor_netlink_class_init (GNetworkMonitorNetlinkClass *nl_class)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (nl_class);
 
-  g_type_class_add_private (nl_class, sizeof (GNetworkMonitorNetlinkPrivate));
-
   gobject_class->finalize  = g_network_monitor_netlink_finalize;
 }
 
diff --git a/gio/gnetworkservice.c b/gio/gnetworkservice.c
index 9ec0099..756980e 100644
--- a/gio/gnetworkservice.c
+++ b/gio/gnetworkservice.c
@@ -93,6 +93,7 @@ static GSocketAddressEnumerator *g_network_service_connectable_enumerate
 static GSocketAddressEnumerator *g_network_service_connectable_proxy_enumerate  (GSocketConnectable      
*connectable);
 
 G_DEFINE_TYPE_WITH_CODE (GNetworkService, g_network_service, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GNetworkService)
                          G_IMPLEMENT_INTERFACE (G_TYPE_SOCKET_CONNECTABLE,
                                                 g_network_service_connectable_iface_init))
 
@@ -117,8 +118,6 @@ g_network_service_class_init (GNetworkServiceClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GNetworkServicePrivate));
-
   gobject_class->set_property = g_network_service_set_property;
   gobject_class->get_property = g_network_service_get_property;
   gobject_class->finalize = g_network_service_finalize;
@@ -167,8 +166,7 @@ g_network_service_connectable_iface_init (GSocketConnectableIface *connectable_i
 static void
 g_network_service_init (GNetworkService *srv)
 {
-  srv->priv = G_TYPE_INSTANCE_GET_PRIVATE (srv, G_TYPE_NETWORK_SERVICE,
-                                           GNetworkServicePrivate);
+  srv->priv = g_network_service_get_private (srv);
 }
 
 static void
diff --git a/gio/goutputstream.c b/gio/goutputstream.c
index 87a8c6e..5e4a893 100644
--- a/gio/goutputstream.c
+++ b/gio/goutputstream.c
@@ -45,8 +45,6 @@
  * All of these functions have async variants too.
  **/
 
-G_DEFINE_ABSTRACT_TYPE (GOutputStream, g_output_stream, G_TYPE_OBJECT);
-
 struct _GOutputStreamPrivate {
   guint closed : 1;
   guint pending : 1;
@@ -54,6 +52,8 @@ struct _GOutputStreamPrivate {
   GAsyncReadyCallback outstanding_callback;
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GOutputStream, g_output_stream, G_TYPE_OBJECT)
+
 static gssize   g_output_stream_real_splice        (GOutputStream             *stream,
                                                    GInputStream              *source,
                                                    GOutputStreamSpliceFlags   flags,
@@ -100,12 +100,6 @@ static gboolean _g_output_stream_close_internal    (GOutputStream             *s
                                                     GError                   **error);
 
 static void
-g_output_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_output_stream_parent_class)->finalize (object);
-}
-
-static void
 g_output_stream_dispose (GObject *object)
 {
   GOutputStream *stream;
@@ -122,10 +116,7 @@ static void
 g_output_stream_class_init (GOutputStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  
-  g_type_class_add_private (klass, sizeof (GOutputStreamPrivate));
-  
-  gobject_class->finalize = g_output_stream_finalize;
+
   gobject_class->dispose = g_output_stream_dispose;
 
   klass->splice = g_output_stream_real_splice;
@@ -143,9 +134,7 @@ g_output_stream_class_init (GOutputStreamClass *klass)
 static void
 g_output_stream_init (GOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                             G_TYPE_OUTPUT_STREAM,
-                                             GOutputStreamPrivate);
+  stream->priv = g_output_stream_get_private (stream);
 }
 
 /**
diff --git a/gio/gpermission.c b/gio/gpermission.c
index 4a57189..119ba69 100644
--- a/gio/gpermission.c
+++ b/gio/gpermission.c
@@ -60,8 +60,6 @@
  * using the following functions.
  **/
 
-G_DEFINE_ABSTRACT_TYPE (GPermission, g_permission, G_TYPE_OBJECT)
-
 struct _GPermissionPrivate
 {
   gboolean allowed;
@@ -76,6 +74,8 @@ enum  {
   PROP_CAN_RELEASE
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GPermission, g_permission, G_TYPE_OBJECT)
+
 /**
  * g_permission_acquire:
  * @permission: a #GPermission instance
@@ -375,9 +375,7 @@ g_permission_get_property (GObject *object, guint prop_id,
 static void
 g_permission_init (GPermission *permission)
 {
-  permission->priv = G_TYPE_INSTANCE_GET_PRIVATE (permission,
-                                                  G_TYPE_PERMISSION,
-                                                  GPermissionPrivate);
+  permission->priv = g_permission_get_private (permission);
 }
 
 static gboolean
@@ -464,6 +462,4 @@ g_permission_class_init (GPermissionClass *class)
                            P_("If calling g_permission_release() makes sense"),
                            FALSE,
                            G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
-
-  g_type_class_add_private (class, sizeof (GPermissionPrivate));
 }
diff --git a/gio/gproxyaddress.c b/gio/gproxyaddress.c
index 4b995dc..6a4a100 100644
--- a/gio/gproxyaddress.c
+++ b/gio/gproxyaddress.c
@@ -43,7 +43,6 @@
  *
  * Since: 2.26
  **/
-G_DEFINE_TYPE (GProxyAddress, g_proxy_address, G_TYPE_INET_SOCKET_ADDRESS);
 
 enum
 {
@@ -68,6 +67,8 @@ struct _GProxyAddressPrivate
   guint16        dest_port;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GProxyAddress, g_proxy_address, G_TYPE_INET_SOCKET_ADDRESS)
+
 static void
 g_proxy_address_finalize (GObject *object)
 {
@@ -180,8 +181,6 @@ g_proxy_address_class_init (GProxyAddressClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GProxyAddressPrivate));
-
   gobject_class->finalize = g_proxy_address_finalize;
   gobject_class->set_property = g_proxy_address_set_property;
   gobject_class->get_property = g_proxy_address_get_property;
@@ -276,9 +275,7 @@ g_proxy_address_class_init (GProxyAddressClass *klass)
 static void
 g_proxy_address_init (GProxyAddress *proxy)
 {
-  proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy,
-                                            G_TYPE_PROXY_ADDRESS,
-                                            GProxyAddressPrivate);
+  proxy->priv = g_proxy_address_get_private (proxy);
   proxy->priv->protocol = NULL;
   proxy->priv->username = NULL;
   proxy->priv->password = NULL;
diff --git a/gio/gproxyaddressenumerator.c b/gio/gproxyaddressenumerator.c
index be54fd0..796c212 100644
--- a/gio/gproxyaddressenumerator.c
+++ b/gio/gproxyaddressenumerator.c
@@ -39,8 +39,6 @@
 #include "gsocketaddressenumerator.h"
 #include "gsocketconnectable.h"
 
-G_DEFINE_TYPE (GProxyAddressEnumerator, g_proxy_address_enumerator, G_TYPE_SOCKET_ADDRESS_ENUMERATOR);
-
 #define GET_PRIVATE(o) (G_PROXY_ADDRESS_ENUMERATOR (o)->priv)
 
 enum
@@ -77,6 +75,8 @@ struct _GProxyAddressEnumeratorPrivate
   GError                   *last_error;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GProxyAddressEnumerator, g_proxy_address_enumerator, 
G_TYPE_SOCKET_ADDRESS_ENUMERATOR)
+
 static void
 save_userinfo (GProxyAddressEnumeratorPrivate *priv,
               const gchar *proxy)
@@ -697,9 +697,7 @@ g_proxy_address_enumerator_finalize (GObject *object)
 static void
 g_proxy_address_enumerator_init (GProxyAddressEnumerator *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-                                           G_TYPE_PROXY_ADDRESS_ENUMERATOR,
-                                           GProxyAddressEnumeratorPrivate);
+  self->priv = g_proxy_address_enumerator_get_private (self);
 }
 
 static void
@@ -708,9 +706,6 @@ g_proxy_address_enumerator_class_init (GProxyAddressEnumeratorClass *proxy_enume
   GObjectClass *object_class = G_OBJECT_CLASS (proxy_enumerator_class);
   GSocketAddressEnumeratorClass *enumerator_class = G_SOCKET_ADDRESS_ENUMERATOR_CLASS 
(proxy_enumerator_class);
 
-  g_type_class_add_private (enumerator_class,
-                           sizeof (GProxyAddressEnumeratorPrivate));
-
   object_class->constructed = g_proxy_address_enumerator_constructed;
   object_class->set_property = g_proxy_address_enumerator_set_property;
   object_class->get_property = g_proxy_address_enumerator_get_property;
diff --git a/gio/gresolver.c b/gio/gresolver.c
index 6aad517..0bc2a6d 100644
--- a/gio/gresolver.c
+++ b/gio/gresolver.c
@@ -77,6 +77,7 @@ struct _GResolverPrivate {
  * to get the default resolver.
  */
 G_DEFINE_TYPE_WITH_CODE (GResolver, g_resolver, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GResolver)
                         g_networking_init ();)
 
 static GList *
@@ -152,8 +153,6 @@ g_resolver_class_init (GResolverClass *resolver_class)
   resolver_class->lookup_service_async = g_resolver_real_lookup_service_async;
   resolver_class->lookup_service_finish = g_resolver_real_lookup_service_finish;
 
-  g_type_class_add_private (resolver_class, sizeof (GResolverPrivate));
-
   /**
    * GResolver::reload:
    * @resolver: a #GResolver
@@ -178,7 +177,7 @@ g_resolver_init (GResolver *resolver)
   struct stat st;
 #endif
 
-  resolver->priv = G_TYPE_INSTANCE_GET_PRIVATE (resolver, G_TYPE_RESOLVER, GResolverPrivate);
+  resolver->priv = g_resolver_get_private (resolver);
 
 #ifdef G_OS_UNIX
   if (stat (_PATH_RESCONF, &st) == 0)
diff --git a/gio/gsettings.c b/gio/gsettings.c
index 28c3e53..8571bfb 100644
--- a/gio/gsettings.c
+++ b/gio/gsettings.c
@@ -265,7 +265,7 @@ enum
 
 static guint g_settings_signals[N_SIGNALS];
 
-G_DEFINE_TYPE (GSettings, g_settings, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GSettings, g_settings, G_TYPE_OBJECT)
 
 /* Signals {{{1 */
 static gboolean
@@ -603,10 +603,7 @@ g_settings_finalize (GObject *object)
 static void
 g_settings_init (GSettings *settings)
 {
-  settings->priv = G_TYPE_INSTANCE_GET_PRIVATE (settings,
-                                                G_TYPE_SETTINGS,
-                                                GSettingsPrivate);
-
+  settings->priv = g_settings_get_private (settings);
   settings->priv->main_context = g_main_context_ref_thread_default ();
 }
 
@@ -623,8 +620,6 @@ g_settings_class_init (GSettingsClass *class)
   object_class->constructed = g_settings_constructed;
   object_class->finalize = g_settings_finalize;
 
-  g_type_class_add_private (object_class, sizeof (GSettingsPrivate));
-
   /**
    * GSettings::changed:
    * @settings: the object on which the signal was emitted
diff --git a/gio/gsettingsbackend.c b/gio/gsettingsbackend.c
index c89531a..a8f51d4 100644
--- a/gio/gsettingsbackend.c
+++ b/gio/gsettingsbackend.c
@@ -33,8 +33,6 @@
 #include <glibintl.h>
 
 
-G_DEFINE_ABSTRACT_TYPE (GSettingsBackend, g_settings_backend, G_TYPE_OBJECT)
-
 typedef struct _GSettingsBackendClosure GSettingsBackendClosure;
 typedef struct _GSettingsBackendWatch   GSettingsBackendWatch;
 
@@ -44,6 +42,8 @@ struct _GSettingsBackendPrivate
   GMutex lock;
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GSettingsBackend, g_settings_backend, G_TYPE_OBJECT)
+
 /* For g_settings_backend_sync_default(), we only want to actually do
  * the sync if the backend already exists.  This avoids us creating an
  * entire GSettingsBackend in order to call a do-nothing sync()
@@ -906,9 +906,7 @@ ignore_subscription (GSettingsBackend *backend,
 static void
 g_settings_backend_init (GSettingsBackend *backend)
 {
-  backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (backend,
-                                               G_TYPE_SETTINGS_BACKEND,
-                                               GSettingsBackendPrivate);
+  backend->priv = g_settings_backend_get_private (backend);
   g_mutex_init (&backend->priv->lock);
 }
 
@@ -921,8 +919,6 @@ g_settings_backend_class_init (GSettingsBackendClass *class)
   class->unsubscribe = ignore_subscription;
 
   gobject_class->finalize = g_settings_backend_finalize;
-
-  g_type_class_add_private (class, sizeof (GSettingsBackendPrivate));
 }
 
 static void
diff --git a/gio/gsimpleactiongroup.c b/gio/gsimpleactiongroup.c
index b4e422a..ff549aa 100644
--- a/gio/gsimpleactiongroup.c
+++ b/gio/gsimpleactiongroup.c
@@ -45,6 +45,7 @@ static void g_simple_action_group_iface_init (GActionGroupInterface *);
 static void g_simple_action_group_map_iface_init (GActionMapInterface *);
 G_DEFINE_TYPE_WITH_CODE (GSimpleActionGroup,
   g_simple_action_group, G_TYPE_OBJECT,
+  G_ADD_PRIVATE (GSimpleActionGroup)
   G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP,
                          g_simple_action_group_iface_init);
   G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_MAP,
@@ -251,9 +252,7 @@ g_simple_action_group_finalize (GObject *object)
 static void
 g_simple_action_group_init (GSimpleActionGroup *simple)
 {
-  simple->priv = G_TYPE_INSTANCE_GET_PRIVATE (simple,
-                                              G_TYPE_SIMPLE_ACTION_GROUP,
-                                              GSimpleActionGroupPrivate);
+  simple->priv = g_simple_action_group_get_private (simple);
   simple->priv->table = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                g_free, g_object_unref);
 }
@@ -264,8 +263,6 @@ g_simple_action_group_class_init (GSimpleActionGroupClass *class)
   GObjectClass *object_class = G_OBJECT_CLASS (class);
 
   object_class->finalize = g_simple_action_group_finalize;
-
-  g_type_class_add_private (class, sizeof (GSimpleActionGroupPrivate));
 }
 
 static void
diff --git a/gio/gsimpleproxyresolver.c b/gio/gsimpleproxyresolver.c
index 24f41a4..05c17f4 100644
--- a/gio/gsimpleproxyresolver.c
+++ b/gio/gsimpleproxyresolver.c
@@ -65,6 +65,7 @@ struct _GSimpleProxyResolverPrivate {
 static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GSimpleProxyResolver, g_simple_proxy_resolver, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GSimpleProxyResolver)
                          G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER,
                                                 g_simple_proxy_resolver_iface_init))
 
@@ -96,9 +97,7 @@ g_simple_proxy_resolver_finalize (GObject *object)
 static void
 g_simple_proxy_resolver_init (GSimpleProxyResolver *resolver)
 {
-  resolver->priv = G_TYPE_INSTANCE_GET_PRIVATE (resolver,
-                                                G_TYPE_SIMPLE_PROXY_RESOLVER,
-                                                GSimpleProxyResolverPrivate);
+  resolver->priv = g_simple_proxy_resolver_get_private (resolver);
   resolver->priv->uri_proxies = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                        g_free, g_free);
 }
@@ -403,8 +402,6 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (resolver_class);
 
-  g_type_class_add_private (resolver_class, sizeof (GSimpleProxyResolverPrivate));
-
   object_class->get_property = g_simple_proxy_resolver_get_property;
   object_class->set_property = g_simple_proxy_resolver_set_property;
   object_class->finalize = g_simple_proxy_resolver_finalize;
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 5c524a4..cc8227c 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -126,11 +126,6 @@ static gboolean g_socket_initable_init       (GInitable       *initable,
                                              GCancellable    *cancellable,
                                              GError         **error);
 
-G_DEFINE_TYPE_WITH_CODE (GSocket, g_socket, G_TYPE_OBJECT,
-                        g_networking_init ();
-                        G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
-                                               g_socket_initable_iface_init));
-
 enum
 {
   PROP_0,
@@ -187,6 +182,12 @@ struct _GSocketPrivate
   } recv_addr_cache[RECV_ADDR_CACHE_SIZE];
 };
 
+G_DEFINE_TYPE_WITH_CODE (GSocket, g_socket, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GSocket)
+                        g_networking_init ();
+                        G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+                                               g_socket_initable_iface_init));
+
 static int
 get_socket_errno (void)
 {
@@ -786,8 +787,6 @@ g_socket_class_init (GSocketClass *klass)
   signal (SIGPIPE, SIG_IGN);
 #endif
 
-  g_type_class_add_private (klass, sizeof (GSocketPrivate));
-
   gobject_class->finalize = g_socket_finalize;
   gobject_class->constructed = g_socket_constructed;
   gobject_class->set_property = g_socket_set_property;
@@ -963,7 +962,7 @@ g_socket_initable_iface_init (GInitableIface *iface)
 static void
 g_socket_init (GSocket *socket)
 {
-  socket->priv = G_TYPE_INSTANCE_GET_PRIVATE (socket, G_TYPE_SOCKET, GSocketPrivate);
+  socket->priv = g_socket_get_private (socket);
 
   socket->priv->fd = -1;
   socket->priv->blocking = TRUE;
diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
index f499611..aca2e71 100644
--- a/gio/gsocketclient.c
+++ b/gio/gsocketclient.c
@@ -75,8 +75,6 @@
  */
 
 
-G_DEFINE_TYPE (GSocketClient, g_socket_client, G_TYPE_OBJECT);
-
 enum
 {
   EVENT,
@@ -113,6 +111,8 @@ struct _GSocketClientPrivate
   GProxyResolver *proxy_resolver;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GSocketClient, g_socket_client, G_TYPE_OBJECT)
+
 static GSocket *
 create_socket (GSocketClient  *client,
               GSocketAddress *dest_address,
@@ -199,9 +199,7 @@ clarify_connect_error (GError             *error,
 static void
 g_socket_client_init (GSocketClient *client)
 {
-  client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client,
-                                             G_TYPE_SOCKET_CLIENT,
-                                             GSocketClientPrivate);
+  client->priv = g_socket_client_get_private (client);
   client->priv->type = G_SOCKET_TYPE_STREAM;
   client->priv->app_proxies = g_hash_table_new_full (g_str_hash,
                                                     g_str_equal,
@@ -233,8 +231,7 @@ g_socket_client_finalize (GObject *object)
   g_clear_object (&client->priv->local_address);
   g_clear_object (&client->priv->proxy_resolver);
 
-  if (G_OBJECT_CLASS (g_socket_client_parent_class)->finalize)
-    (*G_OBJECT_CLASS (g_socket_client_parent_class)->finalize) (object);
+  G_OBJECT_CLASS (g_socket_client_parent_class)->finalize (object);
 
   g_hash_table_unref (client->priv->app_proxies);
 }
@@ -762,8 +759,6 @@ g_socket_client_class_init (GSocketClientClass *class)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
 
-  g_type_class_add_private (class, sizeof (GSocketClientPrivate));
-
   gobject_class->finalize = g_socket_client_finalize;
   gobject_class->set_property = g_socket_client_set_property;
   gobject_class->get_property = g_socket_client_get_property;
diff --git a/gio/gsocketconnection.c b/gio/gsocketconnection.c
index d60f198..537ee04 100644
--- a/gio/gsocketconnection.c
+++ b/gio/gsocketconnection.c
@@ -60,8 +60,6 @@
  * Since: 2.22
  */
 
-G_DEFINE_TYPE (GSocketConnection, g_socket_connection, G_TYPE_IO_STREAM);
-
 enum
 {
   PROP_NONE,
@@ -89,6 +87,8 @@ static gboolean g_socket_connection_close_finish  (GIOStream            *stream,
                                                   GAsyncResult         *result,
                                                   GError              **error);
 
+G_DEFINE_TYPE_WITH_PRIVATE (GSocketConnection, g_socket_connection, G_TYPE_IO_STREAM)
+
 static GInputStream *
 g_socket_connection_get_input_stream (GIOStream *io_stream)
 {
@@ -399,8 +399,6 @@ g_socket_connection_class_init (GSocketConnectionClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GIOStreamClass *stream_class = G_IO_STREAM_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GSocketConnectionPrivate));
-
   gobject_class->set_property = g_socket_connection_set_property;
   gobject_class->get_property = g_socket_connection_get_property;
   gobject_class->constructed = g_socket_connection_constructed;
@@ -427,9 +425,7 @@ g_socket_connection_class_init (GSocketConnectionClass *klass)
 static void
 g_socket_connection_init (GSocketConnection *connection)
 {
-  connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection,
-                                                  G_TYPE_SOCKET_CONNECTION,
-                                                  GSocketConnectionPrivate);
+  connection->priv = g_socket_connection_get_private (connection);
 }
 
 static gboolean
diff --git a/gio/gsocketinputstream.c b/gio/gsocketinputstream.c
index 66d0bff..1400bd2 100644
--- a/gio/gsocketinputstream.c
+++ b/gio/gsocketinputstream.c
@@ -32,6 +32,15 @@
 #include "gioerror.h"
 #include "gfiledescriptorbased.h"
 
+struct _GSocketInputStreamPrivate
+{
+  GSocket *socket;
+
+  /* pending operation metadata */
+  gpointer buffer;
+  gsize count;
+};
+
 static void g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface);
 #ifdef G_OS_UNIX
 static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
@@ -41,11 +50,13 @@ static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescrip
 
 #ifdef G_OS_UNIX
 G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM,
+                         G_ADD_PRIVATE (GSocketInputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, 
g_socket_input_stream_pollable_iface_init)
                         G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, 
g_socket_input_stream_file_descriptor_based_iface_init)
                         )
 #else
 G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM,
+                         G_ADD_PRIVATE (GSocketInputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, 
g_socket_input_stream_pollable_iface_init)
                         )
 #endif
@@ -56,15 +67,6 @@ enum
   PROP_SOCKET
 };
 
-struct _GSocketInputStreamPrivate
-{
-  GSocket *socket;
-
-  /* pending operation metadata */
-  gpointer buffer;
-  gsize count;
-};
-
 static void
 g_socket_input_stream_get_property (GObject    *object,
                                     guint       prop_id,
@@ -111,8 +113,7 @@ g_socket_input_stream_finalize (GObject *object)
   if (stream->priv->socket)
     g_object_unref (stream->priv->socket);
 
-  if (G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize)
-    (*G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize) (object);
+  G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize (object);
 }
 
 static gssize
@@ -183,8 +184,6 @@ g_socket_input_stream_class_init (GSocketInputStreamClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GSocketInputStreamPrivate));
-
   gobject_class->finalize = g_socket_input_stream_finalize;
   gobject_class->get_property = g_socket_input_stream_get_property;
   gobject_class->set_property = g_socket_input_stream_set_property;
@@ -218,11 +217,11 @@ g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface)
 static void
 g_socket_input_stream_init (GSocketInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, G_TYPE_SOCKET_INPUT_STREAM, GSocketInputStreamPrivate);
+  stream->priv = g_socket_input_stream_get_private (stream);
 }
 
 GSocketInputStream *
 _g_socket_input_stream_new (GSocket *socket)
 {
-  return G_SOCKET_INPUT_STREAM (g_object_new (G_TYPE_SOCKET_INPUT_STREAM, "socket", socket, NULL));
+  return g_object_new (G_TYPE_SOCKET_INPUT_STREAM, "socket", socket, NULL);
 }
diff --git a/gio/gsocketlistener.c b/gio/gsocketlistener.c
index 7af0d14..4a55e4d 100644
--- a/gio/gsocketlistener.c
+++ b/gio/gsocketlistener.c
@@ -56,8 +56,6 @@
  * Since: 2.22
  */
 
-G_DEFINE_TYPE (GSocketListener, g_socket_listener, G_TYPE_OBJECT);
-
 enum
 {
   PROP_0,
@@ -75,6 +73,8 @@ struct _GSocketListenerPrivate
   guint               closed : 1;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GSocketListener, g_socket_listener, G_TYPE_OBJECT)
+
 static void
 g_socket_listener_finalize (GObject *object)
 {
@@ -136,8 +136,6 @@ g_socket_listener_class_init (GSocketListenerClass *klass)
 {
   GObjectClass *gobject_class G_GNUC_UNUSED = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GSocketListenerPrivate));
-
   gobject_class->finalize = g_socket_listener_finalize;
   gobject_class->set_property = g_socket_listener_set_property;
   gobject_class->get_property = g_socket_listener_get_property;
@@ -156,9 +154,7 @@ g_socket_listener_class_init (GSocketListenerClass *klass)
 static void
 g_socket_listener_init (GSocketListener *listener)
 {
-  listener->priv = G_TYPE_INSTANCE_GET_PRIVATE (listener,
-                                               G_TYPE_SOCKET_LISTENER,
-                                               GSocketListenerPrivate);
+  listener->priv = g_socket_listener_get_private (listener);
   listener->priv->sockets =
     g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
   listener->priv->listen_backlog = 10;
diff --git a/gio/gsocketoutputstream.c b/gio/gsocketoutputstream.c
index 6168758..d298a57 100644
--- a/gio/gsocketoutputstream.c
+++ b/gio/gsocketoutputstream.c
@@ -36,6 +36,15 @@
 #include "glibintl.h"
 #include "gfiledescriptorbased.h"
 
+struct _GSocketOutputStreamPrivate
+{
+  GSocket *socket;
+
+  /* pending operation metadata */
+  gconstpointer buffer;
+  gsize count;
+};
+
 static void g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface);
 #ifdef G_OS_UNIX
 static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
@@ -45,11 +54,13 @@ static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescri
 
 #ifdef G_OS_UNIX
 G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GSocketOutputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, 
g_socket_output_stream_pollable_iface_init)
                         G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, 
g_socket_output_stream_file_descriptor_based_iface_init)
                         )
 #else
 G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GSocketOutputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, 
g_socket_output_stream_pollable_iface_init)
                         )
 #endif
@@ -60,15 +71,6 @@ enum
   PROP_SOCKET
 };
 
-struct _GSocketOutputStreamPrivate
-{
-  GSocket *socket;
-
-  /* pending operation metadata */
-  gconstpointer buffer;
-  gsize count;
-};
-
 static void
 g_socket_output_stream_get_property (GObject    *object,
                                      guint       prop_id,
@@ -115,8 +117,7 @@ g_socket_output_stream_finalize (GObject *object)
   if (stream->priv->socket)
     g_object_unref (stream->priv->socket);
 
-  if (G_OBJECT_CLASS (g_socket_output_stream_parent_class)->finalize)
-    (*G_OBJECT_CLASS (g_socket_output_stream_parent_class)->finalize) (object);
+  G_OBJECT_CLASS (g_socket_output_stream_parent_class)->finalize (object);
 }
 
 static gssize
@@ -187,8 +188,6 @@ g_socket_output_stream_class_init (GSocketOutputStreamClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GOutputStreamClass *goutputstream_class = G_OUTPUT_STREAM_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GSocketOutputStreamPrivate));
-
   gobject_class->finalize = g_socket_output_stream_finalize;
   gobject_class->get_property = g_socket_output_stream_get_property;
   gobject_class->set_property = g_socket_output_stream_set_property;
@@ -222,11 +221,11 @@ g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *ifac
 static void
 g_socket_output_stream_init (GSocketOutputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, G_TYPE_SOCKET_OUTPUT_STREAM, 
GSocketOutputStreamPrivate);
+  stream->priv = g_socket_output_stream_get_private (stream);
 }
 
 GSocketOutputStream *
 _g_socket_output_stream_new (GSocket *socket)
 {
-  return G_SOCKET_OUTPUT_STREAM (g_object_new (G_TYPE_SOCKET_OUTPUT_STREAM, "socket", socket, NULL));
+  return g_object_new (G_TYPE_SOCKET_OUTPUT_STREAM, "socket", socket, NULL);
 }
diff --git a/gio/gsocketservice.c b/gio/gsocketservice.c
index 026e64a..b8ae9eb 100644
--- a/gio/gsocketservice.c
+++ b/gio/gsocketservice.c
@@ -65,13 +65,6 @@
 #include "gsocketlistener.h"
 #include "gsocketconnection.h"
 
-
-static guint g_socket_service_incoming_signal;
-
-G_DEFINE_TYPE (GSocketService, g_socket_service, G_TYPE_SOCKET_LISTENER);
-
-G_LOCK_DEFINE_STATIC(active);
-
 struct _GSocketServicePrivate
 {
   GCancellable *cancellable;
@@ -79,6 +72,12 @@ struct _GSocketServicePrivate
   guint outstanding_accept : 1;
 };
 
+static guint g_socket_service_incoming_signal;
+
+G_LOCK_DEFINE_STATIC(active);
+
+G_DEFINE_TYPE_WITH_PRIVATE (GSocketService, g_socket_service, G_TYPE_SOCKET_LISTENER)
+
 static void g_socket_service_ready (GObject      *object,
                                    GAsyncResult *result,
                                    gpointer      user_data);
@@ -94,9 +93,7 @@ g_socket_service_real_incoming (GSocketService    *service,
 static void
 g_socket_service_init (GSocketService *service)
 {
-  service->priv = G_TYPE_INSTANCE_GET_PRIVATE (service,
-                                              G_TYPE_SOCKET_SERVICE,
-                                              GSocketServicePrivate);
+  service->priv = g_socket_service_get_private (service);
   service->priv->cancellable = g_cancellable_new ();
   service->priv->active = TRUE;
 }
@@ -244,8 +241,6 @@ g_socket_service_class_init (GSocketServiceClass *class)
   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
   GSocketListenerClass *listener_class = G_SOCKET_LISTENER_CLASS (class);
 
-  g_type_class_add_private (class, sizeof (GSocketServicePrivate));
-
   gobject_class->finalize = g_socket_service_finalize;
   listener_class->changed = g_socket_service_changed;
   class->incoming = g_socket_service_real_incoming;
diff --git a/gio/gtcpconnection.c b/gio/gtcpconnection.c
index 00fb059..fb324cc 100644
--- a/gio/gtcpconnection.c
+++ b/gio/gtcpconnection.c
@@ -29,9 +29,14 @@
 #include "giostream.h"
 #include "glibintl.h"
 
+struct _GTcpConnectionPrivate
+{
+  guint graceful_disconnect : 1;
+};
 
 G_DEFINE_TYPE_WITH_CODE (GTcpConnection, g_tcp_connection,
                         G_TYPE_SOCKET_CONNECTION,
+                         G_ADD_PRIVATE (GTcpConnection)
   g_socket_connection_factory_register_type (g_define_type_id,
                                             G_SOCKET_FAMILY_IPV4,
                                             G_SOCKET_TYPE_STREAM,
@@ -59,11 +64,6 @@ static void     g_tcp_connection_close_async (GIOStream            *stream,
                                              GAsyncReadyCallback   callback,
                                              gpointer              user_data);
 
-struct _GTcpConnectionPrivate
-{
-  guint graceful_disconnect : 1;
-};
-
 
 enum
 {
@@ -74,9 +74,7 @@ enum
 static void
 g_tcp_connection_init (GTcpConnection *connection)
 {
-  connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection,
-                                                  G_TYPE_TCP_CONNECTION,
-                                                  GTcpConnectionPrivate);
+  connection->priv = g_tcp_connection_get_private (connection);
   connection->priv->graceful_disconnect = FALSE;
 }
 
@@ -125,8 +123,6 @@ g_tcp_connection_class_init (GTcpConnectionClass *class)
   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
   GIOStreamClass *stream_class = G_IO_STREAM_CLASS (class);
 
-  g_type_class_add_private (class, sizeof (GTcpConnectionPrivate));
-
   gobject_class->set_property = g_tcp_connection_set_property;
   gobject_class->get_property = g_tcp_connection_get_property;
 
diff --git a/gio/gtcpwrapperconnection.c b/gio/gtcpwrapperconnection.c
index deab98f..de2d0d5 100644
--- a/gio/gtcpwrapperconnection.c
+++ b/gio/gtcpwrapperconnection.c
@@ -42,8 +42,12 @@
 #include "gtcpconnection.h"
 #include "glibintl.h"
 
-G_DEFINE_TYPE (GTcpWrapperConnection,
-              g_tcp_wrapper_connection, G_TYPE_TCP_CONNECTION);
+struct _GTcpWrapperConnectionPrivate
+{
+  GIOStream *base_io_stream;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GTcpWrapperConnection, g_tcp_wrapper_connection, G_TYPE_TCP_CONNECTION)
 
 enum
 {
@@ -51,11 +55,6 @@ enum
   PROP_BASE_IO_STREAM
 };
 
-struct _GTcpWrapperConnectionPrivate
-{
-  GIOStream *base_io_stream;
-};
-
 static GInputStream *
 g_tcp_wrapper_connection_get_input_stream (GIOStream *io_stream)
 {
@@ -127,8 +126,6 @@ g_tcp_wrapper_connection_class_init (GTcpWrapperConnectionClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GIOStreamClass *stream_class = G_IO_STREAM_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GTcpWrapperConnectionPrivate));
-
   gobject_class->set_property = g_tcp_wrapper_connection_set_property;
   gobject_class->get_property = g_tcp_wrapper_connection_get_property;
   gobject_class->finalize = g_tcp_wrapper_connection_finalize;
@@ -150,9 +147,7 @@ g_tcp_wrapper_connection_class_init (GTcpWrapperConnectionClass *klass)
 static void
 g_tcp_wrapper_connection_init (GTcpWrapperConnection *connection)
 {
-  connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection,
-                                                  G_TYPE_TCP_WRAPPER_CONNECTION,
-                                                  GTcpWrapperConnectionPrivate);
+  connection->priv = g_tcp_wrapper_connection_get_private (connection);
 }
 
 /**
diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c
index 3ca064c..c3eb39e 100644
--- a/gio/gtestdbus.c
+++ b/gio/gtestdbus.c
@@ -431,14 +431,12 @@ enum
   PROP_FLAGS,
 };
 
-G_DEFINE_TYPE (GTestDBus, g_test_dbus, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GTestDBus, g_test_dbus, G_TYPE_OBJECT)
 
 static void
 g_test_dbus_init (GTestDBus *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), G_TYPE_TEST_DBUS,
-      GTestDBusPrivate);
-
+  self->priv = g_test_dbus_get_private (self);
   self->priv->service_dirs = g_ptr_array_new_with_free_func (g_free);
 }
 
@@ -512,8 +510,6 @@ g_test_dbus_class_init (GTestDBusClass *klass)
   object_class->get_property = g_test_dbus_get_property;
   object_class->set_property = g_test_dbus_set_property;
 
-  g_type_class_add_private (object_class, sizeof (GTestDBusPrivate));
-
   /**
    * GTestDBus:flags:
    *
diff --git a/gio/gthreadedsocketservice.c b/gio/gthreadedsocketservice.c
index 475c1e1..80e5a95 100644
--- a/gio/gthreadedsocketservice.c
+++ b/gio/gthreadedsocketservice.c
@@ -50,12 +50,18 @@
 #include "gthreadedsocketservice.h"
 #include "glibintl.h"
 
+struct _GThreadedSocketServicePrivate
+{
+  GThreadPool *thread_pool;
+  int max_threads;
+  gint job_count;
+};
 
 static guint g_threaded_socket_service_run_signal;
 
-G_DEFINE_TYPE (GThreadedSocketService,
-              g_threaded_socket_service,
-              G_TYPE_SOCKET_SERVICE);
+G_DEFINE_TYPE_WITH_PRIVATE (GThreadedSocketService,
+                            g_threaded_socket_service,
+                            G_TYPE_SOCKET_SERVICE)
 
 enum
 {
@@ -63,16 +69,8 @@ enum
   PROP_MAX_THREADS
 };
 
-
 G_LOCK_DEFINE_STATIC(job_count);
 
-struct _GThreadedSocketServicePrivate
-{
-  GThreadPool *thread_pool;
-  int max_threads;
-  gint job_count;
-};
-
 typedef struct
 {
   GThreadedSocketService *service;
@@ -136,9 +134,7 @@ g_threaded_socket_service_incoming (GSocketService    *service,
 static void
 g_threaded_socket_service_init (GThreadedSocketService *service)
 {
-  service->priv = G_TYPE_INSTANCE_GET_PRIVATE (service,
-                                              G_TYPE_THREADED_SOCKET_SERVICE,
-                                              GThreadedSocketServicePrivate);
+  service->priv = g_threaded_socket_service_get_private (service);
   service->priv->max_threads = 10;
 }
 
@@ -212,8 +208,6 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
   GSocketServiceClass *ss_class = &class->parent_class;
 
-  g_type_class_add_private (class, sizeof (GThreadedSocketServicePrivate));
-
   gobject_class->constructed = g_threaded_socket_service_constructed;
   gobject_class->finalize = g_threaded_socket_service_finalize;
   gobject_class->set_property = g_threaded_socket_service_set_property;
diff --git a/gio/gtlsinteraction.c b/gio/gtlsinteraction.c
index 75d4bab..196b055 100644
--- a/gio/gtlsinteraction.c
+++ b/gio/gtlsinteraction.c
@@ -103,7 +103,7 @@ struct _GTlsInteractionPrivate {
   GMainContext *context;
 };
 
-G_DEFINE_TYPE (GTlsInteraction, g_tls_interaction, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GTlsInteraction, g_tls_interaction, G_TYPE_OBJECT)
 
 typedef struct {
   GMutex mutex;
@@ -185,8 +185,7 @@ invoke_closure_wait_and_free (InvokeClosure *closure,
 static void
 g_tls_interaction_init (GTlsInteraction *interaction)
 {
-  interaction->priv = G_TYPE_INSTANCE_GET_PRIVATE (interaction, G_TYPE_TLS_INTERACTION,
-                                                   GTlsInteractionPrivate);
+  interaction->priv = g_tls_interaction_get_private (interaction);
   interaction->priv->context = g_main_context_ref_thread_default ();
 }
 
@@ -206,8 +205,6 @@ g_tls_interaction_class_init (GTlsInteractionClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
   gobject_class->finalize = g_tls_interaction_finalize;
-
-  g_type_class_add_private (klass, sizeof (GTlsInteractionPrivate));
 }
 
 static gboolean
diff --git a/gio/gtlspassword.c b/gio/gtlspassword.c
index ad55ad4..9226084 100644
--- a/gio/gtlspassword.c
+++ b/gio/gtlspassword.c
@@ -65,13 +65,12 @@ struct _GTlsPasswordPrivate
   gchar *warning;
 };
 
-G_DEFINE_TYPE (GTlsPassword, g_tls_password, G_TYPE_OBJECT);
+G_DEFINE_TYPE_WITH_PRIVATE (GTlsPassword, g_tls_password, G_TYPE_OBJECT)
 
 static void
 g_tls_password_init (GTlsPassword *password)
 {
-  password->priv = G_TYPE_INSTANCE_GET_PRIVATE (password, G_TYPE_TLS_PASSWORD,
-                                               GTlsPasswordPrivate);
+  password->priv = g_tls_password_get_private (password);
 }
 
 static const guchar *
@@ -195,8 +194,6 @@ g_tls_password_class_init (GTlsPasswordClass *klass)
   gobject_class->set_property = g_tls_password_set_property;
   gobject_class->finalize = g_tls_password_finalize;
 
-  g_type_class_add_private (klass, sizeof (GTlsPasswordPrivate));
-
   g_object_class_install_property (gobject_class, PROP_FLAGS,
                                   g_param_spec_flags ("flags",
                                                       P_("Flags"),
diff --git a/gio/gunixcredentialsmessage.c b/gio/gunixcredentialsmessage.c
index 541b58c..e146a94 100644
--- a/gio/gunixcredentialsmessage.c
+++ b/gio/gunixcredentialsmessage.c
@@ -69,8 +69,7 @@ enum
   PROP_CREDENTIALS
 };
 
-G_DEFINE_TYPE (GUnixCredentialsMessage, g_unix_credentials_message, G_TYPE_SOCKET_CONTROL_MESSAGE);
-
+G_DEFINE_TYPE_WITH_PRIVATE (GUnixCredentialsMessage, g_unix_credentials_message, 
G_TYPE_SOCKET_CONTROL_MESSAGE)
 static gsize
 g_unix_credentials_message_get_size (GSocketControlMessage *message)
 {
@@ -215,9 +214,7 @@ g_unix_credentials_message_finalize (GObject *object)
 static void
 g_unix_credentials_message_init (GUnixCredentialsMessage *message)
 {
-  message->priv = G_TYPE_INSTANCE_GET_PRIVATE (message,
-                                               G_TYPE_UNIX_CREDENTIALS_MESSAGE,
-                                               GUnixCredentialsMessagePrivate);
+  message->priv = g_unix_credentials_message_get_private (message);
 }
 
 static void
@@ -278,8 +275,6 @@ g_unix_credentials_message_class_init (GUnixCredentialsMessageClass *class)
   GSocketControlMessageClass *scm_class;
   GObjectClass *gobject_class;
 
-  g_type_class_add_private (class, sizeof (GUnixCredentialsMessagePrivate));
-
   gobject_class = G_OBJECT_CLASS (class);
   gobject_class->get_property = g_unix_credentials_message_get_property;
   gobject_class->set_property = g_unix_credentials_message_set_property;
diff --git a/gio/gunixfdlist.c b/gio/gunixfdlist.c
index 628d95c..aab39a6 100644
--- a/gio/gunixfdlist.c
+++ b/gio/gunixfdlist.c
@@ -42,22 +42,18 @@
 #include "gnetworking.h"
 #include "gioerror.h"
 
-
-
-G_DEFINE_TYPE (GUnixFDList, g_unix_fd_list, G_TYPE_OBJECT)
-
 struct _GUnixFDListPrivate
 {
   gint *fds;
   gint nfd;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GUnixFDList, g_unix_fd_list, G_TYPE_OBJECT)
+
 static void
 g_unix_fd_list_init (GUnixFDList *list)
 {
-  list->priv = G_TYPE_INSTANCE_GET_PRIVATE (list,
-                                               G_TYPE_UNIX_FD_LIST,
-                                               GUnixFDListPrivate);
+  list->priv = g_unix_fd_list_get_private (list);
 }
 
 static void
@@ -79,7 +75,6 @@ g_unix_fd_list_class_init (GUnixFDListClass *class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-  g_type_class_add_private (class, sizeof (GUnixFDListPrivate));
   object_class->finalize = g_unix_fd_list_finalize;
 }
 
diff --git a/gio/gunixfdmessage.c b/gio/gunixfdmessage.c
index 4e7f494..a028efc 100644
--- a/gio/gunixfdmessage.c
+++ b/gio/gunixfdmessage.c
@@ -46,16 +46,13 @@
 #include "gnetworking.h"
 #include "gioerror.h"
 
-
-
-G_DEFINE_TYPE (GUnixFDMessage, g_unix_fd_message,
-               G_TYPE_SOCKET_CONTROL_MESSAGE);
-
 struct _GUnixFDMessagePrivate
 {
   GUnixFDList *list;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GUnixFDMessage, g_unix_fd_message, G_TYPE_SOCKET_CONTROL_MESSAGE)
+
 static gsize
 g_unix_fd_message_get_size (GSocketControlMessage *message)
 {
@@ -184,9 +181,7 @@ g_unix_fd_message_get_property (GObject *object, guint prop_id,
 static void
 g_unix_fd_message_init (GUnixFDMessage *message)
 {
-  message->priv = G_TYPE_INSTANCE_GET_PRIVATE (message,
-                                               G_TYPE_UNIX_FD_MESSAGE,
-                                               GUnixFDMessagePrivate);
+  message->priv = g_unix_fd_message_get_private (message);
 }
 
 static void
@@ -206,7 +201,6 @@ g_unix_fd_message_class_init (GUnixFDMessageClass *class)
   GSocketControlMessageClass *scm_class = G_SOCKET_CONTROL_MESSAGE_CLASS (class);
   GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-  g_type_class_add_private (class, sizeof (GUnixFDMessagePrivate));
   scm_class->get_size = g_unix_fd_message_get_size;
   scm_class->get_level = g_unix_fd_message_get_level;
   scm_class->get_type = g_unix_fd_message_get_msg_type;
diff --git a/gio/gunixinputstream.c b/gio/gunixinputstream.c
index 5ed5cd8..dd6af1a 100644
--- a/gio/gunixinputstream.c
+++ b/gio/gunixinputstream.c
@@ -63,22 +63,23 @@ enum {
   PROP_CLOSE_FD
 };
 
+struct _GUnixInputStreamPrivate {
+  int fd;
+  guint close_fd : 1;
+  guint is_pipe_or_socket : 1;
+};
+
 static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface);
 static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GUnixInputStream, g_unix_input_stream, G_TYPE_INPUT_STREAM,
+                         G_ADD_PRIVATE (GUnixInputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
                                                g_unix_input_stream_pollable_iface_init)
                         G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
                                                g_unix_input_stream_file_descriptor_based_iface_init)
                         )
 
-struct _GUnixInputStreamPrivate {
-  int fd;
-  guint close_fd : 1;
-  guint is_pipe_or_socket : 1;
-};
-
 static void     g_unix_input_stream_set_property (GObject              *object,
                                                  guint                 prop_id,
                                                  const GValue         *value,
@@ -119,22 +120,13 @@ static GSource *g_unix_input_stream_pollable_create_source (GPollableInputStream
                                                            GCancellable         *cancellable);
 
 static void
-g_unix_input_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_unix_input_stream_parent_class)->finalize (object);
-}
-
-static void
 g_unix_input_stream_class_init (GUnixInputStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
-  
-  g_type_class_add_private (klass, sizeof (GUnixInputStreamPrivate));
 
   gobject_class->get_property = g_unix_input_stream_get_property;
   gobject_class->set_property = g_unix_input_stream_set_property;
-  gobject_class->finalize = g_unix_input_stream_finalize;
 
   stream_class->read_fn = g_unix_input_stream_read;
   stream_class->close_fn = g_unix_input_stream_close;
@@ -246,10 +238,7 @@ g_unix_input_stream_get_property (GObject    *object,
 static void
 g_unix_input_stream_init (GUnixInputStream *unix_stream)
 {
-  unix_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (unix_stream,
-                                                  G_TYPE_UNIX_INPUT_STREAM,
-                                                  GUnixInputStreamPrivate);
-
+  unix_stream->priv = g_unix_input_stream_get_private (unix_stream);
   unix_stream->priv->fd = -1;
   unix_stream->priv->close_fd = TRUE;
 }
diff --git a/gio/gunixoutputstream.c b/gio/gunixoutputstream.c
index 6baebe9..9d27374 100644
--- a/gio/gunixoutputstream.c
+++ b/gio/gunixoutputstream.c
@@ -63,22 +63,23 @@ enum {
   PROP_CLOSE_FD
 };
 
+struct _GUnixOutputStreamPrivate {
+  int fd;
+  guint close_fd : 1;
+  guint is_pipe_or_socket : 1;
+};
+
 static void g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface);
 static void g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GUnixOutputStream, g_unix_output_stream, G_TYPE_OUTPUT_STREAM,
+                         G_ADD_PRIVATE (GUnixOutputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM,
                                                g_unix_output_stream_pollable_iface_init)
                         G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
                                                g_unix_output_stream_file_descriptor_based_iface_init)
                         )
 
-struct _GUnixOutputStreamPrivate {
-  int fd;
-  guint close_fd : 1;
-  guint is_pipe_or_socket : 1;
-};
-
 static void     g_unix_output_stream_set_property (GObject              *object,
                                                   guint                 prop_id,
                                                   const GValue         *value,
@@ -110,22 +111,13 @@ static GSource *g_unix_output_stream_pollable_create_source (GPollableOutputStre
                                                             GCancellable         *cancellable);
 
 static void
-g_unix_output_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_unix_output_stream_parent_class)->finalize (object);
-}
-
-static void
 g_unix_output_stream_class_init (GUnixOutputStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
-  
-  g_type_class_add_private (klass, sizeof (GUnixOutputStreamPrivate));
 
   gobject_class->get_property = g_unix_output_stream_get_property;
   gobject_class->set_property = g_unix_output_stream_set_property;
-  gobject_class->finalize = g_unix_output_stream_finalize;
 
   stream_class->write_fn = g_unix_output_stream_write;
   stream_class->close_fn = g_unix_output_stream_close;
@@ -231,10 +223,7 @@ g_unix_output_stream_get_property (GObject    *object,
 static void
 g_unix_output_stream_init (GUnixOutputStream *unix_stream)
 {
-  unix_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (unix_stream,
-                                                  G_TYPE_UNIX_OUTPUT_STREAM,
-                                                  GUnixOutputStreamPrivate);
-
+  unix_stream->priv = g_unix_output_stream_get_private (unix_stream);
   unix_stream->priv->fd = -1;
   unix_stream->priv->close_fd = TRUE;
 }
diff --git a/gio/gunixsocketaddress.c b/gio/gunixsocketaddress.c
index 84010e7..1ce1740 100644
--- a/gio/gunixsocketaddress.c
+++ b/gio/gunixsocketaddress.c
@@ -57,7 +57,6 @@
  * A UNIX-domain (local) socket address, corresponding to a
  * <type>struct sockaddr_un</type>.
  */
-G_DEFINE_TYPE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS);
 
 enum
 {
@@ -79,6 +78,8 @@ struct _GUnixSocketAddressPrivate
   GUnixSocketAddressType address_type;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS)
+
 static void
 g_unix_socket_address_set_property (GObject      *object,
                                    guint         prop_id,
@@ -248,8 +249,6 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GSocketAddressClass *gsocketaddress_class = G_SOCKET_ADDRESS_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GUnixSocketAddressPrivate));
-
   gobject_class->set_property = g_unix_socket_address_set_property;
   gobject_class->get_property = g_unix_socket_address_get_property;
 
@@ -305,9 +304,7 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass)
 static void
 g_unix_socket_address_init (GUnixSocketAddress *address)
 {
-  address->priv = G_TYPE_INSTANCE_GET_PRIVATE (address,
-                                              G_TYPE_UNIX_SOCKET_ADDRESS,
-                                              GUnixSocketAddressPrivate);
+  address->priv = g_unix_socket_address_get_private (address);
 
   memset (address->priv->path, 0, sizeof (address->priv->path));
   address->priv->path_len = -1;
diff --git a/gio/gwin32inputstream.c b/gio/gwin32inputstream.c
index 21af468..5ede8d7 100644
--- a/gio/gwin32inputstream.c
+++ b/gio/gwin32inputstream.c
@@ -56,13 +56,13 @@ enum {
   PROP_CLOSE_HANDLE
 };
 
-G_DEFINE_TYPE (GWin32InputStream, g_win32_input_stream, G_TYPE_INPUT_STREAM);
-
 struct _GWin32InputStreamPrivate {
   HANDLE handle;
   gboolean close_handle;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GWin32InputStream, g_win32_input_stream, G_TYPE_INPUT_STREAM)
+
 static void     g_win32_input_stream_set_property (GObject              *object,
                                                   guint                 prop_id,
                                                   const GValue         *value,
@@ -81,22 +81,13 @@ static gboolean g_win32_input_stream_close        (GInputStream         *stream,
                                                   GError              **error);
 
 static void
-g_win32_input_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_win32_input_stream_parent_class)->finalize (object);
-}
-
-static void
 g_win32_input_stream_class_init (GWin32InputStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GWin32InputStreamPrivate));
-
   gobject_class->get_property = g_win32_input_stream_get_property;
   gobject_class->set_property = g_win32_input_stream_set_property;
-  gobject_class->finalize = g_win32_input_stream_finalize;
 
   stream_class->read_fn = g_win32_input_stream_read;
   stream_class->close_fn = g_win32_input_stream_close;
@@ -181,10 +172,7 @@ g_win32_input_stream_get_property (GObject    *object,
 static void
 g_win32_input_stream_init (GWin32InputStream *win32_stream)
 {
-  win32_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (win32_stream,
-                                                   G_TYPE_WIN32_INPUT_STREAM,
-                                                   GWin32InputStreamPrivate);
-
+  win32_stream->priv = g_win32_input_stream_get_private (win32_stream);
   win32_stream->priv->handle = NULL;
   win32_stream->priv->close_handle = TRUE;
 }
diff --git a/gio/gwin32outputstream.c b/gio/gwin32outputstream.c
index 5a6798b..c5c20b9 100644
--- a/gio/gwin32outputstream.c
+++ b/gio/gwin32outputstream.c
@@ -57,14 +57,13 @@ enum {
   PROP_CLOSE_HANDLE
 };
 
-G_DEFINE_TYPE (GWin32OutputStream, g_win32_output_stream, G_TYPE_OUTPUT_STREAM);
-
-
 struct _GWin32OutputStreamPrivate {
   HANDLE handle;
   gboolean close_handle;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GWin32OutputStream, g_win32_output_stream, G_TYPE_OUTPUT_STREAM)
+
 static void     g_win32_output_stream_set_property (GObject              *object,
                                                    guint                 prop_id,
                                                    const GValue         *value,
@@ -84,22 +83,13 @@ static gboolean g_win32_output_stream_close        (GOutputStream        *stream
 
 
 static void
-g_win32_output_stream_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (g_win32_output_stream_parent_class)->finalize (object);
-}
-
-static void
 g_win32_output_stream_class_init (GWin32OutputStreamClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GWin32OutputStreamPrivate));
-
   gobject_class->get_property = g_win32_output_stream_get_property;
   gobject_class->set_property = g_win32_output_stream_set_property;
-  gobject_class->finalize = g_win32_output_stream_finalize;
 
   stream_class->write_fn = g_win32_output_stream_write;
   stream_class->close_fn = g_win32_output_stream_close;
@@ -184,10 +174,7 @@ g_win32_output_stream_get_property (GObject    *object,
 static void
 g_win32_output_stream_init (GWin32OutputStream *win32_stream)
 {
-  win32_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (win32_stream,
-                                                   G_TYPE_WIN32_OUTPUT_STREAM,
-                                                   GWin32OutputStreamPrivate);
-
+  win32_stream->priv = g_win32_output_stream_get_private (win32_stream);
   win32_stream->priv->handle = NULL;
   win32_stream->priv->close_handle = TRUE;
 }



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