[libpeas] Use new GObject private API



commit f0e1e2df26a59eba6b5882bd6503777337837a53
Author: Garrett Regier <garrettregier gmail com>
Date:   Sat Dec 20 10:05:24 2014 -0800

    Use new GObject private API

 configure.ac                                       |    3 +-
 libpeas-gtk/peas-gtk-disable-plugins-dialog.c      |   48 ++++---
 libpeas-gtk/peas-gtk-disable-plugins-dialog.h      |    4 -
 libpeas-gtk/peas-gtk-plugin-manager-store.c        |   44 ++++---
 libpeas-gtk/peas-gtk-plugin-manager-store.h        |    4 -
 libpeas-gtk/peas-gtk-plugin-manager-view.c         |  119 ++++++++++------
 libpeas-gtk/peas-gtk-plugin-manager.c              |  151 +++++++++++---------
 libpeas/peas-engine.c                              |   89 +++++++-----
 libpeas/peas-extension-base.c                      |   24 ++--
 libpeas/peas-extension-set.c                       |  102 ++++++++------
 libpeas/peas-object-module.c                       |  117 +++++++++-------
 libpeas/peas-plugin-loader-c.c                     |   41 +++---
 libpeas/peas-plugin-loader-c.h                     |    3 -
 loaders/lua5.1/peas-plugin-loader-lua.c            |   66 +++++----
 loaders/lua5.1/peas-plugin-loader-lua.h            |    3 -
 loaders/python/peas-plugin-loader-python.c         |   93 +++++++------
 loaders/python/peas-plugin-loader-python.h         |    3 -
 .../plugins/configurable/configurable-plugin.h     |    3 -
 .../plugins/extension-c/extension-c-plugin.h       |    1 -
 tests/plugins/builtin/builtin-plugin.c             |   19 ++--
 tests/plugins/builtin/builtin-plugin.h             |    3 -
 tests/plugins/has-dep/has-dep-plugin.c             |   19 ++--
 tests/plugins/has-dep/has-dep-plugin.h             |    3 -
 tests/plugins/loadable/loadable-plugin.c           |   19 ++--
 tests/plugins/loadable/loadable-plugin.h           |    3 -
 tests/plugins/self-dep/self-dep-plugin.c           |   19 ++--
 tests/plugins/self-dep/self-dep-plugin.h           |    3 -
 27 files changed, 547 insertions(+), 459 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 88c90c3..ff7f09b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,12 +85,13 @@ dnl ================================================================
 PKG_PROG_PKG_CONFIG
 
 GLIB_REQUIRED=2.36.0
+GOBJECT_REQUIRED=2.38.0
 GIO_REQUIRED=2.32.0
 INTROSPECTION_REQUIRED=1.39.0
 
 PKG_CHECK_MODULES(PEAS, [
        glib-2.0 >= $GLIB_REQUIRED
-       gobject-2.0 >= $GLIB_REQUIRED
+       gobject-2.0 >= $GOBJECT_REQUIRED
        gmodule-2.0 >= $GLIB_REQUIRED
        gio-2.0 >= $GIO_REQUIRED
        gobject-introspection-1.0 >= $INTROSPECTION_REQUIRED
diff --git a/libpeas-gtk/peas-gtk-disable-plugins-dialog.c b/libpeas-gtk/peas-gtk-disable-plugins-dialog.c
index 4040394..3bb4bb1 100644
--- a/libpeas-gtk/peas-gtk-disable-plugins-dialog.c
+++ b/libpeas-gtk/peas-gtk-disable-plugins-dialog.c
@@ -32,10 +32,10 @@ enum {
   PLUGIN_INFO_NAME_COLUMN = 0
 };
 
-struct _PeasGtkDisablePluginsDialogPrivate {
+typedef struct {
   PeasPluginInfo *plugin_info;
   GList *dep_plugins;
-};
+} PeasGtkDisablePluginsDialogPrivate;
 
 /* Properties */
 enum {
@@ -47,9 +47,12 @@ enum {
 
 static GParamSpec *properties[N_PROPERTIES] = { NULL };
 
-G_DEFINE_TYPE (PeasGtkDisablePluginsDialog,
-               peas_gtk_disable_plugins_dialog,
-               GTK_TYPE_MESSAGE_DIALOG)
+G_DEFINE_TYPE_WITH_PRIVATE (PeasGtkDisablePluginsDialog,
+                            peas_gtk_disable_plugins_dialog,
+                            GTK_TYPE_MESSAGE_DIALOG)
+
+#define GET_PRIV(o) \
+  (peas_gtk_disable_plugins_dialog_get_instance_private (o))
 
 static gint
 model_name_sort_func (GtkListStore *store,
@@ -79,6 +82,7 @@ model_name_sort_func (GtkListStore *store,
 static void
 build_multiple_dependant_plugins (PeasGtkDisablePluginsDialog *dialog)
 {
+  PeasGtkDisablePluginsDialogPrivate *priv = GET_PRIV (dialog);
   gchar *message;
   GtkWidget *message_area;
   GtkWidget *sw;
@@ -96,7 +100,7 @@ build_multiple_dependant_plugins (PeasGtkDisablePluginsDialog *dialog)
 
   gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
       _("The following plugins depend on '%s' and will also be disabled:"),
-      peas_plugin_info_get_name (dialog->priv->plugin_info));
+      peas_plugin_info_get_name (priv->plugin_info));
 
   message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
 
@@ -117,7 +121,7 @@ build_multiple_dependant_plugins (PeasGtkDisablePluginsDialog *dialog)
                                         GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
                                         GTK_SORT_ASCENDING);
 
-  for (dep_plugin = dialog->priv->dep_plugins; dep_plugin != NULL;
+  for (dep_plugin = priv->dep_plugins; dep_plugin != NULL;
        dep_plugin = dep_plugin->next)
     {
       PeasPluginInfo *plugin = (PeasPluginInfo *) dep_plugin->data;
@@ -150,6 +154,7 @@ build_multiple_dependant_plugins (PeasGtkDisablePluginsDialog *dialog)
 static void
 build_single_dependant_plugin (PeasGtkDisablePluginsDialog *dialog)
 {
+  PeasGtkDisablePluginsDialogPrivate *priv = GET_PRIV (dialog);
   gchar *message;
 
   message = g_strconcat ("<span weight=\"bold\" size=\"larger\">",
@@ -162,19 +167,15 @@ build_single_dependant_plugin (PeasGtkDisablePluginsDialog *dialog)
   gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
       _("The '%s' plugin depends on the '%s' plugin.\n"
         "If you disable '%s', '%s' will also be disabled."),
-      peas_plugin_info_get_name (dialog->priv->plugin_info),
-      peas_plugin_info_get_name (dialog->priv->dep_plugins->data),
-      peas_plugin_info_get_name (dialog->priv->plugin_info),
-      peas_plugin_info_get_name (dialog->priv->dep_plugins->data));
+      peas_plugin_info_get_name (priv->plugin_info),
+      peas_plugin_info_get_name (priv->dep_plugins->data),
+      peas_plugin_info_get_name (priv->plugin_info),
+      peas_plugin_info_get_name (priv->dep_plugins->data));
 }
 
 static void
 peas_gtk_disable_plugins_dialog_init (PeasGtkDisablePluginsDialog *dialog)
 {
-  dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
-                                              PEAS_GTK_TYPE_DISABLE_PLUGINS_DIALOG,
-                                              PeasGtkDisablePluginsDialogPrivate);
-
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
   gtk_dialog_add_button (GTK_DIALOG (dialog),
@@ -190,14 +191,15 @@ peas_gtk_disable_plugins_dialog_set_property (GObject      *object,
                                               GParamSpec   *pspec)
 {
   PeasGtkDisablePluginsDialog *dialog = PEAS_GTK_DISABLE_PLUGINS_DIALOG (object);
+  PeasGtkDisablePluginsDialogPrivate *priv = GET_PRIV (dialog);
 
   switch (prop_id)
     {
     case PROP_PLUGIN_INFO:
-      dialog->priv->plugin_info = g_value_get_pointer (value);
+      priv->plugin_info = g_value_get_pointer (value);
       break;
     case PROP_DEPENDANT_PLUGINS:
-      dialog->priv->dep_plugins = g_value_get_pointer (value);
+      priv->dep_plugins = g_value_get_pointer (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -212,14 +214,15 @@ peas_gtk_disable_plugins_dialog_get_property (GObject    *object,
                                               GParamSpec *pspec)
 {
   PeasGtkDisablePluginsDialog *dialog = PEAS_GTK_DISABLE_PLUGINS_DIALOG (object);
+  PeasGtkDisablePluginsDialogPrivate *priv = GET_PRIV (dialog);
 
   switch (prop_id)
     {
     case PROP_PLUGIN_INFO:
-      g_value_set_pointer (value, dialog->priv->plugin_info);
+      g_value_set_pointer (value, priv->plugin_info);
       break;
     case PROP_DEPENDANT_PLUGINS:
-      g_value_set_pointer (value, dialog->priv->dep_plugins);
+      g_value_set_pointer (value, priv->dep_plugins);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -231,8 +234,9 @@ static void
 peas_gtk_disable_plugins_dialog_constructed (GObject *object)
 {
   PeasGtkDisablePluginsDialog *dialog = PEAS_GTK_DISABLE_PLUGINS_DIALOG (object);
+  PeasGtkDisablePluginsDialogPrivate *priv = GET_PRIV (dialog);
 
-  if (dialog->priv->dep_plugins->next == NULL)
+  if (priv->dep_plugins->next == NULL)
     build_single_dependant_plugin (dialog);
   else
     build_multiple_dependant_plugins (dialog);
@@ -244,8 +248,9 @@ static void
 peas_gtk_disable_plugins_dialog_finalize (GObject *object)
 {
   PeasGtkDisablePluginsDialog *dialog = PEAS_GTK_DISABLE_PLUGINS_DIALOG (object);
+  PeasGtkDisablePluginsDialogPrivate *priv = GET_PRIV (dialog);
 
-  g_list_free (dialog->priv->dep_plugins);
+  g_list_free (priv->dep_plugins);
 
   G_OBJECT_CLASS (peas_gtk_disable_plugins_dialog_parent_class)->finalize (object);
 }
@@ -277,7 +282,6 @@ peas_gtk_disable_plugins_dialog_class_init (PeasGtkDisablePluginsDialogClass *kl
                           G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (object_class, sizeof (PeasGtkDisablePluginsDialogPrivate));
 }
 
 /*
diff --git a/libpeas-gtk/peas-gtk-disable-plugins-dialog.h b/libpeas-gtk/peas-gtk-disable-plugins-dialog.h
index 1c1be03..acc963f 100644
--- a/libpeas-gtk/peas-gtk-disable-plugins-dialog.h
+++ b/libpeas-gtk/peas-gtk-disable-plugins-dialog.h
@@ -39,13 +39,9 @@ G_BEGIN_DECLS
 
 typedef struct _PeasGtkDisablePluginsDialog         PeasGtkDisablePluginsDialog;
 typedef struct _PeasGtkDisablePluginsDialogClass    PeasGtkDisablePluginsDialogClass;
-typedef struct _PeasGtkDisablePluginsDialogPrivate  PeasGtkDisablePluginsDialogPrivate;
 
 struct _PeasGtkDisablePluginsDialog {
   GtkMessageDialog parent;
-
-  /*< private > */
-  PeasGtkDisablePluginsDialogPrivate *priv;
 };
 
 struct _PeasGtkDisablePluginsDialogClass {
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-store.c b/libpeas-gtk/peas-gtk-plugin-manager-store.c
index 125506a..4f53e79 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-store.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-store.c
@@ -46,9 +46,9 @@ static const GType ColumnTypes[] = {
 
 G_STATIC_ASSERT (G_N_ELEMENTS (ColumnTypes) == PEAS_GTK_PLUGIN_MANAGER_STORE_N_COLUMNS);
 
-struct _PeasGtkPluginManagerStorePrivate {
+typedef struct {
   PeasEngine *engine;
-};
+} PeasGtkPluginManagerStorePrivate;
 
 /* Properties */
 enum {
@@ -59,7 +59,12 @@ enum {
 
 static GParamSpec *properties[N_PROPERTIES] = { NULL };
 
-G_DEFINE_TYPE (PeasGtkPluginManagerStore, peas_gtk_plugin_manager_store, GTK_TYPE_LIST_STORE)
+G_DEFINE_TYPE_WITH_PRIVATE (PeasGtkPluginManagerStore,
+                            peas_gtk_plugin_manager_store,
+                            GTK_TYPE_LIST_STORE)
+
+#define GET_PRIV(o) \
+  (peas_gtk_plugin_manager_store_get_instance_private (o))
 
 static void
 update_plugin (PeasGtkPluginManagerStore *store,
@@ -197,10 +202,6 @@ model_name_sort_func (PeasGtkPluginManagerStore *store,
 static void
 peas_gtk_plugin_manager_store_init (PeasGtkPluginManagerStore *store)
 {
-  store->priv = G_TYPE_INSTANCE_GET_PRIVATE (store,
-                                             PEAS_GTK_TYPE_PLUGIN_MANAGER_STORE,
-                                             PeasGtkPluginManagerStorePrivate);
-
   gtk_list_store_set_column_types (GTK_LIST_STORE (store),
                                    PEAS_GTK_PLUGIN_MANAGER_STORE_N_COLUMNS,
                                    (GType *) ColumnTypes);
@@ -221,11 +222,12 @@ peas_gtk_plugin_manager_store_set_property (GObject      *object,
                                             GParamSpec   *pspec)
 {
   PeasGtkPluginManagerStore *store = PEAS_GTK_PLUGIN_MANAGER_STORE (object);
+  PeasGtkPluginManagerStorePrivate *priv = GET_PRIV (store);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      store->priv->engine = g_value_get_object (value);
+      priv->engine = g_value_get_object (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -240,11 +242,12 @@ peas_gtk_plugin_manager_store_get_property (GObject    *object,
                                             GParamSpec *pspec)
 {
   PeasGtkPluginManagerStore *store = PEAS_GTK_PLUGIN_MANAGER_STORE (object);
+  PeasGtkPluginManagerStorePrivate *priv = GET_PRIV (store);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      g_value_set_object (value, store->priv->engine);
+      g_value_set_object (value, priv->engine);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -256,18 +259,19 @@ static void
 peas_gtk_plugin_manager_store_constructed (GObject *object)
 {
   PeasGtkPluginManagerStore *store = PEAS_GTK_PLUGIN_MANAGER_STORE (object);
+  PeasGtkPluginManagerStorePrivate *priv = GET_PRIV (store);
 
-  if (store->priv->engine == NULL)
-    store->priv->engine = peas_engine_get_default ();
+  if (priv->engine == NULL)
+    priv->engine = peas_engine_get_default ();
 
-  g_object_ref (store->priv->engine);
+  g_object_ref (priv->engine);
 
-  g_signal_connect_object (store->priv->engine,
+  g_signal_connect_object (priv->engine,
                            "load-plugin",
                            G_CALLBACK (plugin_loaded_toggled_cb),
                            store,
                            G_CONNECT_AFTER);
-  g_signal_connect_object (store->priv->engine,
+  g_signal_connect_object (priv->engine,
                            "unload-plugin",
                            G_CALLBACK (plugin_loaded_toggled_cb),
                            store,
@@ -282,8 +286,9 @@ static void
 peas_gtk_plugin_manager_store_dispose (GObject *object)
 {
   PeasGtkPluginManagerStore *store = PEAS_GTK_PLUGIN_MANAGER_STORE (object);
+  PeasGtkPluginManagerStorePrivate *priv = GET_PRIV (store);
 
-  g_clear_object (&store->priv->engine);
+  g_clear_object (&priv->engine);
 
   G_OBJECT_CLASS (peas_gtk_plugin_manager_store_parent_class)->dispose (object);
 }
@@ -313,7 +318,6 @@ peas_gtk_plugin_manager_store_class_init (PeasGtkPluginManagerStoreClass *klass)
                          G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (object_class, sizeof (PeasGtkPluginManagerStorePrivate));
 }
 
 /*
@@ -345,6 +349,7 @@ peas_gtk_plugin_manager_store_new (PeasEngine *engine)
 void
 peas_gtk_plugin_manager_store_reload (PeasGtkPluginManagerStore *store)
 {
+  PeasGtkPluginManagerStorePrivate *priv = GET_PRIV (store);
   GtkListStore *list_store;
   const GList *plugins;
   GtkTreeIter iter;
@@ -355,7 +360,7 @@ peas_gtk_plugin_manager_store_reload (PeasGtkPluginManagerStore *store)
 
   gtk_list_store_clear (list_store);
 
-  plugins = peas_engine_get_plugin_list (store->priv->engine);
+  plugins = peas_engine_get_plugin_list (priv->engine);
 
   while (plugins != NULL)
     {
@@ -386,6 +391,7 @@ peas_gtk_plugin_manager_store_set_enabled (PeasGtkPluginManagerStore *store,
                                            GtkTreeIter               *iter,
                                            gboolean                   enabled)
 {
+  PeasGtkPluginManagerStorePrivate *priv = GET_PRIV (store);
   PeasPluginInfo *info;
 
   g_return_if_fail (PEAS_GTK_IS_PLUGIN_MANAGER_STORE (store));
@@ -397,11 +403,11 @@ peas_gtk_plugin_manager_store_set_enabled (PeasGtkPluginManagerStore *store,
 
   if (enabled)
     {
-      peas_engine_load_plugin (store->priv->engine, info);
+      peas_engine_load_plugin (priv->engine, info);
     }
   else
     {
-      peas_engine_unload_plugin (store->priv->engine, info);
+      peas_engine_unload_plugin (priv->engine, info);
     }
 
   /* Don't need to manually update the plugin as
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-store.h b/libpeas-gtk/peas-gtk-plugin-manager-store.h
index ece25f1..5a4723c 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-store.h
+++ b/libpeas-gtk/peas-gtk-plugin-manager-store.h
@@ -55,13 +55,9 @@ typedef enum {
 
 typedef struct _PeasGtkPluginManagerStore         PeasGtkPluginManagerStore;
 typedef struct _PeasGtkPluginManagerStoreClass    PeasGtkPluginManagerStoreClass;
-typedef struct _PeasGtkPluginManagerStorePrivate  PeasGtkPluginManagerStorePrivate;
 
 struct _PeasGtkPluginManagerStore {
   GtkListStore parent;
-
-  /*< private > */
-  PeasGtkPluginManagerStorePrivate *priv;
 };
 
 struct _PeasGtkPluginManagerStoreClass {
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index 3ed2b02..7dcff04 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -79,13 +79,20 @@ enum {
 static guint signals[LAST_SIGNAL];
 static GParamSpec *properties[N_PROPERTIES] = { NULL };
 
-G_DEFINE_TYPE (PeasGtkPluginManagerView, peas_gtk_plugin_manager_view, GTK_TYPE_TREE_VIEW)
+G_DEFINE_TYPE_WITH_PRIVATE (PeasGtkPluginManagerView,
+                            peas_gtk_plugin_manager_view,
+                            GTK_TYPE_TREE_VIEW)
+
+#define GET_PRIV(o) \
+  (peas_gtk_plugin_manager_view_get_instance_private (o))
 
 static void
 convert_iter_to_child_iter (PeasGtkPluginManagerView *view,
                             GtkTreeIter              *iter)
 {
-  if (!view->priv->show_builtin)
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
+
+  if (!priv->show_builtin)
     {
       GtkTreeModel *model;
       GtkTreeIter child_iter;
@@ -103,9 +110,10 @@ static gboolean
 convert_child_iter_to_iter (PeasGtkPluginManagerView *view,
                             GtkTreeIter              *child_iter)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   gboolean success = TRUE;
 
-  if (!view->priv->show_builtin)
+  if (!priv->show_builtin)
     {
       GtkTreeModel *model;
       GtkTreeIter iter;
@@ -126,12 +134,13 @@ static GList *
 get_dependant_plugins (PeasGtkPluginManagerView *view,
                        PeasPluginInfo           *info)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   const gchar *module_name;
   const GList *plugins;
   GList *dep_plugins = NULL;
 
   module_name = peas_plugin_info_get_module_name (info);
-  plugins = peas_engine_get_plugin_list (view->priv->engine);
+  plugins = peas_engine_get_plugin_list (priv->engine);
 
   for (; plugins != NULL; plugins = plugins->next)
     {
@@ -142,7 +151,7 @@ get_dependant_plugins (PeasGtkPluginManagerView *view,
         continue;
 
       /* Don't add builtin plugins if they are not shown */
-      if (!view->priv->show_builtin && peas_plugin_info_is_builtin (plugin))
+      if (!priv->show_builtin && peas_plugin_info_is_builtin (plugin))
         continue;
 
       if (peas_plugin_info_has_dependency (plugin, module_name))
@@ -156,9 +165,10 @@ static void
 toggle_enabled (PeasGtkPluginManagerView *view,
                 GtkTreeIter              *iter)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   PeasPluginInfo *info;
 
-  info = peas_gtk_plugin_manager_store_get_plugin (view->priv->store, iter);
+  info = peas_gtk_plugin_manager_store_get_plugin (priv->store, iter);
 
   if (peas_plugin_info_is_loaded (info))
     {
@@ -187,7 +197,7 @@ toggle_enabled (PeasGtkPluginManagerView *view,
         }
     }
 
-  peas_gtk_plugin_manager_store_toggle_enabled (view->priv->store, iter);
+  peas_gtk_plugin_manager_store_toggle_enabled (priv->store, iter);
 }
 
 static void
@@ -195,11 +205,12 @@ plugin_list_changed_cb (PeasEngine               *engine,
                         GParamSpec               *pspec,
                         PeasGtkPluginManagerView *view)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   PeasPluginInfo *info;
 
   info = peas_gtk_plugin_manager_view_get_selected_plugin (view);
 
-  peas_gtk_plugin_manager_store_reload (view->priv->store);
+  peas_gtk_plugin_manager_store_reload (priv->store);
 
   if (info != NULL)
     peas_gtk_plugin_manager_view_set_selected_plugin (view, info);
@@ -210,10 +221,11 @@ filter_builtins_visible (PeasGtkPluginManagerStore *store,
                          GtkTreeIter               *iter,
                          PeasGtkPluginManagerView  *view)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   PeasPluginInfo *info;
 
   /* We never filter showing builtins */
-  g_assert (view->priv->show_builtin == FALSE);
+  g_assert (priv->show_builtin == FALSE);
 
   info = peas_gtk_plugin_manager_store_get_plugin (store, iter);
 
@@ -252,6 +264,7 @@ name_search_cb (GtkTreeModel             *model,
                 GtkTreeIter              *iter,
                 PeasGtkPluginManagerView *view)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   GtkTreeIter child_iter = *iter;
   PeasPluginInfo *info;
   gchar *normalized_string;
@@ -262,7 +275,7 @@ name_search_cb (GtkTreeModel             *model,
   gboolean retval;
 
   convert_iter_to_child_iter (view, &child_iter);
-  info = peas_gtk_plugin_manager_store_get_plugin (view->priv->store, &child_iter);
+  info = peas_gtk_plugin_manager_store_get_plugin (priv->store, &child_iter);
 
   if (info == NULL)
     return FALSE;
@@ -307,14 +320,18 @@ static void
 enable_all_menu_cb (GtkMenu                  *menu,
                     PeasGtkPluginManagerView *view)
 {
-  peas_gtk_plugin_manager_store_set_all_enabled (view->priv->store, TRUE);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
+
+  peas_gtk_plugin_manager_store_set_all_enabled (priv->store, TRUE);
 }
 
 static void
 disable_all_menu_cb (GtkMenu                  *menu,
                      PeasGtkPluginManagerView *view)
 {
-  peas_gtk_plugin_manager_store_set_all_enabled (view->priv->store, FALSE);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
+
+  peas_gtk_plugin_manager_store_set_all_enabled (priv->store, FALSE);
 }
 
 static GtkWidget *
@@ -361,7 +378,9 @@ static void
 popup_menu_detach (PeasGtkPluginManagerView *view,
                    GtkMenu                  *menu)
 {
-  view->priv->popup_menu = NULL;
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
+
+  priv->popup_menu = NULL;
 }
 
 static void
@@ -433,30 +452,32 @@ show_popup_menu (GtkTreeView              *tree_view,
                  PeasGtkPluginManagerView *view,
                  GdkEventButton           *event)
 {
-  if (view->priv->popup_menu)
-    gtk_widget_destroy (view->priv->popup_menu);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
+
+  if (priv->popup_menu)
+    gtk_widget_destroy (priv->popup_menu);
 
-  view->priv->popup_menu = create_popup_menu (view);
+  priv->popup_menu = create_popup_menu (view);
 
-  if (view->priv->popup_menu == NULL)
+  if (priv->popup_menu == NULL)
     return FALSE;
 
-  gtk_menu_attach_to_widget (GTK_MENU (view->priv->popup_menu),
+  gtk_menu_attach_to_widget (GTK_MENU (priv->popup_menu),
                              GTK_WIDGET (view),
                              (GtkMenuDetachFunc) popup_menu_detach);
 
   if (event != NULL)
     {
-      gtk_menu_popup (GTK_MENU (view->priv->popup_menu), NULL, NULL,
+      gtk_menu_popup (GTK_MENU (priv->popup_menu), NULL, NULL,
                       NULL, NULL, event->button, event->time);
     }
   else
     {
-      gtk_menu_popup (GTK_MENU (view->priv->popup_menu), NULL, NULL,
+      gtk_menu_popup (GTK_MENU (priv->popup_menu), NULL, NULL,
                       (GtkMenuPositionFunc) menu_position_under_tree_view,
                       view, 0, gtk_get_current_event_time ());
 
-      gtk_menu_shell_select_first (GTK_MENU_SHELL (view->priv->popup_menu),
+      gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->popup_menu),
                                    FALSE);
     }
 
@@ -496,10 +517,6 @@ peas_gtk_plugin_manager_view_init (PeasGtkPluginManagerView *view)
   GtkTreeViewColumn *column;
   GtkCellRenderer *cell;
 
-  view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view,
-                                            PEAS_GTK_TYPE_PLUGIN_MANAGER_VIEW,
-                                            PeasGtkPluginManagerViewPrivate);
-
   gtk_widget_set_has_tooltip (GTK_WIDGET (view), TRUE);
 
   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
@@ -592,6 +609,7 @@ peas_gtk_plugin_manager_view_query_tooltip (GtkWidget  *widget,
                                             GtkTooltip *tooltip)
 {
   PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (widget);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   gboolean is_row;
   GtkTreeIter iter;
   PeasPluginInfo *info;
@@ -607,7 +625,7 @@ peas_gtk_plugin_manager_view_query_tooltip (GtkWidget  *widget,
 
   convert_iter_to_child_iter (view, &iter);
 
-  info = peas_gtk_plugin_manager_store_get_plugin (view->priv->store, &iter);
+  info = peas_gtk_plugin_manager_store_get_plugin (priv->store, &iter);
 
   if (peas_plugin_info_is_available (info, &error))
     return FALSE;
@@ -636,6 +654,7 @@ peas_gtk_plugin_manager_view_row_activated (GtkTreeView       *tree_view,
                                             GtkTreeViewColumn *column)
 {
   PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (tree_view);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   GtkTreeIter iter;
 
   if (!gtk_tree_model_get_iter (gtk_tree_view_get_model (tree_view), &iter, path))
@@ -643,7 +662,7 @@ peas_gtk_plugin_manager_view_row_activated (GtkTreeView       *tree_view,
 
   convert_iter_to_child_iter (view, &iter);
 
-  if (peas_gtk_plugin_manager_store_can_enable (view->priv->store, &iter))
+  if (peas_gtk_plugin_manager_store_can_enable (priv->store, &iter))
     toggle_enabled (view, &iter);
 }
 
@@ -654,11 +673,12 @@ peas_gtk_plugin_manager_view_set_property (GObject      *object,
                                            GParamSpec   *pspec)
 {
   PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (object);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      view->priv->engine = g_value_get_object (value);
+      priv->engine = g_value_get_object (value);
       break;
     case PROP_SHOW_BUILTIN:
       peas_gtk_plugin_manager_view_set_show_builtin (view,
@@ -677,11 +697,12 @@ peas_gtk_plugin_manager_view_get_property (GObject    *object,
                                            GParamSpec *pspec)
 {
   PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (object);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      g_value_set_object (value, view->priv->engine);
+      g_value_set_object (value, priv->engine);
       break;
     case PROP_SHOW_BUILTIN:
       g_value_set_boolean (value,
@@ -697,19 +718,20 @@ static void
 peas_gtk_plugin_manager_view_constructed (GObject *object)
 {
   PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (object);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
 
-  if (view->priv->engine == NULL)
-    view->priv->engine = peas_engine_get_default ();
+  if (priv->engine == NULL)
+    priv->engine = peas_engine_get_default ();
 
-  g_object_ref (view->priv->engine);
+  g_object_ref (priv->engine);
 
-  view->priv->store = peas_gtk_plugin_manager_store_new (view->priv->engine);
+  priv->store = peas_gtk_plugin_manager_store_new (priv->engine);
 
   /* Properly set the model */
-  view->priv->show_builtin = TRUE;
+  priv->show_builtin = TRUE;
   peas_gtk_plugin_manager_view_set_show_builtin (view, FALSE);
 
-  g_signal_connect_object (view->priv->engine,
+  g_signal_connect_object (priv->engine,
                            "notify::plugin-list",
                            G_CALLBACK (plugin_list_changed_cb),
                            view,
@@ -722,12 +744,13 @@ static void
 peas_gtk_plugin_manager_view_dispose (GObject *object)
 {
   PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (object);
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
 
-  g_clear_pointer (&view->priv->popup_menu,
+  g_clear_pointer (&priv->popup_menu,
                    (GDestroyNotify) gtk_widget_destroy);
 
-  g_clear_object (&view->priv->engine);
-  g_clear_object (&view->priv->store);
+  g_clear_object (&priv->engine);
+  g_clear_object (&priv->store);
 
   G_OBJECT_CLASS (peas_gtk_plugin_manager_view_parent_class)->dispose (object);
 }
@@ -802,7 +825,6 @@ peas_gtk_plugin_manager_view_class_init (PeasGtkPluginManagerViewClass *klass)
                   GTK_TYPE_MENU);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (object_class, sizeof (PeasGtkPluginManagerViewPrivate));
 }
 
 /**
@@ -838,6 +860,7 @@ void
 peas_gtk_plugin_manager_view_set_show_builtin (PeasGtkPluginManagerView *view,
                                                gboolean                  show_builtin)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   GtkTreeSelection *selection;
   GtkTreeIter iter;
   gboolean iter_set;
@@ -846,7 +869,7 @@ peas_gtk_plugin_manager_view_set_show_builtin (PeasGtkPluginManagerView *view,
 
   show_builtin = (show_builtin != FALSE);
 
-  if (view->priv->show_builtin == show_builtin)
+  if (priv->show_builtin == show_builtin)
     return;
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
@@ -858,18 +881,18 @@ peas_gtk_plugin_manager_view_set_show_builtin (PeasGtkPluginManagerView *view,
   if (iter_set)
     convert_iter_to_child_iter (view, &iter);
 
-  view->priv->show_builtin = show_builtin;
+  priv->show_builtin = show_builtin;
 
   if (show_builtin)
     {
       gtk_tree_view_set_model (GTK_TREE_VIEW (view),
-                               GTK_TREE_MODEL (view->priv->store));
+                               GTK_TREE_MODEL (priv->store));
     }
   else
     {
       GtkTreeModel *model;
 
-      model = gtk_tree_model_filter_new (GTK_TREE_MODEL (view->priv->store), NULL);
+      model = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store), NULL);
       gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (model),
                                               (GtkTreeModelFilterVisibleFunc) filter_builtins_visible,
                                               view,
@@ -900,9 +923,11 @@ peas_gtk_plugin_manager_view_set_show_builtin (PeasGtkPluginManagerView *view,
 gboolean
 peas_gtk_plugin_manager_view_get_show_builtin (PeasGtkPluginManagerView *view)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
+
   g_return_val_if_fail (PEAS_GTK_IS_PLUGIN_MANAGER_VIEW (view), FALSE);
 
-  return view->priv->show_builtin;
+  return priv->show_builtin;
 }
 
 /**
@@ -916,13 +941,14 @@ void
 peas_gtk_plugin_manager_view_set_selected_plugin (PeasGtkPluginManagerView *view,
                                                   PeasPluginInfo           *info)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   GtkTreeIter iter;
   GtkTreeSelection *selection;
 
   g_return_if_fail (PEAS_GTK_IS_PLUGIN_MANAGER_VIEW (view));
   g_return_if_fail (info != NULL);
 
-  g_return_if_fail (peas_gtk_plugin_manager_store_get_iter_from_plugin (view->priv->store,
+  g_return_if_fail (peas_gtk_plugin_manager_store_get_iter_from_plugin (priv->store,
                                                                         &iter, info));
 
   if (!convert_child_iter_to_iter (view, &iter))
@@ -943,6 +969,7 @@ peas_gtk_plugin_manager_view_set_selected_plugin (PeasGtkPluginManagerView *view
 PeasPluginInfo *
 peas_gtk_plugin_manager_view_get_selected_plugin (PeasGtkPluginManagerView *view)
 {
+  PeasGtkPluginManagerViewPrivate *priv = GET_PRIV (view);
   GtkTreeSelection *selection;
   GtkTreeIter iter;
   PeasPluginInfo *info = NULL;
@@ -958,7 +985,7 @@ peas_gtk_plugin_manager_view_get_selected_plugin (PeasGtkPluginManagerView *view
   if (selection != NULL && gtk_tree_selection_get_selected (selection, NULL, &iter))
     {
       convert_iter_to_child_iter (view, &iter);
-      info = peas_gtk_plugin_manager_store_get_plugin (view->priv->store, &iter);
+      info = peas_gtk_plugin_manager_store_get_plugin (priv->store, &iter);
     }
 
   return info;
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.c b/libpeas-gtk/peas-gtk-plugin-manager.c
index 67496a1..3ebdff2 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager.c
@@ -79,7 +79,9 @@ enum {
 
 static GParamSpec *properties[N_PROPERTIES] = { NULL };
 
-G_DEFINE_TYPE (PeasGtkPluginManager, peas_gtk_plugin_manager, GTK_TYPE_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE (PeasGtkPluginManager,
+                            peas_gtk_plugin_manager,
+                            GTK_TYPE_BOX)
 
 static GtkWindow *
 get_toplevel (GtkWidget *widget)
@@ -107,11 +109,12 @@ static gboolean
 plugin_is_configurable (PeasGtkPluginManager *pm,
                         PeasPluginInfo       *info)
 {
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
+
   if (info == NULL || !peas_plugin_info_is_loaded (info))
     return FALSE;
 
-  return peas_engine_provides_extension (pm->priv->engine,
-                                         info,
+  return peas_engine_provides_extension (priv->engine, info,
                                          PEAS_GTK_TYPE_CONFIGURABLE);
 }
 
@@ -119,8 +122,10 @@ static void
 update_button_sensitivity (PeasGtkPluginManager *pm,
                            PeasPluginInfo       *info)
 {
-  gtk_widget_set_sensitive (pm->priv->about_button, info != NULL);
-  gtk_widget_set_sensitive (pm->priv->configure_button,
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
+
+  gtk_widget_set_sensitive (priv->about_button, info != NULL);
+  gtk_widget_set_sensitive (priv->configure_button,
                             plugin_is_configurable (pm, info));
 }
 
@@ -128,12 +133,13 @@ static void
 show_about_cb (GtkWidget            *widget,
                PeasGtkPluginManager *pm)
 {
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
   PeasGtkPluginManagerView *view;
   PeasPluginInfo *info;
   GtkWindow *toplevel;
   gboolean modal;
 
-  view = PEAS_GTK_PLUGIN_MANAGER_VIEW (pm->priv->view);
+  view = PEAS_GTK_PLUGIN_MANAGER_VIEW (priv->view);
 
   info = peas_gtk_plugin_manager_view_get_selected_plugin (view);
   g_return_if_fail (info != NULL);
@@ -142,31 +148,31 @@ show_about_cb (GtkWidget            *widget,
   modal = toplevel == NULL ? FALSE : gtk_window_get_modal (toplevel);
 
   /* If there is another about dialog already open destroy it */
-  g_clear_pointer (&pm->priv->about, (GDestroyNotify) gtk_widget_destroy);
-
-  pm->priv->about = GTK_WIDGET (g_object_new (GTK_TYPE_ABOUT_DIALOG,
-                                              "program-name", peas_plugin_info_get_name (info),
-                                              "copyright", peas_plugin_info_get_copyright (info),
-                                              "authors", peas_plugin_info_get_authors (info),
-                                              "comments", peas_plugin_info_get_description (info),
-                                              "website", peas_plugin_info_get_website (info),
-                                              "logo-icon-name", peas_plugin_info_get_icon_name (info),
-                                              "version", peas_plugin_info_get_version (info),
-                                              "destroy-with-parent", TRUE,
-                                              "transient-for", toplevel,
-                                              "modal", modal,
-                                              NULL));
-
-  g_signal_connect (pm->priv->about,
+  g_clear_pointer (&priv->about, (GDestroyNotify) gtk_widget_destroy);
+
+  priv->about = GTK_WIDGET (g_object_new (GTK_TYPE_ABOUT_DIALOG,
+                                          "program-name", peas_plugin_info_get_name (info),
+                                          "copyright", peas_plugin_info_get_copyright (info),
+                                          "authors", peas_plugin_info_get_authors (info),
+                                          "comments", peas_plugin_info_get_description (info),
+                                          "website", peas_plugin_info_get_website (info),
+                                          "logo-icon-name", peas_plugin_info_get_icon_name (info),
+                                          "version", peas_plugin_info_get_version (info),
+                                          "destroy-with-parent", TRUE,
+                                          "transient-for", toplevel,
+                                          "modal", modal,
+                                          NULL));
+
+  g_signal_connect (priv->about,
                     "response",
                     G_CALLBACK (gtk_widget_destroy),
                     NULL);
-  g_signal_connect (pm->priv->about,
+  g_signal_connect (priv->about,
                     "destroy",
                     G_CALLBACK (gtk_widget_destroyed),
-                    &pm->priv->about);
+                    &priv->about);
 
-  gtk_widget_show (pm->priv->about);
+  gtk_widget_show (priv->about);
 }
 
 static void
@@ -218,17 +224,20 @@ static void
 show_configure_cb (GtkWidget            *widget,
                    PeasGtkPluginManager *pm)
 {
-  PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (pm->priv->view);
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
+  PeasGtkPluginManagerView *view;
   PeasPluginInfo *info;
   PeasExtension *exten;
   GtkWidget *conf_widget = NULL;
   GtkWidget *conf_dlg;
   GtkWidget *vbox;
 
+  view = PEAS_GTK_PLUGIN_MANAGER_VIEW (priv->view);
+
   info = peas_gtk_plugin_manager_view_get_selected_plugin (view);
   g_return_if_fail (info != NULL);
 
-  exten = peas_engine_create_extension (pm->priv->engine, info, PEAS_GTK_TYPE_CONFIGURABLE, NULL);
+  exten = peas_engine_create_extension (priv->engine, info, PEAS_GTK_TYPE_CONFIGURABLE, NULL);
   g_return_if_fail (PEAS_IS_EXTENSION (exten));
 
   conf_widget = peas_gtk_configurable_create_configure_widget (PEAS_GTK_CONFIGURABLE (exten));
@@ -274,10 +283,11 @@ plugin_loaded_toggled_cb (PeasEngine           *engine,
                           PeasPluginInfo       *info,
                           PeasGtkPluginManager *pm)
 {
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
   PeasGtkPluginManagerView *view;
   PeasPluginInfo *selected;
 
-  view = PEAS_GTK_PLUGIN_MANAGER_VIEW (pm->priv->view);
+  view = PEAS_GTK_PLUGIN_MANAGER_VIEW (priv->view);
   selected = peas_gtk_plugin_manager_view_get_selected_plugin (view);
 
   if (selected == info)
@@ -287,10 +297,11 @@ plugin_loaded_toggled_cb (PeasEngine           *engine,
 static void
 selection_changed_cb (PeasGtkPluginManager *pm)
 {
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
   PeasGtkPluginManagerView *view;
   PeasPluginInfo *info;
 
-  view = PEAS_GTK_PLUGIN_MANAGER_VIEW (pm->priv->view);
+  view = PEAS_GTK_PLUGIN_MANAGER_VIEW (priv->view);
   info = peas_gtk_plugin_manager_view_get_selected_plugin (view);
 
   update_button_sensitivity (pm, info);
@@ -322,16 +333,13 @@ populate_popup_cb (PeasGtkPluginManagerView *view,
 static void
 peas_gtk_plugin_manager_init (PeasGtkPluginManager *pm)
 {
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
   GtkWidget *toolbar;
   GtkStyleContext *context;
   GtkToolItem *toolitem;
   GtkWidget *toolbar_box;
   GtkWidget *item_box;
 
-  pm->priv = G_TYPE_INSTANCE_GET_PRIVATE (pm,
-                                          PEAS_GTK_TYPE_PLUGIN_MANAGER,
-                                          PeasGtkPluginManagerPrivate);
-
   /* If we are using a PeasGtkPluginManager, we know for sure we will be using
      libpeas-gtk, so let's load the typelib for it here. */
   g_irepository_require (g_irepository_get_default (),
@@ -340,14 +348,14 @@ peas_gtk_plugin_manager_init (PeasGtkPluginManager *pm)
   gtk_orientable_set_orientation (GTK_ORIENTABLE (pm),
                                   GTK_ORIENTATION_VERTICAL);
 
-  pm->priv->sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (pm->priv->sw),
+  priv->sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->sw),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (pm->priv->sw),
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->sw),
                                        GTK_SHADOW_IN);
-  context = gtk_widget_get_style_context (pm->priv->sw);
+  context = gtk_widget_get_style_context (priv->sw);
   gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-  gtk_box_pack_start (GTK_BOX (pm), pm->priv->sw, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (pm), priv->sw, TRUE, TRUE, 0);
 
   toolbar = gtk_toolbar_new ();
   gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
@@ -368,26 +376,26 @@ peas_gtk_plugin_manager_init (PeasGtkPluginManager *pm)
   item_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_box_pack_end (GTK_BOX (toolbar_box), item_box, FALSE, FALSE, 0);
 
-  pm->priv->about_button = gtk_button_new_with_mnemonic (_("_About"));
-  gtk_box_pack_start (GTK_BOX (item_box), pm->priv->about_button,
+  priv->about_button = gtk_button_new_with_mnemonic (_("_About"));
+  gtk_box_pack_start (GTK_BOX (item_box), priv->about_button,
                       FALSE, FALSE, 0);
 
   /* we need another box to disable css grouping */
   item_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_box_pack_end (GTK_BOX (toolbar_box), item_box, FALSE, FALSE, 0);
 
-  pm->priv->configure_button = gtk_button_new_with_mnemonic (_("_Preferences"));
-  gtk_box_pack_start (GTK_BOX (item_box), pm->priv->configure_button,
+  priv->configure_button = gtk_button_new_with_mnemonic (_("_Preferences"));
+  gtk_box_pack_start (GTK_BOX (item_box), priv->configure_button,
                       FALSE, FALSE, 0);
 
   /* setup a window of a sane size. */
-  gtk_widget_set_size_request (GTK_WIDGET (pm->priv->sw), 270, 100);
+  gtk_widget_set_size_request (GTK_WIDGET (priv->sw), 270, 100);
 
-  g_signal_connect (pm->priv->about_button,
+  g_signal_connect (priv->about_button,
                     "clicked",
                     G_CALLBACK (show_about_cb),
                     pm);
-  g_signal_connect (pm->priv->configure_button,
+  g_signal_connect (priv->configure_button,
                     "clicked",
                     G_CALLBACK (show_configure_cb),
                     pm);
@@ -400,14 +408,15 @@ peas_gtk_plugin_manager_set_property (GObject      *object,
                                       GParamSpec   *pspec)
 {
   PeasGtkPluginManager *pm = PEAS_GTK_PLUGIN_MANAGER (object);
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      pm->priv->engine = g_value_get_object (value);
+      priv->engine = g_value_get_object (value);
       break;
     case PROP_VIEW:
-      pm->priv->view = g_value_get_object (value);
+      priv->view = g_value_get_object (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -422,11 +431,12 @@ peas_gtk_plugin_manager_get_property (GObject    *object,
                                       GParamSpec *pspec)
 {
   PeasGtkPluginManager *pm = PEAS_GTK_PLUGIN_MANAGER (object);
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      g_value_set_object (value, pm->priv->engine);
+      g_value_set_object (value, priv->engine);
       break;
     case PROP_VIEW:
       g_value_set_object (value, peas_gtk_plugin_manager_get_view (pm));
@@ -441,65 +451,66 @@ static void
 peas_gtk_plugin_manager_constructed (GObject *object)
 {
   PeasGtkPluginManager *pm = PEAS_GTK_PLUGIN_MANAGER (object);
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
   GtkTreeSelection *selection;
 
-  if (pm->priv->engine == NULL)
-    pm->priv->engine = peas_engine_get_default ();
+  if (priv->engine == NULL)
+    priv->engine = peas_engine_get_default ();
 
-  g_object_ref (pm->priv->engine);
+  g_object_ref (priv->engine);
 
   /* When we create the manager, we always rescan the plugins directory
    * Must come after the view has connected to notify::plugin-list
    */
-  peas_engine_rescan_plugins (pm->priv->engine);
+  peas_engine_rescan_plugins (priv->engine);
 
   /* For the view to behave as expected, we must ensure it uses the same
    * engine as the manager itself.
    */
-  if (pm->priv->view != NULL)
+  if (priv->view != NULL)
     {
       PeasEngine *engine;
 
-      g_object_get (pm->priv->view,
+      g_object_get (priv->view,
                     "engine", &engine,
                     NULL);
 
-      g_warn_if_fail (engine == pm->priv->engine);
+      g_warn_if_fail (engine == priv->engine);
 
-      if (engine != pm->priv->engine)
-        g_clear_object (&pm->priv->view);
+      if (engine != priv->engine)
+        g_clear_object (&priv->view);
 
       g_object_unref (engine);
     }
 
-  if (pm->priv->view == NULL)
-    pm->priv->view = peas_gtk_plugin_manager_view_new (pm->priv->engine);
+  if (priv->view == NULL)
+    priv->view = peas_gtk_plugin_manager_view_new (priv->engine);
 
-  gtk_container_add (GTK_CONTAINER (pm->priv->sw), pm->priv->view);
+  gtk_container_add (GTK_CONTAINER (priv->sw), priv->view);
 
-  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pm->priv->view));
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->view));
 
   g_signal_connect_object (selection,
                            "changed",
                            G_CALLBACK (selection_changed_cb),
                            pm,
                            G_CONNECT_SWAPPED);
-  g_signal_connect_object (pm->priv->view,
+  g_signal_connect_object (priv->view,
                            "cursor-changed",
                            G_CALLBACK (selection_changed_cb),
                            pm,
                            G_CONNECT_SWAPPED);
-  g_signal_connect_object (pm->priv->view,
+  g_signal_connect_object (priv->view,
                            "populate-popup",
                            G_CALLBACK (populate_popup_cb),
                            pm,
                            0);
-  g_signal_connect_object (pm->priv->engine,
+  g_signal_connect_object (priv->engine,
                            "load-plugin",
                            G_CALLBACK (plugin_loaded_toggled_cb),
                            pm,
                            G_CONNECT_AFTER);
-  g_signal_connect_object (pm->priv->engine,
+  g_signal_connect_object (priv->engine,
                            "unload-plugin",
                            G_CALLBACK (plugin_loaded_toggled_cb),
                            pm,
@@ -515,9 +526,10 @@ static void
 peas_gtk_plugin_manager_dispose (GObject *object)
 {
   PeasGtkPluginManager *pm = PEAS_GTK_PLUGIN_MANAGER (object);
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
 
-  g_clear_object (&pm->priv->engine);
-  g_clear_pointer (&pm->priv->about, (GDestroyNotify) gtk_widget_destroy);
+  g_clear_object (&priv->engine);
+  g_clear_pointer (&priv->about, (GDestroyNotify) gtk_widget_destroy);
 
   G_OBJECT_CLASS (peas_gtk_plugin_manager_parent_class)->dispose (object);
 }
@@ -561,7 +573,6 @@ peas_gtk_plugin_manager_class_init (PeasGtkPluginManagerClass *klass)
                          G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (object_class, sizeof (PeasGtkPluginManagerPrivate));
 }
 
 /**
@@ -595,7 +606,9 @@ peas_gtk_plugin_manager_new (PeasEngine *engine)
 GtkWidget *
 peas_gtk_plugin_manager_get_view (PeasGtkPluginManager *pm)
 {
+  PeasGtkPluginManagerPrivate *priv = peas_gtk_plugin_manager_get_instance_private (pm);
+
   g_return_val_if_fail (PEAS_GTK_IS_PLUGIN_MANAGER (pm), NULL);
 
-  return pm->priv->view;
+  return priv->view;
 }
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 328acee..54a0f46 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -58,7 +58,6 @@
  *   </listitem>
  * </itemizedlist>
  **/
-G_DEFINE_TYPE (PeasEngine, peas_engine, G_TYPE_OBJECT)
 
 /* Signals */
 enum {
@@ -109,6 +108,11 @@ struct _PeasEnginePrivate {
   guint use_nonglobal_loaders : 1;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (PeasEngine, peas_engine, G_TYPE_OBJECT)
+
+#define GET_PRIV(o) \
+  (peas_engine_get_instance_private (o))
+
 static gboolean shutdown = FALSE;
 static PeasEngine *default_engine = NULL;
 
@@ -126,6 +130,7 @@ load_plugin_info (PeasEngine  *engine,
                   const gchar *module_dir,
                   const gchar *data_dir)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   PeasPluginInfo *info;
   const gchar *module_name;
 
@@ -143,11 +148,12 @@ load_plugin_info (PeasEngine  *engine,
    * drop this one (user plugins override system plugins) */
   module_name = peas_plugin_info_get_module_name (info);
   if (peas_engine_get_plugin_info (engine, module_name) != NULL)
-    _peas_plugin_info_unref (info);
+    {
+      _peas_plugin_info_unref (info);
+    }
   else
     {
-      engine->priv->plugin_list = g_list_prepend (engine->priv->plugin_list,
-                                                  info);
+      priv->plugin_list = g_list_prepend (priv->plugin_list, info);
 
       g_object_notify_by_pspec (G_OBJECT (engine),
                                 properties[PROP_PLUGIN_LIST]);
@@ -208,11 +214,12 @@ load_dir_real (PeasEngine  *engine,
 void
 peas_engine_rescan_plugins (PeasEngine *engine)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GList *item;
 
   g_return_if_fail (PEAS_IS_ENGINE (engine));
 
-  if (engine->priv->search_paths == NULL)
+  if (priv->search_paths == NULL)
     {
       g_debug ("No search paths where provided");
       return;
@@ -221,7 +228,7 @@ peas_engine_rescan_plugins (PeasEngine *engine)
   g_object_freeze_notify (G_OBJECT (engine));
 
   /* Go and read everything from the provided search paths */
-  for (item = engine->priv->search_paths; item != NULL; item = item->next)
+  for (item = priv->search_paths; item != NULL; item = item->next)
     {
       SearchPath *sp = (SearchPath *) item->data;
       load_dir_real (engine, sp->module_dir, sp->data_dir, 1);
@@ -236,6 +243,7 @@ peas_engine_insert_search_path (PeasEngine  *engine,
                                 const gchar *module_dir,
                                 const gchar *data_dir)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   SearchPath *sp;
 
   g_return_if_fail (PEAS_IS_ENGINE (engine));
@@ -245,9 +253,7 @@ peas_engine_insert_search_path (PeasEngine  *engine,
   sp->module_dir = g_strdup (module_dir);
   sp->data_dir = g_strdup (data_dir ? data_dir : module_dir);
 
-  engine->priv->search_paths = g_list_insert (engine->priv->search_paths,
-                                              sp,
-                                              position);
+  priv->search_paths = g_list_insert (priv->search_paths, sp, position);
 
   g_object_freeze_notify (G_OBJECT (engine));
   load_dir_real (engine, sp->module_dir, sp->data_dir, 1);
@@ -317,6 +323,8 @@ default_engine_weak_notify (gpointer    unused,
 static void
 peas_engine_init (PeasEngine *engine)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
+
   /* Set the default engine here and not in constructor() to make sure
    * that if a plugin is loaded and calls peas_engine_get_default()
    * that this engine is returned and not another.
@@ -332,14 +340,10 @@ peas_engine_init (PeasEngine *engine)
                          NULL);
     }
 
-  engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
-                                              PEAS_TYPE_ENGINE,
-                                              PeasEnginePrivate);
-
-  engine->priv->in_dispose = FALSE;
+  priv->in_dispose = FALSE;
 
   /* The C plugin loader is always enabled */
-  engine->priv->loaders[peas_utils_get_loader_id ("C")].enabled = TRUE;
+  priv->loaders[peas_utils_get_loader_id ("C")].enabled = TRUE;
 }
 
 /**
@@ -354,13 +358,14 @@ peas_engine_init (PeasEngine *engine)
 void
 peas_engine_garbage_collect (PeasEngine *engine)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   gint i;
 
   g_return_if_fail (PEAS_IS_ENGINE (engine));
 
   for (i = 0; i < G_N_ELEMENTS (loaders); ++i)
     {
-      LoaderInfo *loader_info = &engine->priv->loaders[i];
+      LoaderInfo *loader_info = &priv->loaders[i];
 
       if (loader_info->loader != NULL)
         peas_plugin_loader_garbage_collect (loader_info->loader);
@@ -400,6 +405,7 @@ peas_engine_set_property (GObject      *object,
                           GParamSpec   *pspec)
 {
   PeasEngine *engine = PEAS_ENGINE (object);
+  PeasEnginePrivate *priv = GET_PRIV (engine);
 
   switch (prop_id)
     {
@@ -408,7 +414,7 @@ peas_engine_set_property (GObject      *object,
                                       (const gchar **) g_value_get_boxed (value));
       break;
     case PROP_NONGLOBAL_LOADERS:
-      engine->priv->use_nonglobal_loaders = g_value_get_boolean (value);
+      priv->use_nonglobal_loaders = g_value_get_boolean (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -423,6 +429,7 @@ peas_engine_get_property (GObject    *object,
                           GParamSpec *pspec)
 {
   PeasEngine *engine = PEAS_ENGINE (object);
+  PeasEnginePrivate *priv = GET_PRIV (engine);
 
   switch (prop_id)
     {
@@ -435,7 +442,7 @@ peas_engine_get_property (GObject    *object,
                           (gconstpointer) peas_engine_get_loaded_plugins (engine));
       break;
     case PROP_NONGLOBAL_LOADERS:
-      g_value_set_boolean (value, engine->priv->use_nonglobal_loaders);
+      g_value_set_boolean (value, priv->use_nonglobal_loaders);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -447,14 +454,15 @@ static void
 peas_engine_dispose (GObject *object)
 {
   PeasEngine *engine = PEAS_ENGINE (object);
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GList *item;
   gint i;
 
   /* See peas_engine_unload_plugin_real() */
-  engine->priv->in_dispose = TRUE;
+  priv->in_dispose = TRUE;
 
   /* First unload all the plugins */
-  for (item = engine->priv->plugin_list; item; item = item->next)
+  for (item = priv->plugin_list; item; item = item->next)
     {
       PeasPluginInfo *info = PEAS_PLUGIN_INFO (item->data);
 
@@ -463,9 +471,9 @@ peas_engine_dispose (GObject *object)
     }
 
   /* Then destroy the plugin loaders */
-  for (i = 0; i < G_N_ELEMENTS (engine->priv->loaders); ++i)
+  for (i = 0; i < G_N_ELEMENTS (priv->loaders); ++i)
     {
-      LoaderInfo *loader_info = &engine->priv->loaders[i];
+      LoaderInfo *loader_info = &priv->loaders[i];
 
       g_clear_object (&loader_info->loader);
     }
@@ -477,14 +485,15 @@ static void
 peas_engine_finalize (GObject *object)
 {
   PeasEngine *engine = PEAS_ENGINE (object);
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GList *item;
 
   /* free the infos */
-  g_list_free_full (engine->priv->plugin_list,
+  g_list_free_full (priv->plugin_list,
                     (GDestroyNotify) _peas_plugin_info_unref);
 
   /* free the search path list */
-  for (item = engine->priv->search_paths; item; item = item->next)
+  for (item = priv->search_paths; item; item = item->next)
     {
       SearchPath *sp = (SearchPath *) item->data;
 
@@ -493,7 +502,7 @@ peas_engine_finalize (GObject *object)
       g_slice_free (SearchPath, sp);
     }
 
-  g_list_free (engine->priv->search_paths);
+  g_list_free (priv->search_paths);
 
   G_OBJECT_CLASS (peas_engine_parent_class)->finalize (object);
 }
@@ -626,7 +635,6 @@ peas_engine_class_init (PeasEngineClass *klass)
                   G_SIGNAL_TYPE_STATIC_SCOPE);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (klass, sizeof (PeasEnginePrivate));
 
   /* We are doing some global initialization here as there is currently no
    * global init function for libpeas. */
@@ -736,6 +744,7 @@ static PeasPluginLoader *
 get_local_plugin_loader (PeasEngine *engine,
                          gint        loader_id)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GlobalLoaderInfo *global_loader_info = &loaders[loader_id];
   PeasPluginLoader *loader;
 
@@ -743,7 +752,7 @@ get_local_plugin_loader (PeasEngine *engine,
     return NULL;
 
   if (global_loader_info->loader != NULL &&
-      (!engine->priv->use_nonglobal_loaders ||
+      (!priv->use_nonglobal_loaders ||
        peas_plugin_loader_is_global (global_loader_info->loader)))
     {
       return g_object_ref (global_loader_info->loader);
@@ -757,7 +766,7 @@ get_local_plugin_loader (PeasEngine *engine,
       return NULL;
     }
 
-  if (!engine->priv->use_nonglobal_loaders ||
+  if (!priv->use_nonglobal_loaders ||
       peas_plugin_loader_is_global (loader))
     {
       global_loader_info->loader = g_object_ref (loader);
@@ -770,7 +779,8 @@ static PeasPluginLoader *
 get_plugin_loader (PeasEngine *engine,
                    gint        loader_id)
 {
-  LoaderInfo *loader_info = &engine->priv->loaders[loader_id];
+  PeasEnginePrivate *priv = GET_PRIV (engine);
+  LoaderInfo *loader_info = &priv->loaders[loader_id];
   GlobalLoaderInfo *global_loader_info = &loaders[loader_id];
 
   if (loader_info->loader != NULL || loader_info->failed)
@@ -835,6 +845,7 @@ void
 peas_engine_enable_loader (PeasEngine  *engine,
                            const gchar *loader_name)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   LoaderInfo *loader_info;
   gint loader_id;
 
@@ -849,7 +860,7 @@ peas_engine_enable_loader (PeasEngine  *engine,
       return;
     }
 
-  loader_info = &engine->priv->loaders[loader_id];
+  loader_info = &priv->loaders[loader_id];
   if (loader_info->enabled || loader_info->failed)
     return;
 
@@ -910,9 +921,11 @@ peas_engine_enable_loader (PeasEngine  *engine,
 const GList *
 peas_engine_get_plugin_list (PeasEngine *engine)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
+
   g_return_val_if_fail (PEAS_IS_ENGINE (engine), NULL);
 
-  return engine->priv->plugin_list;
+  return priv->plugin_list;
 }
 
 static gint
@@ -937,12 +950,13 @@ PeasPluginInfo *
 peas_engine_get_plugin_info (PeasEngine  *engine,
                              const gchar *plugin_name)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GList *l;
 
   g_return_val_if_fail (PEAS_IS_ENGINE (engine), NULL);
   g_return_val_if_fail (plugin_name != NULL, NULL);
 
-  l = g_list_find_custom (engine->priv->plugin_list,
+  l = g_list_find_custom (priv->plugin_list,
                           plugin_name,
                           (GCompareFunc) compare_plugin_info_and_name);
 
@@ -1065,6 +1079,7 @@ static void
 peas_engine_unload_plugin_real (PeasEngine     *engine,
                                 PeasPluginInfo *info)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GList *item;
   const gchar *module_name;
   PeasPluginLoader *loader;
@@ -1078,7 +1093,7 @@ peas_engine_unload_plugin_real (PeasEngine     *engine,
 
   /* First unload all the dependant plugins */
   module_name = peas_plugin_info_get_module_name (info);
-  for (item = engine->priv->plugin_list; item; item = item->next)
+  for (item = priv->plugin_list; item; item = item->next)
     {
       PeasPluginInfo *other_info = PEAS_PLUGIN_INFO (item->data);
 
@@ -1100,7 +1115,7 @@ peas_engine_unload_plugin_real (PeasEngine     *engine,
   /* Don't notify while in dispose so the
    * loaded plugins can easily be kept in GSettings
    */
-  if (!engine->priv->in_dispose)
+  if (!priv->in_dispose)
     g_object_notify_by_pspec (G_OBJECT (engine),
                               properties[PROP_LOADED_PLUGINS]);
 }
@@ -1324,6 +1339,7 @@ peas_engine_create_extension (PeasEngine     *engine,
 gchar **
 peas_engine_get_loaded_plugins (PeasEngine *engine)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GArray *array;
   GList *pl;
 
@@ -1331,7 +1347,7 @@ peas_engine_get_loaded_plugins (PeasEngine *engine)
 
   array = g_array_new (TRUE, FALSE, sizeof (gchar *));
 
-  for (pl = engine->priv->plugin_list; pl; pl = pl->next)
+  for (pl = priv->plugin_list; pl; pl = pl->next)
     {
       PeasPluginInfo *info = (PeasPluginInfo *) pl->data;
       gchar *module_name;
@@ -1377,11 +1393,12 @@ void
 peas_engine_set_loaded_plugins (PeasEngine   *engine,
                                 const gchar **plugin_names)
 {
+  PeasEnginePrivate *priv = GET_PRIV (engine);
   GList *pl;
 
   g_return_if_fail (PEAS_IS_ENGINE (engine));
 
-  for (pl = engine->priv->plugin_list; pl; pl = pl->next)
+  for (pl = priv->plugin_list; pl; pl = pl->next)
     {
       PeasPluginInfo *info = (PeasPluginInfo *) pl->data;
       const gchar *module_name;
diff --git a/libpeas/peas-extension-base.c b/libpeas/peas-extension-base.c
index 3434fba..a347234 100644
--- a/libpeas/peas-extension-base.c
+++ b/libpeas/peas-extension-base.c
@@ -42,8 +42,6 @@
  * the same purpose.
  **/
 
-G_DEFINE_ABSTRACT_TYPE (PeasExtensionBase, peas_extension_base, G_TYPE_OBJECT)
-
 struct _PeasExtensionBasePrivate {
   PeasPluginInfo *info;
 };
@@ -58,6 +56,13 @@ enum {
 
 static GParamSpec *properties[N_PROPERTIES] = { NULL };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PeasExtensionBase,
+                                     peas_extension_base,
+                                     G_TYPE_OBJECT)
+
+#define GET_PRIV(o) \
+  (peas_extension_base_get_instance_private (o))
+
 static void
 peas_extension_base_get_property (GObject    *object,
                                   guint       prop_id,
@@ -87,11 +92,12 @@ peas_extension_base_set_property (GObject      *object,
                                   GParamSpec   *pspec)
 {
   PeasExtensionBase *extbase = PEAS_EXTENSION_BASE (object);
+  PeasExtensionBasePrivate *priv = GET_PRIV (extbase);
 
   switch (prop_id)
     {
     case PROP_PLUGIN_INFO:
-      extbase->priv->info = g_value_get_boxed (value);
+      priv->info = g_value_get_boxed (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -102,9 +108,6 @@ peas_extension_base_set_property (GObject      *object,
 static void
 peas_extension_base_init (PeasExtensionBase *extbase)
 {
-  extbase->priv = G_TYPE_INSTANCE_GET_PRIVATE (extbase,
-                                               PEAS_TYPE_EXTENSION_BASE,
-                                               PeasExtensionBasePrivate);
 }
 
 static void
@@ -134,7 +137,6 @@ peas_extension_base_class_init (PeasExtensionBaseClass *klass)
                          G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (klass, sizeof (PeasExtensionBasePrivate));
 }
 
 /**
@@ -149,9 +151,11 @@ peas_extension_base_class_init (PeasExtensionBaseClass *klass)
 PeasPluginInfo *
 peas_extension_base_get_plugin_info (PeasExtensionBase *extbase)
 {
+  PeasExtensionBasePrivate *priv = GET_PRIV (extbase);
+
   g_return_val_if_fail (PEAS_IS_EXTENSION_BASE (extbase), NULL);
 
-  return extbase->priv->info;
+  return priv->info;
 }
 
 /**
@@ -167,7 +171,9 @@ peas_extension_base_get_plugin_info (PeasExtensionBase *extbase)
 gchar *
 peas_extension_base_get_data_dir (PeasExtensionBase *extbase)
 {
+  PeasExtensionBasePrivate *priv = GET_PRIV (extbase);
+
   g_return_val_if_fail (PEAS_IS_EXTENSION_BASE (extbase), NULL);
 
-  return g_strdup (peas_plugin_info_get_data_dir (extbase->priv->info));
+  return g_strdup (peas_plugin_info_get_data_dir (priv->info));
 }
diff --git a/libpeas/peas-extension-set.c b/libpeas/peas-extension-set.c
index 42049d2..d8535be 100644
--- a/libpeas/peas-extension-set.c
+++ b/libpeas/peas-extension-set.c
@@ -86,8 +86,6 @@
  * ]|
  **/
 
-G_DEFINE_TYPE (PeasExtensionSet, peas_extension_set, G_TYPE_OBJECT)
-
 struct _PeasExtensionSetPrivate {
   PeasEngine *engine;
   GType exten_type;
@@ -126,20 +124,28 @@ enum {
 static guint signals[LAST_SIGNAL];
 static GParamSpec *properties[N_PROPERTIES] = { NULL };
 
+G_DEFINE_TYPE_WITH_PRIVATE (PeasExtensionSet,
+                            peas_extension_set,
+                            G_TYPE_OBJECT)
+
+#define GET_PRIV(o) \
+  (peas_extension_set_get_instance_private (o))
+
 static void
 set_construct_properties (PeasExtensionSet   *set,
                           PeasParameterArray *array)
 {
-  unsigned i;
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
+  guint i;
 
-  set->priv->n_parameters = array->n_parameters;
+  priv->n_parameters = array->n_parameters;
 
-  set->priv->parameters = g_new0 (GParameter, array->n_parameters);
+  priv->parameters = g_new0 (GParameter, array->n_parameters);
   for (i = 0; i < array->n_parameters; i++)
     {
-      set->priv->parameters[i].name = g_intern_string (array->parameters[i].name);
-      g_value_init (&set->priv->parameters[i].value, G_VALUE_TYPE (&array->parameters[i].value));
-      g_value_copy (&array->parameters[i].value, &set->priv->parameters[i].value);
+      priv->parameters[i].name = g_intern_string (array->parameters[i].name);
+      g_value_init (&priv->parameters[i].value, G_VALUE_TYPE (&array->parameters[i].value));
+      g_value_copy (&array->parameters[i].value, &priv->parameters[i].value);
     }
 }
 
@@ -150,14 +156,15 @@ peas_extension_set_set_property (GObject      *object,
                                  GParamSpec   *pspec)
 {
   PeasExtensionSet *set = PEAS_EXTENSION_SET (object);
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      set->priv->engine = g_value_get_object (value);
+      priv->engine = g_value_get_object (value);
       break;
     case PROP_EXTENSION_TYPE:
-      set->priv->exten_type = g_value_get_gtype (value);
+      priv->exten_type = g_value_get_gtype (value);
       break;
     case PROP_CONSTRUCT_PROPERTIES:
       set_construct_properties (set, g_value_get_pointer (value));
@@ -174,14 +181,15 @@ peas_extension_set_get_property (GObject    *object,
                                  GParamSpec *pspec)
 {
   PeasExtensionSet *set = PEAS_EXTENSION_SET (object);
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
 
   switch (prop_id)
     {
     case PROP_ENGINE:
-      g_value_set_object (value, set->priv->engine);
+      g_value_set_object (value, priv->engine);
       break;
     case PROP_EXTENSION_TYPE:
-      g_value_set_gtype (value, set->priv->exten_type);
+      g_value_set_gtype (value, priv->exten_type);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -192,6 +200,7 @@ static void
 add_extension (PeasExtensionSet *set,
                PeasPluginInfo   *info)
 {
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   PeasExtension *exten;
   ExtensionItem *item;
 
@@ -199,20 +208,20 @@ add_extension (PeasExtensionSet *set,
   if (!peas_plugin_info_is_loaded (info))
     return;
 
-  if (!peas_engine_provides_extension (set->priv->engine, info,
-                                       set->priv->exten_type))
+  if (!peas_engine_provides_extension (priv->engine, info,
+                                       priv->exten_type))
     return;
 
-  exten = peas_engine_create_extensionv (set->priv->engine, info,
-                                         set->priv->exten_type,
-                                         set->priv->n_parameters,
-                                         set->priv->parameters);
+  exten = peas_engine_create_extensionv (priv->engine, info,
+                                         priv->exten_type,
+                                         priv->n_parameters,
+                                         priv->parameters);
 
   item = (ExtensionItem *) g_slice_new (ExtensionItem);
   item->info = info;
   item->exten = exten;
 
-  set->priv->extensions = g_list_prepend (set->priv->extensions, item);
+  priv->extensions = g_list_prepend (priv->extensions, item);
   g_signal_emit (set, signals[EXTENSION_ADDED], 0, info, exten);
 }
 
@@ -231,17 +240,18 @@ static void
 remove_extension (PeasExtensionSet *set,
                   PeasPluginInfo   *info)
 {
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   GList *l;
   ExtensionItem *item;
 
-  for (l = set->priv->extensions; l; l = l->next)
+  for (l = priv->extensions; l; l = l->next)
     {
       item = (ExtensionItem *) l->data;
       if (item->info != info)
         continue;
 
       remove_extension_item (set, item);
-      set->priv->extensions = g_list_delete_link (set->priv->extensions, l);
+      priv->extensions = g_list_delete_link (priv->extensions, l);
       return;
     }
 }
@@ -249,28 +259,28 @@ remove_extension (PeasExtensionSet *set,
 static void
 peas_extension_set_init (PeasExtensionSet *set)
 {
-  set->priv = G_TYPE_INSTANCE_GET_PRIVATE (set, PEAS_TYPE_EXTENSION_SET, PeasExtensionSetPrivate);
 }
 
 static void
 peas_extension_set_constructed (GObject *object)
 {
   PeasExtensionSet *set = PEAS_EXTENSION_SET (object);
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   GList *plugins, *l;
 
-  if (set->priv->engine == NULL)
-    set->priv->engine = peas_engine_get_default ();
+  if (priv->engine == NULL)
+    priv->engine = peas_engine_get_default ();
 
-  g_object_ref (set->priv->engine);
+  g_object_ref (priv->engine);
 
-  plugins = (GList *) peas_engine_get_plugin_list (set->priv->engine);
+  plugins = (GList *) peas_engine_get_plugin_list (priv->engine);
   for (l = plugins; l; l = l->next)
     add_extension (set, (PeasPluginInfo *) l->data);
 
-  g_signal_connect_object (set->priv->engine, "load-plugin",
+  g_signal_connect_object (priv->engine, "load-plugin",
                            G_CALLBACK (add_extension), set,
                            G_CONNECT_AFTER | G_CONNECT_SWAPPED);
-  g_signal_connect_object (set->priv->engine, "unload-plugin",
+  g_signal_connect_object (priv->engine, "unload-plugin",
                            G_CALLBACK (remove_extension), set,
                            G_CONNECT_SWAPPED);
 
@@ -281,27 +291,28 @@ static void
 peas_extension_set_dispose (GObject *object)
 {
   PeasExtensionSet *set = PEAS_EXTENSION_SET (object);
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   GList *l;
 
-  if (set->priv->extensions != NULL)
+  if (priv->extensions != NULL)
     {
-      for (l = set->priv->extensions; l != NULL; l = l->next)
+      for (l = priv->extensions; l != NULL; l = l->next)
         remove_extension_item (set, (ExtensionItem *) l->data);
 
-      g_list_free (set->priv->extensions);
-      set->priv->extensions = NULL;
+      g_list_free (priv->extensions);
+      priv->extensions = NULL;
     }
 
-  if (set->priv->parameters != NULL)
+  if (priv->parameters != NULL)
     {
-      while (set->priv->n_parameters-- > 0)
-        g_value_unset (&set->priv->parameters[set->priv->n_parameters].value);
+      while (priv->n_parameters-- > 0)
+        g_value_unset (&priv->parameters[priv->n_parameters].value);
 
-      g_free (set->priv->parameters);
-      set->priv->parameters = NULL;
+      g_free (priv->parameters);
+      priv->parameters = NULL;
     }
 
-  g_clear_object (&set->priv->engine);
+  g_clear_object (&priv->engine);
 }
 
 static gboolean
@@ -309,11 +320,12 @@ peas_extension_set_call_real (PeasExtensionSet *set,
                               const gchar      *method_name,
                               GIArgument       *args)
 {
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   gboolean ret = TRUE;
   GList *l;
   GIArgument dummy;
 
-  for (l = set->priv->extensions; l; l = l->next)
+  for (l = priv->extensions; l; l = l->next)
     {
       ExtensionItem *item = (ExtensionItem *) l->data;
       ret = peas_extension_callv (item->exten, method_name, args, &dummy) && ret;
@@ -417,7 +429,6 @@ peas_extension_set_class_init (PeasExtensionSetClass *klass)
                           G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (klass, sizeof (PeasExtensionSetPrivate));
 }
 
 /**
@@ -434,12 +445,13 @@ PeasExtension *
 peas_extension_set_get_extension (PeasExtensionSet *set,
                                   PeasPluginInfo   *info)
 {
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   GList *l;
 
   g_return_val_if_fail (PEAS_IS_EXTENSION_SET (set), NULL);
   g_return_val_if_fail (info != NULL, NULL);
 
-  for (l = set->priv->extensions; l != NULL; l = l->next)
+  for (l = priv->extensions; l != NULL; l = l->next)
     {
       ExtensionItem *item = l->data;
 
@@ -501,6 +513,7 @@ peas_extension_set_call_valist (PeasExtensionSet *set,
                                 const gchar      *method_name,
                                 va_list           va_args)
 {
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   GICallableInfo *callable_info;
   GIArgument *args;
   gint n_args;
@@ -508,12 +521,12 @@ peas_extension_set_call_valist (PeasExtensionSet *set,
   g_return_val_if_fail (PEAS_IS_EXTENSION_SET (set), FALSE);
   g_return_val_if_fail (method_name != NULL, FALSE);
 
-  callable_info = peas_gi_get_method_info (set->priv->exten_type, method_name);
+  callable_info = peas_gi_get_method_info (priv->exten_type, method_name);
 
   if (callable_info == NULL)
     {
       g_warning ("Method '%s.%s' was not found",
-                 g_type_name (set->priv->exten_type), method_name);
+                 g_type_name (priv->exten_type), method_name);
       return FALSE;
     }
 
@@ -571,12 +584,13 @@ peas_extension_set_foreach (PeasExtensionSet            *set,
                             PeasExtensionSetForeachFunc  func,
                             gpointer                     data)
 {
+  PeasExtensionSetPrivate *priv = GET_PRIV (set);
   GList *l;
 
   g_return_if_fail (PEAS_IS_EXTENSION_SET (set));
   g_return_if_fail (func != NULL);
 
-  for (l = set->priv->extensions; l; l = l->next)
+  for (l = priv->extensions; l; l = l->next)
     {
       ExtensionItem *item = (ExtensionItem *) l->data;
 
diff --git a/libpeas/peas-object-module.c b/libpeas/peas-object-module.c
index 88481b7..caf6401 100644
--- a/libpeas/peas-object-module.c
+++ b/libpeas/peas-object-module.c
@@ -42,9 +42,7 @@
  * function.
  **/
 
-G_DEFINE_TYPE (PeasObjectModule, peas_object_module, G_TYPE_TYPE_MODULE)
-
-typedef void     (*PeasObjectModuleRegisterFunc) (PeasObjectModule *);
+typedef void (*PeasObjectModuleRegisterFunc) (PeasObjectModule *module);
 
 enum {
   PROP_0,
@@ -77,17 +75,25 @@ struct _PeasObjectModulePrivate {
   guint local_linkage : 1;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (PeasObjectModule,
+                            peas_object_module,
+                            G_TYPE_TYPE_MODULE)
+
+#define GET_PRIV(o) \
+  (peas_object_module_get_instance_private (o))
+
 static gboolean
 peas_object_module_load (GTypeModule *gmodule)
 {
   PeasObjectModule *module = PEAS_OBJECT_MODULE (gmodule);
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
   GModuleFlags flags = 0;
   gchar *path;
 
-  if (module->priv->local_linkage)
+  if (priv->local_linkage)
     flags = G_MODULE_BIND_LOCAL;
 
-  path = g_module_build_path (module->priv->path, module->priv->module_name);
+  path = g_module_build_path (priv->path, priv->module_name);
   g_return_val_if_fail (path != NULL, FALSE);
 
   /* g_module_build_path() will add G_MODULE_SUFFIX to the path,
@@ -100,25 +106,25 @@ peas_object_module_load (GTypeModule *gmodule)
     path[strlen (path) - strlen (G_MODULE_SUFFIX) - 1] = '\0';
 
   /* Bind symbols immediately to avoid errors long after loading */
-  module->priv->library = g_module_open (path, flags);
+  priv->library = g_module_open (path, flags);
   g_free (path);
 
-  if (module->priv->library == NULL)
+  if (priv->library == NULL)
     {
       g_warning ("Failed to load module '%s': %s",
-                 module->priv->module_name, g_module_error ());
+                 priv->module_name, g_module_error ());
 
       return FALSE;
     }
 
   /* Extract the required symbol from the library */
-  if (!g_module_symbol (module->priv->library,
+  if (!g_module_symbol (priv->library,
                         "peas_register_types",
-                        (gpointer) &module->priv->register_func))
+                        (gpointer) &priv->register_func))
     {
       g_warning ("Failed to get 'peas_register_types' for module '%s': %s",
-                 module->priv->module_name, g_module_error ());
-      g_module_close (module->priv->library);
+                 priv->module_name, g_module_error ());
+      g_module_close (priv->library);
 
       return FALSE;
     }
@@ -126,19 +132,19 @@ peas_object_module_load (GTypeModule *gmodule)
   /* The symbol can still be NULL even
    * though g_module_symbol() returned TRUE
    */
-  if (module->priv->register_func == NULL)
+  if (priv->register_func == NULL)
     {
       g_warning ("Invalid 'peas_register_types' in module '%s'",
-                 module->priv->module_name);
-      g_module_close (module->priv->library);
+                 priv->module_name);
+      g_module_close (priv->library);
 
       return FALSE;
     }
 
-  if (module->priv->resident)
-    g_module_make_resident (module->priv->library);
+  if (priv->resident)
+    g_module_make_resident (priv->library);
 
-  module->priv->register_func (module);
+  priv->register_func (module);
 
   return TRUE;
 }
@@ -147,43 +153,44 @@ static void
 peas_object_module_unload (GTypeModule *gmodule)
 {
   PeasObjectModule *module = PEAS_OBJECT_MODULE (gmodule);
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
   InterfaceImplementation *impls;
   guint i;
 
-  g_module_close (module->priv->library);
+  g_module_close (priv->library);
 
-  module->priv->library = NULL;
-  module->priv->register_func = NULL;
+  priv->library = NULL;
+  priv->register_func = NULL;
 
-  impls = (InterfaceImplementation *) module->priv->implementations->data;
-  for (i = 0; i < module->priv->implementations->len; ++i)
+  impls = (InterfaceImplementation *) priv->implementations->data;
+  for (i = 0; i < priv->implementations->len; ++i)
     {
       if (impls[i].destroy_func != NULL)
         impls[i].destroy_func (impls[i].user_data);
     }
 
-  g_array_remove_range (module->priv->implementations, 0,
-                        module->priv->implementations->len);
+  g_array_remove_range (priv->implementations, 0,
+                        priv->implementations->len);
 }
 
 static void
 peas_object_module_init (PeasObjectModule *module)
 {
-  module->priv = G_TYPE_INSTANCE_GET_PRIVATE (module,
-                                              PEAS_TYPE_OBJECT_MODULE,
-                                              PeasObjectModulePrivate);
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
 
-  module->priv->implementations = g_array_new (FALSE, FALSE, sizeof (InterfaceImplementation));
+  priv->implementations = g_array_new (FALSE, FALSE,
+                                       sizeof (InterfaceImplementation));
 }
 
 static void
 peas_object_module_finalize (GObject *object)
 {
   PeasObjectModule *module = PEAS_OBJECT_MODULE (object);
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
 
-  g_free (module->priv->path);
-  g_free (module->priv->module_name);
-  g_array_unref (module->priv->implementations);
+  g_free (priv->path);
+  g_free (priv->module_name);
+  g_array_unref (priv->implementations);
 
   G_OBJECT_CLASS (peas_object_module_parent_class)->finalize (object);
 }
@@ -195,20 +202,21 @@ peas_object_module_get_property (GObject    *object,
                                  GParamSpec *pspec)
 {
   PeasObjectModule *module = PEAS_OBJECT_MODULE (object);
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
 
   switch (prop_id)
     {
     case PROP_MODULE_NAME:
-      g_value_set_string (value, module->priv->module_name);
+      g_value_set_string (value, priv->module_name);
       break;
     case PROP_PATH:
-      g_value_set_string (value, module->priv->path);
+      g_value_set_string (value, priv->path);
       break;
     case PROP_RESIDENT:
-      g_value_set_boolean (value, module->priv->resident);
+      g_value_set_boolean (value, priv->resident);
       break;
     case PROP_LOCAL_LINKAGE:
-      g_value_set_boolean (value, module->priv->local_linkage);
+      g_value_set_boolean (value, priv->local_linkage);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -223,22 +231,23 @@ peas_object_module_set_property (GObject      *object,
                                  GParamSpec   *pspec)
 {
   PeasObjectModule *module = PEAS_OBJECT_MODULE (object);
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
 
   switch (prop_id)
     {
     case PROP_MODULE_NAME:
-      module->priv->module_name = g_value_dup_string (value);
+      priv->module_name = g_value_dup_string (value);
       g_type_module_set_name (G_TYPE_MODULE (object),
-                              module->priv->module_name);
+                              priv->module_name);
       break;
     case PROP_PATH:
-      module->priv->path = g_value_dup_string (value);
+      priv->path = g_value_dup_string (value);
       break;
     case PROP_RESIDENT:
-      module->priv->resident = g_value_get_boolean (value);
+      priv->resident = g_value_get_boolean (value);
       break;
     case PROP_LOCAL_LINKAGE:
-      module->priv->local_linkage = g_value_get_boolean (value);
+      priv->local_linkage = g_value_get_boolean (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -304,7 +313,6 @@ peas_object_module_class_init (PeasObjectModuleClass *klass)
                           G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-  g_type_class_add_private (klass, sizeof (PeasObjectModulePrivate));
 }
 
 /**
@@ -376,13 +384,14 @@ peas_object_module_create_object (PeasObjectModule *module,
                                   guint             n_parameters,
                                   GParameter       *parameters)
 {
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
   guint i;
   InterfaceImplementation *impls;
 
   g_return_val_if_fail (PEAS_IS_OBJECT_MODULE (module), NULL);
 
-  impls = (InterfaceImplementation *) module->priv->implementations->data;
-  for (i = 0; i < module->priv->implementations->len; ++i)
+  impls = (InterfaceImplementation *) priv->implementations->data;
+  for (i = 0; i < priv->implementations->len; ++i)
     if (impls[i].iface_type == interface)
       return impls[i].func (n_parameters, parameters, impls[i].user_data);
 
@@ -402,13 +411,14 @@ gboolean
 peas_object_module_provides_object (PeasObjectModule *module,
                                     GType             interface)
 {
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
   guint i;
   InterfaceImplementation *impls;
 
   g_return_val_if_fail (PEAS_IS_OBJECT_MODULE (module), FALSE);
 
-  impls = (InterfaceImplementation *) module->priv->implementations->data;
-  for (i = 0; i < module->priv->implementations->len; ++i)
+  impls = (InterfaceImplementation *) priv->implementations->data;
+  for (i = 0; i < priv->implementations->len; ++i)
     if (impls[i].iface_type == interface)
       return TRUE;
 
@@ -426,9 +436,11 @@ peas_object_module_provides_object (PeasObjectModule *module,
 const gchar *
 peas_object_module_get_path (PeasObjectModule *module)
 {
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
+
   g_return_val_if_fail (PEAS_IS_OBJECT_MODULE (module), NULL);
 
-  return module->priv->path;
+  return priv->path;
 }
 
 /**
@@ -442,9 +454,11 @@ peas_object_module_get_path (PeasObjectModule *module)
 const gchar *
 peas_object_module_get_module_name (PeasObjectModule *module)
 {
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
+
   g_return_val_if_fail (PEAS_IS_OBJECT_MODULE (module), NULL);
 
-  return module->priv->module_name;
+  return priv->module_name;
 }
 
 /**
@@ -458,9 +472,11 @@ peas_object_module_get_module_name (PeasObjectModule *module)
 GModule *
 peas_object_module_get_library (PeasObjectModule *module)
 {
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
+
   g_return_val_if_fail (PEAS_IS_OBJECT_MODULE (module), NULL);
 
-  return module->priv->library;
+  return priv->library;
 }
 
 /**
@@ -488,6 +504,7 @@ peas_object_module_register_extension_factory (PeasObjectModule *module,
                                                gpointer          user_data,
                                                GDestroyNotify    destroy_func)
 {
+  PeasObjectModulePrivate *priv = GET_PRIV (module);
   InterfaceImplementation impl = { iface_type, factory_func, user_data, destroy_func };
 
   g_return_if_fail (PEAS_IS_OBJECT_MODULE (module));
@@ -497,7 +514,7 @@ peas_object_module_register_extension_factory (PeasObjectModule *module,
   if (iface_type != PEAS_TYPE_PLUGIN_LOADER)
     g_return_if_fail (G_TYPE_IS_INTERFACE (iface_type));
 
-  g_array_append_val (module->priv->implementations, impl);
+  g_array_append_val (priv->implementations, impl);
 
   g_debug ("Registered extension for type '%s'", g_type_name (iface_type));
 }
diff --git a/libpeas/peas-plugin-loader-c.c b/libpeas/peas-plugin-loader-c.c
index b0e8417..0285ea3 100644
--- a/libpeas/peas-plugin-loader-c.c
+++ b/libpeas/peas-plugin-loader-c.c
@@ -31,13 +31,18 @@
 #include "peas-object-module.h"
 #include "peas-plugin-info-priv.h"
 
-struct _PeasPluginLoaderCPrivate {
+typedef struct {
   GMutex lock;
 
   GHashTable *loaded_plugins;
-};
+} PeasPluginLoaderCPrivate;
 
-G_DEFINE_TYPE (PeasPluginLoaderC, peas_plugin_loader_c, PEAS_TYPE_PLUGIN_LOADER)
+G_DEFINE_TYPE_WITH_PRIVATE (PeasPluginLoaderC,
+                            peas_plugin_loader_c,
+                            PEAS_TYPE_PLUGIN_LOADER)
+
+#define GET_PRIV(o) \
+  (peas_plugin_loader_c_get_instance_private (o))
 
 static
 G_DEFINE_QUARK (peas-extension-type, extension_type)
@@ -47,10 +52,11 @@ peas_plugin_loader_c_load (PeasPluginLoader *loader,
                            PeasPluginInfo   *info)
 {
   PeasPluginLoaderC *cloader = PEAS_PLUGIN_LOADER_C (loader);
+  PeasPluginLoaderCPrivate *priv = GET_PRIV (cloader);
 
-  g_mutex_lock (&cloader->priv->lock);
+  g_mutex_lock (&priv->lock);
 
-  if (!g_hash_table_lookup_extended (cloader->priv->loaded_plugins,
+  if (!g_hash_table_lookup_extended (priv->loaded_plugins,
                                      info->filename,
                                      NULL, (gpointer *) &info->loader_data))
     {
@@ -70,11 +76,11 @@ peas_plugin_loader_c_load (PeasPluginLoader *loader,
       if (!g_type_module_use (G_TYPE_MODULE (info->loader_data)))
         g_clear_object (&info->loader_data);
 
-      g_hash_table_insert (cloader->priv->loaded_plugins,
+      g_hash_table_insert (priv->loaded_plugins,
                            g_strdup (info->filename), info->loader_data);
     }
 
-  g_mutex_unlock (&cloader->priv->lock);
+  g_mutex_unlock (&priv->lock);
   return info->loader_data != NULL;
 }
 
@@ -147,29 +153,26 @@ peas_plugin_loader_c_create_extension (PeasPluginLoader *loader,
 }
 
 static void
-peas_plugin_loader_c_init (PeasPluginLoaderC *loader)
+peas_plugin_loader_c_init (PeasPluginLoaderC *cloader)
 {
-  loader->priv = G_TYPE_INSTANCE_GET_PRIVATE (loader,
-                                              PEAS_TYPE_PLUGIN_LOADER_C,
-                                              PeasPluginLoaderCPrivate);
+  PeasPluginLoaderCPrivate *priv = GET_PRIV (cloader);
 
-  g_mutex_init (&loader->priv->lock);
+  g_mutex_init (&priv->lock);
 
   /* loaded_plugins maps PeasPluginInfo:filename to a PeasObjectModule */
-  loader->priv->loaded_plugins = g_hash_table_new_full (g_str_hash,
-                                                        g_str_equal,
-                                                        g_free,
-                                                        NULL);
+  priv->loaded_plugins = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                g_free, NULL);
 }
 
 static void
 peas_plugin_loader_c_finalize (GObject *object)
 {
   PeasPluginLoaderC *cloader = PEAS_PLUGIN_LOADER_C (object);
+  PeasPluginLoaderCPrivate *priv = GET_PRIV (cloader);
 
-  g_mutex_clear (&cloader->priv->lock);
+  g_mutex_clear (&priv->lock);
 
-  g_hash_table_destroy (cloader->priv->loaded_plugins);
+  g_hash_table_destroy (priv->loaded_plugins);
 
   G_OBJECT_CLASS (peas_plugin_loader_c_parent_class)->finalize (object);
 }
@@ -186,8 +189,6 @@ peas_plugin_loader_c_class_init (PeasPluginLoaderCClass *klass)
   loader_class->unload = peas_plugin_loader_c_unload;
   loader_class->provides_extension = peas_plugin_loader_c_provides_extension;
   loader_class->create_extension = peas_plugin_loader_c_create_extension;
-
-  g_type_class_add_private (object_class, sizeof (PeasPluginLoaderCPrivate));
 }
 
 /**
diff --git a/libpeas/peas-plugin-loader-c.h b/libpeas/peas-plugin-loader-c.h
index 5877e36..c0be4ca 100644
--- a/libpeas/peas-plugin-loader-c.h
+++ b/libpeas/peas-plugin-loader-c.h
@@ -35,12 +35,9 @@ G_BEGIN_DECLS
 
 typedef struct _PeasPluginLoaderC         PeasPluginLoaderC;
 typedef struct _PeasPluginLoaderCClass    PeasPluginLoaderCClass;
-typedef struct _PeasPluginLoaderCPrivate  PeasPluginLoaderCPrivate;
 
 struct _PeasPluginLoaderC {
   PeasPluginLoader parent;
-
-  PeasPluginLoaderCPrivate *priv;
 };
 
 struct _PeasPluginLoaderCClass {
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.c b/loaders/lua5.1/peas-plugin-loader-lua.c
index 42f6b23..25582b9 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.c
+++ b/loaders/lua5.1/peas-plugin-loader-lua.c
@@ -38,15 +38,20 @@
 typedef void (* LgiLockFunc) (gpointer lgi_lock);
 
 
-struct _PeasPluginLoaderLuaPrivate {
+typedef struct {
   lua_State *L;
 
   gpointer lgi_lock;
   LgiLockFunc lgi_enter_func;
   LgiLockFunc lgi_leave_func;
-};
+} PeasPluginLoaderLuaPrivate;
 
-G_DEFINE_TYPE (PeasPluginLoaderLua, peas_plugin_loader_lua, PEAS_TYPE_PLUGIN_LOADER)
+G_DEFINE_TYPE_WITH_PRIVATE (PeasPluginLoaderLua,
+                            peas_plugin_loader_lua,
+                            PEAS_TYPE_PLUGIN_LOADER)
+
+#define GET_PRIV(o) \
+  (peas_plugin_loader_lua_get_instance_private (o))
 
 static
 G_DEFINE_QUARK (peas-extension-type, extension_type)
@@ -224,12 +229,13 @@ peas_plugin_loader_lua_provides_extension (PeasPluginLoader *loader,
                                            GType             exten_type)
 {
   PeasPluginLoaderLua *lua_loader = PEAS_PLUGIN_LOADER_LUA (loader);
-  lua_State *L = lua_loader->priv->L;
+  PeasPluginLoaderLuaPrivate *priv = GET_PRIV (lua_loader);
+  lua_State *L = priv->L;
   GType extension_type;
 
-  lua_loader->priv->lgi_enter_func (lua_loader->priv->lgi_lock);
+  priv->lgi_enter_func (priv->lgi_lock);
   extension_type = _lua_find_extension_type (L, info, exten_type);
-  lua_loader->priv->lgi_leave_func (lua_loader->priv->lgi_lock);
+  priv->lgi_leave_func (priv->lgi_lock);
 
   return extension_type != G_TYPE_INVALID;
 }
@@ -242,11 +248,12 @@ peas_plugin_loader_lua_create_extension (PeasPluginLoader *loader,
                                          GParameter       *parameters)
 {
   PeasPluginLoaderLua *lua_loader = PEAS_PLUGIN_LOADER_LUA (loader);
-  lua_State *L = lua_loader->priv->L;
+  PeasPluginLoaderLuaPrivate *priv = GET_PRIV (lua_loader);
+  lua_State *L = priv->L;
   GType the_type;
   GObject *object = NULL;
 
-  lua_loader->priv->lgi_enter_func (lua_loader->priv->lgi_lock);
+  priv->lgi_enter_func (priv->lgi_lock);
 
   the_type = _lua_find_extension_type (L, info, exten_type);
   if (the_type == G_TYPE_INVALID)
@@ -294,7 +301,7 @@ peas_plugin_loader_lua_create_extension (PeasPluginLoader *loader,
 
 out:
 
-  lua_loader->priv->lgi_leave_func (lua_loader->priv->lgi_lock);
+  priv->lgi_leave_func (priv->lgi_lock);
   return object;
 }
 
@@ -303,10 +310,11 @@ peas_plugin_loader_lua_load (PeasPluginLoader *loader,
                              PeasPluginInfo   *info)
 {
   PeasPluginLoaderLua *lua_loader = PEAS_PLUGIN_LOADER_LUA (loader);
-  lua_State *L = lua_loader->priv->L;
+  PeasPluginLoaderLuaPrivate *priv = GET_PRIV (lua_loader);
+  lua_State *L = priv->L;
   gboolean success;
 
-  lua_loader->priv->lgi_enter_func (lua_loader->priv->lgi_lock);
+  priv->lgi_enter_func (priv->lgi_lock);
 
   luaL_checkstack (L, 2, "");
 
@@ -351,7 +359,7 @@ peas_plugin_loader_lua_load (PeasPluginLoader *loader,
   /* Pop the module's table */
   lua_pop (L, 1);
 
-  lua_loader->priv->lgi_leave_func (lua_loader->priv->lgi_lock);
+  priv->lgi_leave_func (priv->lgi_lock);
   return success;
 }
 
@@ -366,10 +374,11 @@ static void
 peas_plugin_loader_lua_garbage_collect (PeasPluginLoader *loader)
 {
   PeasPluginLoaderLua *lua_loader = PEAS_PLUGIN_LOADER_LUA (loader);
+  PeasPluginLoaderLuaPrivate *priv = GET_PRIV (lua_loader);
 
-  lua_loader->priv->lgi_enter_func (lua_loader->priv->lgi_lock);
-  lua_gc (lua_loader->priv->L, LUA_GCCOLLECT, 0);
-  lua_loader->priv->lgi_leave_func (lua_loader->priv->lgi_lock);
+  priv->lgi_enter_func (priv->lgi_lock);
+  lua_gc (priv->L, LUA_GCCOLLECT, 0);
+  priv->lgi_leave_func (priv->lgi_lock);
 }
 
 static int
@@ -383,6 +392,7 @@ static gboolean
 peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
 {
   PeasPluginLoaderLua *lua_loader = PEAS_PLUGIN_LOADER_LUA (loader);
+  PeasPluginLoaderLuaPrivate *priv = GET_PRIV (lua_loader);
   lua_State *L;
 
   L = luaL_newstate ();
@@ -406,20 +416,20 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
     }
 
   lua_getfield (L, -1, "lock");
-  lua_loader->priv->lgi_lock = lua_touserdata (L, -1);
+  priv->lgi_lock = lua_touserdata (L, -1);
   lua_pop (L, 1);
 
   lua_getfield (L, -1, "enter");
-  lua_loader->priv->lgi_enter_func = lua_touserdata (L, -1);
+  priv->lgi_enter_func = lua_touserdata (L, -1);
   lua_pop (L, 1);
 
   lua_getfield (L, -1, "leave");
-  lua_loader->priv->lgi_leave_func = lua_touserdata (L, -1);
+  priv->lgi_leave_func = lua_touserdata (L, -1);
   lua_pop (L, 1);
 
-  if (lua_loader->priv->lgi_lock == NULL ||
-      lua_loader->priv->lgi_enter_func == NULL ||
-      lua_loader->priv->lgi_leave_func == NULL)
+  if (priv->lgi_lock == NULL ||
+      priv->lgi_enter_func == NULL ||
+      priv->lgi_leave_func == NULL)
     {
       g_warning ("Failed to find 'lgi.lock', 'lgi.enter' and 'lgi.leave'");
       lua_close (L);
@@ -437,9 +447,9 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
   /* Initially the lock is taken by LGI,
    * release as we are not running Lua code
    */
-  lua_loader->priv->lgi_leave_func (lua_loader->priv->lgi_lock);
+  priv->lgi_leave_func (priv->lgi_lock);
 
-  lua_loader->priv->L = L;
+  priv->L = L;
   return TRUE;
 }
 
@@ -452,22 +462,20 @@ peas_plugin_loader_lua_is_global (PeasPluginLoader *loader)
 static void
 peas_plugin_loader_lua_init (PeasPluginLoaderLua *lua_loader)
 {
-  lua_loader->priv = G_TYPE_INSTANCE_GET_PRIVATE (lua_loader,
-                                                  PEAS_TYPE_PLUGIN_LOADER_LUA,
-                                                  PeasPluginLoaderLuaPrivate);
 }
 
 static void
 peas_plugin_loader_lua_finalize (GObject *object)
 {
   PeasPluginLoaderLua *lua_loader = PEAS_PLUGIN_LOADER_LUA (object);
+  PeasPluginLoaderLuaPrivate *priv = GET_PRIV (lua_loader);
 
   /* Must take the lock as Lua code will run on lua_close
    * and another thread might be running Lua code already
    */
-  lua_loader->priv->lgi_enter_func (lua_loader->priv->lgi_lock);
+  priv->lgi_enter_func (priv->lgi_lock);
 
-  g_clear_pointer (&lua_loader->priv->L, (GDestroyNotify) lua_close);
+  g_clear_pointer (&priv->L, (GDestroyNotify) lua_close);
 
   G_OBJECT_CLASS (peas_plugin_loader_lua_parent_class)->finalize (object);
 }
@@ -487,6 +495,4 @@ peas_plugin_loader_lua_class_init (PeasPluginLoaderLuaClass *klass)
   loader_class->create_extension = peas_plugin_loader_lua_create_extension;
   loader_class->provides_extension = peas_plugin_loader_lua_provides_extension;
   loader_class->garbage_collect = peas_plugin_loader_lua_garbage_collect;
-
-  g_type_class_add_private (object_class, sizeof (PeasPluginLoaderLuaPrivate));
 }
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.h b/loaders/lua5.1/peas-plugin-loader-lua.h
index efb64a1..6a12699 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.h
+++ b/loaders/lua5.1/peas-plugin-loader-lua.h
@@ -37,12 +37,9 @@ G_BEGIN_DECLS
 
 typedef struct _PeasPluginLoaderLua         PeasPluginLoaderLua;
 typedef struct _PeasPluginLoaderLuaClass    PeasPluginLoaderLuaClass;
-typedef struct _PeasPluginLoaderLuaPrivate  PeasPluginLoaderLuaPrivate;
 
 struct _PeasPluginLoaderLua {
   PeasPluginLoader parent;
-
-  PeasPluginLoaderLuaPrivate *priv;
 };
 
 struct _PeasPluginLoaderLuaClass {
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 6efbe0c..4731ad5 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -41,7 +41,7 @@ typedef int Py_ssize_t;
 #define PY_SSIZE_T_MIN INT_MIN
 #endif
 
-struct _PeasPluginLoaderPythonPrivate {
+typedef struct {
   GHashTable *loaded_plugins;
   guint n_loaded_plugins;
   guint idle_gc;
@@ -49,9 +49,14 @@ struct _PeasPluginLoaderPythonPrivate {
   guint must_finalize_python : 1;
   PyThreadState *py_thread_state;
   PyObject *hooks;
-};
+} PeasPluginLoaderPythonPrivate;
 
-G_DEFINE_TYPE (PeasPluginLoaderPython, peas_plugin_loader_python, PEAS_TYPE_PLUGIN_LOADER)
+G_DEFINE_TYPE_WITH_PRIVATE (PeasPluginLoaderPython,
+                            peas_plugin_loader_python,
+                            PEAS_TYPE_PLUGIN_LOADER)
+
+#define GET_PRIV(o) \
+  (peas_plugin_loader_python_get_instance_private (o))
 
 static
 G_DEFINE_QUARK (peas-extension-type, extension_type)
@@ -69,9 +74,10 @@ static void
 internal_python_hook (PeasPluginLoaderPython *pyloader,
                       const gchar            *name)
 {
+  PeasPluginLoaderPythonPrivate *priv = GET_PRIV (pyloader);
   PyObject *result;
 
-  result = PyObject_CallMethod (pyloader->priv->hooks, (gchar *) name, NULL);
+  result = PyObject_CallMethod (priv->hooks, (gchar *) name, NULL);
   Py_XDECREF (result);
 
   if (PyErr_Occurred ())
@@ -262,10 +268,11 @@ peas_plugin_loader_python_load (PeasPluginLoader *loader,
                                 PeasPluginInfo   *info)
 {
   PeasPluginLoaderPython *pyloader = PEAS_PLUGIN_LOADER_PYTHON (loader);
+  PeasPluginLoaderPythonPrivate *priv = GET_PRIV (pyloader);
   PyGILState_STATE state = PyGILState_Ensure ();
   PyObject *pymodule = NULL;
 
-  if (!g_hash_table_lookup_extended (pyloader->priv->loaded_plugins,
+  if (!g_hash_table_lookup_extended (priv->loaded_plugins,
                                      info->filename,
                                      NULL, (gpointer *) &pymodule))
     {
@@ -304,14 +311,14 @@ peas_plugin_loader_python_load (PeasPluginLoader *loader,
       if (PyErr_Occurred ())
         PyErr_Print ();
 
-      g_hash_table_insert (pyloader->priv->loaded_plugins,
+      g_hash_table_insert (priv->loaded_plugins,
                            g_strdup (info->filename), pymodule);
     }
 
   if (pymodule != NULL)
     {
       info->loader_data = pymodule;
-      pyloader->priv->n_loaded_plugins += 1;
+      priv->n_loaded_plugins += 1;
     }
 
   PyGILState_Release (state);
@@ -323,6 +330,7 @@ peas_plugin_loader_python_unload (PeasPluginLoader *loader,
                                   PeasPluginInfo   *info)
 {
   PeasPluginLoaderPython *pyloader = PEAS_PLUGIN_LOADER_PYTHON (loader);
+  PeasPluginLoaderPythonPrivate *priv = GET_PRIV (pyloader);
   PyGILState_STATE state = PyGILState_Ensure ();
 
   /* Only unref the Python module when the
@@ -332,7 +340,7 @@ peas_plugin_loader_python_unload (PeasPluginLoader *loader,
   /* We have to use this as a hook as the
    * loader will not be finalized by applications
    */
-  if (--pyloader->priv->n_loaded_plugins == 0)
+  if (--priv->n_loaded_plugins == 0)
     internal_python_hook (pyloader, "all_plugins_unloaded");
 
   info->loader_data = NULL;
@@ -340,14 +348,15 @@ peas_plugin_loader_python_unload (PeasPluginLoader *loader,
 }
 
 static gboolean
-run_gc (PeasPluginLoaderPython *loader)
+run_gc (PeasPluginLoaderPython *pyloader)
 {
+  PeasPluginLoaderPythonPrivate *priv = GET_PRIV (pyloader);
   PyGILState_STATE state = PyGILState_Ensure ();
 
   while (PyGC_Collect ())
     ;
 
-  loader->priv->idle_gc = 0;
+  priv->idle_gc = 0;
 
   PyGILState_Release (state);
   return FALSE;
@@ -357,6 +366,7 @@ static void
 peas_plugin_loader_python_garbage_collect (PeasPluginLoader *loader)
 {
   PeasPluginLoaderPython *pyloader = PEAS_PLUGIN_LOADER_PYTHON (loader);
+  PeasPluginLoaderPythonPrivate *priv = GET_PRIV (pyloader);
   PyGILState_STATE state = PyGILState_Ensure ();
 
   /* We both run the GC right now and we schedule
@@ -365,10 +375,10 @@ peas_plugin_loader_python_garbage_collect (PeasPluginLoader *loader)
   while (PyGC_Collect ())
     ;
 
-  if (pyloader->priv->idle_gc == 0)
+  if (priv->idle_gc == 0)
     {
-      pyloader->priv->idle_gc = g_idle_add ((GSourceFunc) run_gc, pyloader);
-      g_source_set_name_by_id (pyloader->priv->idle_gc, "[libpeas] run_gc");
+      priv->idle_gc = g_idle_add ((GSourceFunc) run_gc, pyloader);
+      g_source_set_name_by_id (priv->idle_gc, "[libpeas] run_gc");
     }
 
   PyGILState_Release (state);
@@ -421,6 +431,7 @@ static gboolean
 peas_plugin_loader_python_initialize (PeasPluginLoader *loader)
 {
   PeasPluginLoaderPython *pyloader = PEAS_PLUGIN_LOADER_PYTHON (loader);
+  PeasPluginLoaderPythonPrivate *priv = GET_PRIV (pyloader);
   PyGILState_STATE state = 0;
   long hexversion;
   GBytes *internal_python;
@@ -439,7 +450,7 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader)
   /* We are trying to initialize Python for the first time,
      set init_failed to FALSE only if the entire initialization process
      ends with success */
-  pyloader->priv->init_failed = TRUE;
+  priv->init_failed = TRUE;
 
   /* Python initialization */
   if (Py_IsInitialized ())
@@ -470,7 +481,7 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader)
 #endif
 
       Py_InitializeEx (FALSE);
-      pyloader->priv->must_finalize_python = TRUE;
+      priv->must_finalize_python = TRUE;
     }
 
   hexversion = PyLong_AsLong (PySys_GetObject ((char *) "hexversion"));
@@ -536,7 +547,7 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader)
   PyEval_InitThreads ();
 
   /* Only redirect warnings when python was not already initialized */
-  if (!pyloader->priv->must_finalize_python)
+  if (!priv->must_finalize_python)
     pyg_disable_warning_redirections ();
 
   /* i18n support */
@@ -632,12 +643,12 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader)
       goto python_init_error;
     }
 
-  pyloader->priv->hooks = PyDict_GetItemString (globals, "hooks");
-  Py_XINCREF (pyloader->priv->hooks);
+  priv->hooks = PyDict_GetItemString (globals, "hooks");
+  Py_XINCREF (priv->hooks);
 
   Py_DECREF (globals);
 
-  if (pyloader->priv->hooks == NULL)
+  if (priv->hooks == NULL)
     {
       g_warning ("Error initializing Python Plugin Loader: "
                  "failed to find internal python hooks");
@@ -646,18 +657,16 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader)
     }
 
   /* Python has been successfully initialized */
-  pyloader->priv->init_failed = FALSE;
+  priv->init_failed = FALSE;
 
-  if (!pyloader->priv->must_finalize_python)
+  if (!priv->must_finalize_python)
     PyGILState_Release (state);
   else
-    pyloader->priv->py_thread_state = PyEval_SaveThread ();
+    priv->py_thread_state = PyEval_SaveThread ();
 
   /* loaded_plugins maps PeasPluginInfo:filename to a PyObject */
-  pyloader->priv->loaded_plugins = g_hash_table_new_full (g_str_hash,
-                                                          g_str_equal,
-                                                          g_free,
-                                                          destroy_python_info);
+  priv->loaded_plugins = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                g_free, destroy_python_info);
 
   return TRUE;
 
@@ -669,7 +678,7 @@ python_init_error:
   g_warning ("Please check the installation of all the Python "
              "related packages required by libpeas and try again");
 
-  if (!pyloader->priv->must_finalize_python)
+  if (!priv->must_finalize_python)
     PyGILState_Release (state);
 
   return FALSE;
@@ -678,51 +687,49 @@ python_init_error:
 static void
 peas_plugin_loader_python_init (PeasPluginLoaderPython *pyloader)
 {
-  pyloader->priv = G_TYPE_INSTANCE_GET_PRIVATE (pyloader,
-                                                PEAS_TYPE_PLUGIN_LOADER_PYTHON,
-                                                PeasPluginLoaderPythonPrivate);
 }
 
 static void
 peas_plugin_loader_python_finalize (GObject *object)
 {
   PeasPluginLoaderPython *pyloader = PEAS_PLUGIN_LOADER_PYTHON (object);
+  PeasPluginLoaderPythonPrivate *priv = GET_PRIV (pyloader);
   PyGILState_STATE state;
 
   if (!Py_IsInitialized ())
     goto out;
 
-  g_warn_if_fail (pyloader->priv->n_loaded_plugins == 0);
+  g_warn_if_fail (priv->n_loaded_plugins == 0);
 
-  if (pyloader->priv->loaded_plugins != NULL)
+  if (priv->loaded_plugins != NULL)
     {
       state = PyGILState_Ensure ();
-      g_hash_table_destroy (pyloader->priv->loaded_plugins);
+      g_hash_table_destroy (priv->loaded_plugins);
       PyGILState_Release (state);
     }
 
-  if (pyloader->priv->hooks != NULL && !pyloader->priv->init_failed)
+  if (priv->hooks != NULL && !priv->init_failed)
     {
       state = PyGILState_Ensure ();
       internal_python_hook (pyloader, "exit");
       PyGILState_Release (state);
 
       /* Borrowed Reference */
-      pyloader->priv->hooks = NULL;
+      priv->hooks = NULL;
     }
 
-  if (pyloader->priv->py_thread_state)
-    PyEval_RestoreThread (pyloader->priv->py_thread_state);
+  if (priv->py_thread_state)
+    PyEval_RestoreThread (priv->py_thread_state);
 
-  if (pyloader->priv->idle_gc != 0)
-    g_source_remove (pyloader->priv->idle_gc);
+  if (priv->idle_gc != 0)
+    g_source_remove (priv->idle_gc);
 
-  if (!pyloader->priv->init_failed)
+  if (!priv->init_failed)
     run_gc (pyloader);
 
-  if (pyloader->priv->must_finalize_python)
+  if (priv->must_finalize_python)
     {
-      if (!pyloader->priv->init_failed)
+      if (!priv->init_failed)
         PyGILState_Ensure ();
 
       Py_Finalize ();
@@ -747,6 +754,4 @@ peas_plugin_loader_python_class_init (PeasPluginLoaderPythonClass *klass)
   loader_class->create_extension = peas_plugin_loader_python_create_extension;
   loader_class->provides_extension = peas_plugin_loader_python_provides_extension;
   loader_class->garbage_collect = peas_plugin_loader_python_garbage_collect;
-
-  g_type_class_add_private (object_class, sizeof (PeasPluginLoaderPythonPrivate));
 }
diff --git a/loaders/python/peas-plugin-loader-python.h b/loaders/python/peas-plugin-loader-python.h
index 20add31..17a277e 100644
--- a/loaders/python/peas-plugin-loader-python.h
+++ b/loaders/python/peas-plugin-loader-python.h
@@ -38,12 +38,9 @@ G_BEGIN_DECLS
 
 typedef struct _PeasPluginLoaderPython         PeasPluginLoaderPython;
 typedef struct _PeasPluginLoaderPythonClass    PeasPluginLoaderPythonClass;
-typedef struct _PeasPluginLoaderPythonPrivate  PeasPluginLoaderPythonPrivate;
 
 struct _PeasPluginLoaderPython {
   PeasPluginLoader parent;
-
-  PeasPluginLoaderPythonPrivate *priv;
 };
 
 struct _PeasPluginLoaderPythonClass {
diff --git a/tests/libpeas-gtk/plugins/configurable/configurable-plugin.h 
b/tests/libpeas-gtk/plugins/configurable/configurable-plugin.h
index 696e3ad..9dd4435 100644
--- a/tests/libpeas-gtk/plugins/configurable/configurable-plugin.h
+++ b/tests/libpeas-gtk/plugins/configurable/configurable-plugin.h
@@ -35,12 +35,9 @@ G_BEGIN_DECLS
 
 typedef struct _TestingConfigurablePlugin         TestingConfigurablePlugin;
 typedef struct _TestingConfigurablePluginClass    TestingConfigurablePluginClass;
-typedef struct _TestingConfigurablePluginPrivate  TestingConfigurablePluginPrivate;
 
 struct _TestingConfigurablePlugin {
   PeasExtensionBase parent_instance;
-
-  TestingConfigurablePluginPrivate *priv;
 };
 
 struct _TestingConfigurablePluginClass {
diff --git a/tests/libpeas/plugins/extension-c/extension-c-plugin.h 
b/tests/libpeas/plugins/extension-c/extension-c-plugin.h
index 7fe8357..11a83ac 100644
--- a/tests/libpeas/plugins/extension-c/extension-c-plugin.h
+++ b/tests/libpeas/plugins/extension-c/extension-c-plugin.h
@@ -35,7 +35,6 @@ G_BEGIN_DECLS
 
 typedef struct _TestingExtensionCPlugin         TestingExtensionCPlugin;
 typedef struct _TestingExtensionCPluginClass    TestingExtensionCPluginClass;
-typedef struct _TestingExtensionCPluginPrivate  TestingExtensionCPluginPrivate;
 
 struct _TestingExtensionCPlugin {
   PeasExtensionBase parent_instance;
diff --git a/tests/plugins/builtin/builtin-plugin.c b/tests/plugins/builtin/builtin-plugin.c
index 122cfee..c6a2ffb 100644
--- a/tests/plugins/builtin/builtin-plugin.c
+++ b/tests/plugins/builtin/builtin-plugin.c
@@ -31,9 +31,9 @@
 
 #include "builtin-plugin.h"
 
-struct _TestingBuiltinPluginPrivate {
+typedef struct {
   GObject *object;
-};
+} TestingBuiltinPluginPrivate;
 
 static void peas_activatable_iface_init (PeasActivatableInterface *iface);
 
@@ -41,9 +41,13 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (TestingBuiltinPlugin,
                                 testing_builtin_plugin,
                                 PEAS_TYPE_EXTENSION_BASE,
                                 0,
+                                G_ADD_PRIVATE_DYNAMIC (TestingBuiltinPlugin)
                                 G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
                                                                peas_activatable_iface_init))
 
+#define GET_PRIV(o) \
+  (testing_builtin_plugin_get_instance_private (o))
+
 enum {
   PROP_0,
   PROP_OBJECT
@@ -56,11 +60,12 @@ testing_builtin_plugin_set_property (GObject      *object,
                                      GParamSpec   *pspec)
 {
   TestingBuiltinPlugin *plugin = TESTING_BUILTIN_PLUGIN (object);
+  TestingBuiltinPluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
     case PROP_OBJECT:
-      plugin->priv->object = g_value_get_object (value);
+      priv->object = g_value_get_object (value);
       break;
 
     default:
@@ -76,11 +81,12 @@ testing_builtin_plugin_get_property (GObject    *object,
                                      GParamSpec *pspec)
 {
   TestingBuiltinPlugin *plugin = TESTING_BUILTIN_PLUGIN (object);
+  TestingBuiltinPluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
     case PROP_OBJECT:
-      g_value_set_object (value, plugin->priv->object);
+      g_value_set_object (value, priv->object);
       break;
 
     default:
@@ -92,9 +98,6 @@ testing_builtin_plugin_get_property (GObject    *object,
 static void
 testing_builtin_plugin_init (TestingBuiltinPlugin *plugin)
 {
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
-                                              TESTING_TYPE_BUILTIN_PLUGIN,
-                                              TestingBuiltinPluginPrivate);
 }
 
 static void
@@ -116,8 +119,6 @@ testing_builtin_plugin_class_init (TestingBuiltinPluginClass *klass)
   object_class->get_property = testing_builtin_plugin_get_property;
 
   g_object_class_override_property (object_class, PROP_OBJECT, "object");
-
-  g_type_class_add_private (klass, sizeof (TestingBuiltinPluginPrivate));
 }
 
 static void
diff --git a/tests/plugins/builtin/builtin-plugin.h b/tests/plugins/builtin/builtin-plugin.h
index 3af1062..3bc64dd 100644
--- a/tests/plugins/builtin/builtin-plugin.h
+++ b/tests/plugins/builtin/builtin-plugin.h
@@ -35,12 +35,9 @@ G_BEGIN_DECLS
 
 typedef struct _TestingBuiltinPlugin         TestingBuiltinPlugin;
 typedef struct _TestingBuiltinPluginClass    TestingBuiltinPluginClass;
-typedef struct _TestingBuiltinPluginPrivate  TestingBuiltinPluginPrivate;
 
 struct _TestingBuiltinPlugin {
   PeasExtensionBase parent_instance;
-
-  TestingBuiltinPluginPrivate *priv;
 };
 
 struct _TestingBuiltinPluginClass {
diff --git a/tests/plugins/has-dep/has-dep-plugin.c b/tests/plugins/has-dep/has-dep-plugin.c
index c265244..3c360bc 100644
--- a/tests/plugins/has-dep/has-dep-plugin.c
+++ b/tests/plugins/has-dep/has-dep-plugin.c
@@ -31,9 +31,9 @@
 
 #include "has-dep-plugin.h"
 
-struct _TestingHasDepPluginPrivate {
+typedef struct {
   GObject *object;
-};
+} TestingHasDepPluginPrivate;
 
 static void peas_activatable_iface_init (PeasActivatableInterface *iface);
 
@@ -41,9 +41,13 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (TestingHasDepPlugin,
                                 testing_has_dep_plugin,
                                 PEAS_TYPE_EXTENSION_BASE,
                                 0,
+                                G_ADD_PRIVATE_DYNAMIC (TestingHasDepPlugin)
                                 G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
                                                                peas_activatable_iface_init))
 
+#define GET_PRIV(o) \
+  (testing_has_dep_plugin_get_instance_private (o))
+
 enum {
   PROP_0,
   PROP_OBJECT
@@ -56,11 +60,12 @@ testing_has_dep_plugin_set_property (GObject      *object,
                                      GParamSpec   *pspec)
 {
   TestingHasDepPlugin *plugin = TESTING_HAS_DEP_PLUGIN (object);
+  TestingHasDepPluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
     case PROP_OBJECT:
-      plugin->priv->object = g_value_get_object (value);
+      priv->object = g_value_get_object (value);
       break;
 
     default:
@@ -76,11 +81,12 @@ testing_has_dep_plugin_get_property (GObject    *object,
                                      GParamSpec *pspec)
 {
   TestingHasDepPlugin *plugin = TESTING_HAS_DEP_PLUGIN (object);
+  TestingHasDepPluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
     case PROP_OBJECT:
-      g_value_set_object (value, plugin->priv->object);
+      g_value_set_object (value, priv->object);
       break;
 
     default:
@@ -92,9 +98,6 @@ testing_has_dep_plugin_get_property (GObject    *object,
 static void
 testing_has_dep_plugin_init (TestingHasDepPlugin *plugin)
 {
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
-                                              TESTING_TYPE_HAS_DEP_PLUGIN,
-                                              TestingHasDepPluginPrivate);
 }
 
 static void
@@ -116,8 +119,6 @@ testing_has_dep_plugin_class_init (TestingHasDepPluginClass *klass)
   object_class->get_property = testing_has_dep_plugin_get_property;
 
   g_object_class_override_property (object_class, PROP_OBJECT, "object");
-
-  g_type_class_add_private (klass, sizeof (TestingHasDepPluginPrivate));
 }
 
 static void
diff --git a/tests/plugins/has-dep/has-dep-plugin.h b/tests/plugins/has-dep/has-dep-plugin.h
index 8faec07..c3c4ac1 100644
--- a/tests/plugins/has-dep/has-dep-plugin.h
+++ b/tests/plugins/has-dep/has-dep-plugin.h
@@ -35,12 +35,9 @@ G_BEGIN_DECLS
 
 typedef struct _TestingHasDepPlugin         TestingHasDepPlugin;
 typedef struct _TestingHasDepPluginClass    TestingHasDepPluginClass;
-typedef struct _TestingHasDepPluginPrivate  TestingHasDepPluginPrivate;
 
 struct _TestingHasDepPlugin {
   PeasExtensionBase parent_instance;
-
-  TestingHasDepPluginPrivate *priv;
 };
 
 struct _TestingHasDepPluginClass {
diff --git a/tests/plugins/loadable/loadable-plugin.c b/tests/plugins/loadable/loadable-plugin.c
index 1f9d8fb..9bdc29d 100644
--- a/tests/plugins/loadable/loadable-plugin.c
+++ b/tests/plugins/loadable/loadable-plugin.c
@@ -31,9 +31,9 @@
 
 #include "loadable-plugin.h"
 
-struct _TestingLoadablePluginPrivate {
+typedef struct {
   GObject *object;
-};
+} TestingLoadablePluginPrivate;
 
 /* Used by the local linkage test */
 G_MODULE_EXPORT gpointer global_symbol_clash;
@@ -44,9 +44,13 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (TestingLoadablePlugin,
                                 testing_loadable_plugin,
                                 G_TYPE_OBJECT,
                                 0,
+                                G_ADD_PRIVATE_DYNAMIC (TestingLoadablePlugin)
                                 G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
                                                                peas_activatable_iface_init))
 
+#define GET_PRIV(o) \
+  (testing_loadable_plugin_get_instance_private (o))
+
 enum {
   PROP_0,
   PROP_GLOBAL_SYMBOL_CLASH,
@@ -65,11 +69,12 @@ testing_loadable_plugin_set_property (GObject      *object,
                                       GParamSpec   *pspec)
 {
   TestingLoadablePlugin *plugin = TESTING_LOADABLE_PLUGIN (object);
+  TestingLoadablePluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
     case PROP_OBJECT:
-      plugin->priv->object = g_value_get_object (value);
+      priv->object = g_value_get_object (value);
       break;
 
     default:
@@ -85,6 +90,7 @@ testing_loadable_plugin_get_property (GObject    *object,
                                       GParamSpec *pspec)
 {
   TestingLoadablePlugin *plugin = TESTING_LOADABLE_PLUGIN (object);
+  TestingLoadablePluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
@@ -93,7 +99,7 @@ testing_loadable_plugin_get_property (GObject    *object,
       break;
 
     case PROP_OBJECT:
-      g_value_set_object (value, plugin->priv->object);
+      g_value_set_object (value, priv->object);
       break;
 
     default:
@@ -105,9 +111,6 @@ testing_loadable_plugin_get_property (GObject    *object,
 static void
 testing_loadable_plugin_init (TestingLoadablePlugin *plugin)
 {
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
-                                              TESTING_TYPE_LOADABLE_PLUGIN,
-                                              TestingLoadablePluginPrivate);
 }
 
 static void
@@ -138,8 +141,6 @@ testing_loadable_plugin_class_init (TestingLoadablePluginClass *klass)
                           G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-
-  g_type_class_add_private (klass, sizeof (TestingLoadablePluginPrivate));
 }
 
 static void
diff --git a/tests/plugins/loadable/loadable-plugin.h b/tests/plugins/loadable/loadable-plugin.h
index c134133..b9ced38 100644
--- a/tests/plugins/loadable/loadable-plugin.h
+++ b/tests/plugins/loadable/loadable-plugin.h
@@ -35,15 +35,12 @@ G_BEGIN_DECLS
 
 typedef struct _TestingLoadablePlugin         TestingLoadablePlugin;
 typedef struct _TestingLoadablePluginClass    TestingLoadablePluginClass;
-typedef struct _TestingLoadablePluginPrivate  TestingLoadablePluginPrivate;
 
 struct _TestingLoadablePlugin {
   /* Inherit from GObject and not PeasExtensionBase
    * to check that it is possible
    */
   GObject parent_instance;
-
-  TestingLoadablePluginPrivate *priv;
 };
 
 struct _TestingLoadablePluginClass {
diff --git a/tests/plugins/self-dep/self-dep-plugin.c b/tests/plugins/self-dep/self-dep-plugin.c
index 397a4b5..c73ea5c 100644
--- a/tests/plugins/self-dep/self-dep-plugin.c
+++ b/tests/plugins/self-dep/self-dep-plugin.c
@@ -31,9 +31,9 @@
 
 #include "self-dep-plugin.h"
 
-struct _TestingSelfDepPluginPrivate {
+typedef struct {
   GObject *object;
-};
+} TestingSelfDepPluginPrivate;
 
 static void peas_activatable_iface_init (PeasActivatableInterface *iface);
 
@@ -41,9 +41,13 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (TestingSelfDepPlugin,
                                 testing_self_dep_plugin,
                                 PEAS_TYPE_EXTENSION_BASE,
                                 0,
+                                G_ADD_PRIVATE_DYNAMIC (TestingSelfDepPlugin)
                                 G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
                                                                peas_activatable_iface_init))
 
+#define GET_PRIV(o) \
+  (testing_self_dep_plugin_get_instance_private (o))
+
 enum {
   PROP_0,
   PROP_OBJECT
@@ -56,11 +60,12 @@ testing_self_dep_plugin_set_property (GObject      *object,
                                       GParamSpec   *pspec)
 {
   TestingSelfDepPlugin *plugin = TESTING_SELF_DEP_PLUGIN (object);
+  TestingSelfDepPluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
     case PROP_OBJECT:
-      plugin->priv->object = g_value_get_object (value);
+      priv->object = g_value_get_object (value);
       break;
 
     default:
@@ -76,11 +81,12 @@ testing_self_dep_plugin_get_property (GObject    *object,
                                       GParamSpec *pspec)
 {
   TestingSelfDepPlugin *plugin = TESTING_SELF_DEP_PLUGIN (object);
+  TestingSelfDepPluginPrivate *priv = GET_PRIV (plugin);
 
   switch (prop_id)
     {
     case PROP_OBJECT:
-      g_value_set_object (value, plugin->priv->object);
+      g_value_set_object (value, priv->object);
       break;
 
     default:
@@ -92,9 +98,6 @@ testing_self_dep_plugin_get_property (GObject    *object,
 static void
 testing_self_dep_plugin_init (TestingSelfDepPlugin *plugin)
 {
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
-                                              TESTING_TYPE_SELF_DEP_PLUGIN,
-                                              TestingSelfDepPluginPrivate);
 }
 
 static void
@@ -116,8 +119,6 @@ testing_self_dep_plugin_class_init (TestingSelfDepPluginClass *klass)
   object_class->get_property = testing_self_dep_plugin_get_property;
 
   g_object_class_override_property (object_class, PROP_OBJECT, "object");
-
-  g_type_class_add_private (klass, sizeof (TestingSelfDepPluginPrivate));
 }
 
 static void
diff --git a/tests/plugins/self-dep/self-dep-plugin.h b/tests/plugins/self-dep/self-dep-plugin.h
index 62a2962..2e576b9 100644
--- a/tests/plugins/self-dep/self-dep-plugin.h
+++ b/tests/plugins/self-dep/self-dep-plugin.h
@@ -35,12 +35,9 @@ G_BEGIN_DECLS
 
 typedef struct _TestingSelfDepPlugin         TestingSelfDepPlugin;
 typedef struct _TestingSelfDepPluginClass    TestingSelfDepPluginClass;
-typedef struct _TestingSelfDepPluginPrivate  TestingSelfDepPluginPrivate;
 
 struct _TestingSelfDepPlugin {
   PeasExtensionBase parent_instance;
-
-  TestingSelfDepPluginPrivate *priv;
 };
 
 struct _TestingSelfDepPluginClass {


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