[gtksourceview] The King is Dead



commit d2c849e697c10a5f6d536b9356df23ab3cdde72d
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Jul 8 17:49:32 2013 +0200

    The King is Dead
    
    http://blogs.gnome.org/ebassi/2013/06/21/the-king-is-dead/

 .../words/gtksourcecompletionwords.c               |    7 ++-----
 .../words/gtksourcecompletionwordsbuffer.c         |    8 ++------
 .../words/gtksourcecompletionwordslibrary.c        |    8 ++------
 .../words/gtksourcecompletionwordsproposal.c       |    8 ++------
 gtksourceview/gtksourcebuffer.c                    |    9 ++-------
 gtksourceview/gtksourcecompletion.c                |   10 ++--------
 gtksourceview/gtksourcecompletioncontainer.c       |   11 ++---------
 gtksourceview/gtksourcecompletioncontext.c         |    8 ++------
 gtksourceview/gtksourcecompletioninfo.c            |    8 ++------
 gtksourceview/gtksourcecompletionitem.c            |    7 ++-----
 gtksourceview/gtksourcecompletionmodel.c           |    7 ++-----
 gtksourceview/gtksourcecontextengine.c             |    7 ++-----
 gtksourceview/gtksourceengine.c                    |    1 -
 gtksourceview/gtksourcegutter.c                    |    9 ++-------
 gtksourceview/gtksourcegutterrenderer.c            |   10 ++--------
 gtksourceview/gtksourcegutterrendererlines.c       |    8 ++------
 gtksourceview/gtksourcegutterrenderermarks.c       |    5 -----
 gtksourceview/gtksourcegutterrendererpixbuf.c      |    8 ++------
 gtksourceview/gtksourcegutterrenderertext.c        |    8 ++------
 gtksourceview/gtksourcelanguage.c                  |    8 +++-----
 gtksourceview/gtksourcelanguagemanager.c           |    8 ++------
 gtksourceview/gtksourcemark.c                      |    7 ++-----
 gtksourceview/gtksourcemarkattributes.c            |    8 ++------
 gtksourceview/gtksourceprintcompositor.c           |    8 ++------
 gtksourceview/gtksourcestylescheme.c               |    7 ++-----
 gtksourceview/gtksourcestyleschememanager.c        |   10 ++--------
 gtksourceview/gtksourceundomanagerdefault.c        |    7 ++-----
 gtksourceview/gtksourceview.c                      |    8 ++------
 28 files changed, 53 insertions(+), 165 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c 
b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
index 462166e..a639b56 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwords.c
@@ -40,8 +40,6 @@
 
 #include <string.h>
 
-#define GTK_SOURCE_COMPLETION_WORDS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_COMPLETION_WORDS, GtkSourceCompletionWordsPrivate))
-
 #define BUFFER_KEY "GtkSourceCompletionWordsBufferKey"
 
 enum
@@ -95,6 +93,7 @@ static void gtk_source_completion_words_iface_init (GtkSourceCompletionProviderI
 G_DEFINE_TYPE_WITH_CODE (GtkSourceCompletionWords,
                         gtk_source_completion_words,
                         G_TYPE_OBJECT,
+                        G_ADD_PRIVATE (GtkSourceCompletionWords)
                         G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
                                                gtk_source_completion_words_iface_init))
 
@@ -506,8 +505,6 @@ gtk_source_completion_words_class_init (GtkSourceCompletionWordsClass *klass)
                                                             GTK_SOURCE_COMPLETION_ACTIVATION_INTERACTIVE |
                                                             GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED,
                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceCompletionWordsPrivate));
 }
 
 static gboolean
@@ -564,7 +561,7 @@ gtk_source_completion_words_iface_init (GtkSourceCompletionProviderIface *iface)
 static void
 gtk_source_completion_words_init (GtkSourceCompletionWords *self)
 {
-       self->priv = GTK_SOURCE_COMPLETION_WORDS_GET_PRIVATE (self);
+       self->priv = gtk_source_completion_words_get_instance_private (self);
 
        self->priv->library = gtk_source_completion_words_library_new ();
 }
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c 
b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
index b5117f1..ed5250d 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
@@ -24,8 +24,6 @@
 #include "gtksourcecompletionwordsutils.h"
 #include "gtksourceview/gtktextregion.h"
 
-#define GTK_SOURCE_COMPLETION_WORDS_BUFFER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_COMPLETION_WORDS_BUFFER, GtkSourceCompletionWordsBufferPrivate))
-
 /* Timeout in seconds */
 #define INITIATE_SCAN_TIMEOUT 5
 
@@ -53,7 +51,7 @@ struct _GtkSourceCompletionWordsBufferPrivate
        GHashTable *words;
 };
 
-G_DEFINE_TYPE (GtkSourceCompletionWordsBuffer, gtk_source_completion_words_buffer, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceCompletionWordsBuffer, gtk_source_completion_words_buffer, 
G_TYPE_OBJECT)
 
 static ProposalCache *
 proposal_cache_new (GtkSourceCompletionWordsProposal *proposal)
@@ -140,14 +138,12 @@ gtk_source_completion_words_buffer_class_init (GtkSourceCompletionWordsBufferCla
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
        object_class->dispose = gtk_source_completion_words_buffer_dispose;
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceCompletionWordsBufferPrivate));
 }
 
 static void
 gtk_source_completion_words_buffer_init (GtkSourceCompletionWordsBuffer *self)
 {
-       self->priv = GTK_SOURCE_COMPLETION_WORDS_BUFFER_GET_PRIVATE (self);
+       self->priv = gtk_source_completion_words_buffer_get_instance_private (self);
 
        self->priv->scan_batch_size = 20;
        self->priv->minimum_word_size = 3;
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwordslibrary.c 
b/gtksourceview/completion-providers/words/gtksourcecompletionwordslibrary.c
index 8f70fd2..69afa3c 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwordslibrary.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwordslibrary.c
@@ -24,8 +24,6 @@
 
 #include <string.h>
 
-#define GTK_SOURCE_COMPLETION_WORDS_LIBRARY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_COMPLETION_WORDS_LIBRARY, GtkSourceCompletionWordsLibraryPrivate))
-
 enum
 {
        LOCK,
@@ -41,7 +39,7 @@ struct _GtkSourceCompletionWordsLibraryPrivate
 
 static guint signals[NUM_SIGNALS] = {0,};
 
-G_DEFINE_TYPE (GtkSourceCompletionWordsLibrary, gtk_source_completion_words_library, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceCompletionWordsLibrary, gtk_source_completion_words_library, 
G_TYPE_OBJECT)
 
 static void
 gtk_source_completion_words_library_finalize (GObject *object)
@@ -81,14 +79,12 @@ gtk_source_completion_words_library_class_init (GtkSourceCompletionWordsLibraryC
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE,
                              0);
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceCompletionWordsLibraryPrivate));
 }
 
 static void
 gtk_source_completion_words_library_init (GtkSourceCompletionWordsLibrary *self)
 {
-       self->priv = GTK_SOURCE_COMPLETION_WORDS_LIBRARY_GET_PRIVATE (self);
+       self->priv = gtk_source_completion_words_library_get_instance_private (self);
 
        self->priv->store = g_sequence_new ((GDestroyNotify)g_object_unref);
 }
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c 
b/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c
index 70bee87..f8d30fd 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwordsproposal.c
@@ -21,8 +21,6 @@
 
 #include "gtksourcecompletionwordsproposal.h"
 
-#define GTK_SOURCE_COMPLETION_WORDS_PROPOSAL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_COMPLETION_WORDS_PROPOSAL, GtkSourceCompletionWordsProposalPrivate))
-
 struct _GtkSourceCompletionWordsProposalPrivate
 {
        gchar *word;
@@ -42,6 +40,7 @@ static void gtk_source_completion_proposal_iface_init (gpointer g_iface, gpointe
 G_DEFINE_TYPE_WITH_CODE (GtkSourceCompletionWordsProposal,
                         gtk_source_completion_words_proposal,
                         G_TYPE_OBJECT,
+                        G_ADD_PRIVATE (GtkSourceCompletionWordsProposal)
                         G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROPOSAL,
                                                gtk_source_completion_proposal_iface_init))
 
@@ -90,15 +89,12 @@ gtk_source_completion_words_proposal_class_init (GtkSourceCompletionWordsProposa
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE,
                              0);
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceCompletionWordsProposalPrivate));
 }
 
 static void
 gtk_source_completion_words_proposal_init (GtkSourceCompletionWordsProposal *self)
 {
-       self->priv = GTK_SOURCE_COMPLETION_WORDS_PROPOSAL_GET_PRIVATE (self);
-
+       self->priv = gtk_source_completion_words_proposal_get_instance_private (self);
        self->priv->use_count = 1;
 }
 
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 4828fc5..2170219 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -146,7 +146,7 @@ struct _GtkSourceBufferPrivate
        guint                  allow_bracket_match : 1;
 };
 
-G_DEFINE_TYPE (GtkSourceBuffer, gtk_source_buffer, GTK_TYPE_TEXT_BUFFER)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceBuffer, gtk_source_buffer, GTK_TYPE_TEXT_BUFFER)
 
 static guint    buffer_signals[LAST_SIGNAL];
 
@@ -408,8 +408,6 @@ gtk_source_buffer_class_init (GtkSourceBufferClass *klass)
                          G_TYPE_NONE, 2,
                          GTK_TYPE_TEXT_ITER,
                          GTK_SOURCE_TYPE_BRACKET_MATCH_TYPE);
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceBufferPrivate));
 }
 
 static void
@@ -458,10 +456,7 @@ set_undo_manager (GtkSourceBuffer      *buffer,
 static void
 gtk_source_buffer_init (GtkSourceBuffer *buffer)
 {
-       GtkSourceBufferPrivate *priv;
-
-       priv = G_TYPE_INSTANCE_GET_PRIVATE (buffer, GTK_SOURCE_TYPE_BUFFER,
-                                           GtkSourceBufferPrivate);
+       GtkSourceBufferPrivate *priv = gtk_source_buffer_get_instance_private (buffer);
 
        buffer->priv = priv;
 
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index f012fb1..b0ec25a 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -87,10 +87,6 @@
 #include "gtksourceview-marshal.h"
 #include "gtksourceview-i18n.h"
 
-#define GTK_SOURCE_COMPLETION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),\
-                                                 GTK_SOURCE_TYPE_COMPLETION,           \
-                                                 GtkSourceCompletionPrivate))
-
 /* Signals */
 enum
 {
@@ -185,7 +181,7 @@ struct _GtkSourceCompletionPrivate
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE(GtkSourceCompletion, gtk_source_completion, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceCompletion, gtk_source_completion, G_TYPE_OBJECT)
 
 static void
 scroll_to_iter (GtkSourceCompletion *completion,
@@ -1708,8 +1704,6 @@ gtk_source_completion_class_init (GtkSourceCompletionClass *klass)
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
        GtkBindingSet *binding_set;
 
-       g_type_class_add_private (klass, sizeof (GtkSourceCompletionPrivate));
-
        object_class->get_property = gtk_source_completion_get_property;
        object_class->set_property = gtk_source_completion_set_property;
        object_class->dispose = gtk_source_completion_dispose;
@@ -2311,7 +2305,7 @@ gtk_source_completion_init (GtkSourceCompletion *completion)
        GtkSourceCompletionContainer *container = _gtk_source_completion_container_new ();
        g_object_ref_sink (container);
 
-       completion->priv = GTK_SOURCE_COMPLETION_GET_PRIVATE (completion);
+       completion->priv = gtk_source_completion_get_instance_private (completion);
 
        gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
 
diff --git a/gtksourceview/gtksourcecompletioncontainer.c b/gtksourceview/gtksourcecompletioncontainer.c
index 28bfad2..57203c8 100644
--- a/gtksourceview/gtksourcecompletioncontainer.c
+++ b/gtksourceview/gtksourcecompletioncontainer.c
@@ -44,12 +44,7 @@ struct _GtkSourceCompletionContainerPrivate
        GtkWidget *scrolled_window;
 };
 
-G_DEFINE_TYPE (GtkSourceCompletionContainer, _gtk_source_completion_container, GTK_TYPE_BIN);
-
-#define GTK_SOURCE_COMPLETION_CONTAINER_GET_PRIVATE(object)                    \
-       (G_TYPE_INSTANCE_GET_PRIVATE ((object),                                 \
-                                     GTK_SOURCE_TYPE_COMPLETION_CONTAINER,     \
-                                     GtkSourceCompletionContainerPrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceCompletionContainer, _gtk_source_completion_container, GTK_TYPE_BIN);
 
 /* gtk_container_add() is overridden. This function calls the GtkBin's add(). */
 static void
@@ -292,7 +287,7 @@ _gtk_source_completion_container_add (GtkContainer *gtk_container,
 static void
 _gtk_source_completion_container_init (GtkSourceCompletionContainer *container)
 {
-       container->priv = GTK_SOURCE_COMPLETION_CONTAINER_GET_PRIVATE (container);
+       container->priv = _gtk_source_completion_container_get_instance_private (container);
 
        container->priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
        g_object_ref_sink (container->priv->scrolled_window);
@@ -324,8 +319,6 @@ _gtk_source_completion_container_class_init (GtkSourceCompletionContainerClass *
        widget_class->get_preferred_height = _gtk_source_completion_container_get_preferred_height;
 
        container_class->add = _gtk_source_completion_container_add;
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceCompletionContainerPrivate));
 }
 
 GtkSourceCompletionContainer *
diff --git a/gtksourceview/gtksourcecompletioncontext.c b/gtksourceview/gtksourcecompletioncontext.c
index 50b4c24..41e6b9d 100644
--- a/gtksourceview/gtksourcecompletioncontext.c
+++ b/gtksourceview/gtksourcecompletioncontext.c
@@ -66,8 +66,6 @@
 #include "gtksourceview-i18n.h"
 #include "gtksourcecompletion.h"
 
-#define GTK_SOURCE_COMPLETION_CONTEXT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_COMPLETION_CONTEXT, GtkSourceCompletionContextPrivate))
-
 struct _GtkSourceCompletionContextPrivate
 {
        GtkSourceCompletion *completion;
@@ -97,7 +95,7 @@ enum
 
 guint context_signals[NUM_SIGNALS] = {0,};
 
-G_DEFINE_TYPE (GtkSourceCompletionContext, gtk_source_completion_context, G_TYPE_INITIALLY_UNOWNED)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceCompletionContext, gtk_source_completion_context, 
G_TYPE_INITIALLY_UNOWNED)
 
 /* FIXME: we use this util to get the buffer from the completion
    but this object is not robust to a change of the buffer associated
@@ -303,14 +301,12 @@ gtk_source_completion_context_class_init (GtkSourceCompletionContextClass *klass
                                                             GTK_SOURCE_TYPE_COMPLETION_ACTIVATION,
                                                             GTK_SOURCE_COMPLETION_ACTIVATION_NONE,
                                                             G_PARAM_READWRITE));
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceCompletionContextPrivate));
 }
 
 static void
 gtk_source_completion_context_init (GtkSourceCompletionContext *context)
 {
-       context->priv = GTK_SOURCE_COMPLETION_CONTEXT_GET_PRIVATE (context);
+       context->priv = gtk_source_completion_context_get_instance_private (context);
 }
 
 /**
diff --git a/gtksourceview/gtksourcecompletioninfo.c b/gtksourceview/gtksourcecompletioninfo.c
index fafc69e..d793ede 100644
--- a/gtksourceview/gtksourcecompletioninfo.c
+++ b/gtksourceview/gtksourcecompletioninfo.c
@@ -76,9 +76,7 @@ enum
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE(GtkSourceCompletionInfo, gtk_source_completion_info, GTK_TYPE_WINDOW);
-
-#define GTK_SOURCE_COMPLETION_INFO_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), 
GTK_SOURCE_TYPE_COMPLETION_INFO, GtkSourceCompletionInfoPrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceCompletionInfo, gtk_source_completion_info, GTK_TYPE_WINDOW);
 
 /* Resize the window */
 
@@ -227,7 +225,7 @@ update_attached_to (GtkSourceCompletionInfo *info)
 static void
 gtk_source_completion_info_init (GtkSourceCompletionInfo *info)
 {
-       info->priv = GTK_SOURCE_COMPLETION_INFO_GET_PRIVATE (info);
+       info->priv = gtk_source_completion_info_get_instance_private (info);
 
        g_signal_connect (info,
                          "notify::attached-to",
@@ -327,8 +325,6 @@ gtk_source_completion_info_class_init (GtkSourceCompletionInfoClass *klass)
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE,
                              0);
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceCompletionInfoPrivate));
 }
 
 /* Move to iter */
diff --git a/gtksourceview/gtksourcecompletionitem.c b/gtksourceview/gtksourcecompletionitem.c
index 8d12ff7..0372f20 100644
--- a/gtksourceview/gtksourcecompletionitem.c
+++ b/gtksourceview/gtksourcecompletionitem.c
@@ -32,8 +32,6 @@
 #include "gtksourcecompletionproposal.h"
 #include "gtksourceview-i18n.h"
 
-#define GTK_SOURCE_COMPLETION_ITEM_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_COMPLETION_ITEM, GtkSourceCompletionItemPrivate))
-
 struct _GtkSourceCompletionItemPrivate
 {
        gchar *label;
@@ -59,6 +57,7 @@ static void gtk_source_completion_proposal_iface_init (gpointer g_iface, gpointe
 G_DEFINE_TYPE_WITH_CODE (GtkSourceCompletionItem,
                         gtk_source_completion_item,
                         G_TYPE_OBJECT,
+                        G_ADD_PRIVATE (GtkSourceCompletionItem)
                         G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROPOSAL,
                                                gtk_source_completion_proposal_iface_init))
 
@@ -290,14 +289,12 @@ gtk_source_completion_item_class_init (GtkSourceCompletionItemClass *klass)
                                                              _("Info to be shown for this item"),
                                                              NULL,
                                                              G_PARAM_READWRITE));
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceCompletionItemPrivate));
 }
 
 static void
 gtk_source_completion_item_init (GtkSourceCompletionItem *self)
 {
-       self->priv = GTK_SOURCE_COMPLETION_ITEM_GET_PRIVATE (self);
+       self->priv = gtk_source_completion_item_get_instance_private (self);
 }
 
 /**
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index 55cc1bc..0430a2a 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -25,8 +25,6 @@
 #include "gtksourcecompletionproposal.h"
 #include "gtksourceview-i18n.h"
 
-#define GTK_SOURCE_COMPLETION_MODEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_COMPLETION_MODEL, GtkSourceCompletionModelPrivate))
-
 typedef struct
 {
        GtkSourceCompletionModel *model;
@@ -73,6 +71,7 @@ static void tree_model_iface_init (gpointer g_iface, gpointer iface_data);
 G_DEFINE_TYPE_WITH_CODE (GtkSourceCompletionModel,
                          gtk_source_completion_model,
                          G_TYPE_OBJECT,
+                        G_ADD_PRIVATE (GtkSourceCompletionModel)
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
                                                 tree_model_iface_init))
 
@@ -716,14 +715,12 @@ gtk_source_completion_model_class_init (GtkSourceCompletionModelClass *klass)
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
        object_class->dispose = gtk_source_completion_model_dispose;
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceCompletionModelPrivate));
 }
 
 static void
 gtk_source_completion_model_init (GtkSourceCompletionModel *self)
 {
-       self->priv = GTK_SOURCE_COMPLETION_MODEL_GET_PRIVATE (self);
+       self->priv = gtk_source_completion_model_get_instance_private (self);
 
        self->priv->column_types[GTK_SOURCE_COMPLETION_MODEL_COLUMN_MARKUP] = G_TYPE_STRING;
        self->priv->column_types[GTK_SOURCE_COMPLETION_MODEL_COLUMN_ICON] = GDK_TYPE_PIXBUF;
diff --git a/gtksourceview/gtksourcecontextengine.c b/gtksourceview/gtksourcecontextengine.c
index 907ab3c..1e76962 100644
--- a/gtksourceview/gtksourcecontextengine.c
+++ b/gtksourceview/gtksourcecontextengine.c
@@ -2404,7 +2404,7 @@ install_first_update (GtkSourceContextEngine *ce)
 
 /* GtkSourceContextEngine class ------------------------------------------- */
 
-G_DEFINE_TYPE (GtkSourceContextEngine, _gtk_source_context_engine, GTK_SOURCE_TYPE_ENGINE)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceContextEngine, _gtk_source_context_engine, GTK_SOURCE_TYPE_ENGINE)
 
 static GQuark
 gtk_source_context_engine_error_quark (void)
@@ -2697,15 +2697,12 @@ _gtk_source_context_engine_class_init (GtkSourceContextEngineClass *klass)
        engine_class->update_highlight = gtk_source_context_engine_update_highlight;
        engine_class->set_style_scheme = gtk_source_context_engine_set_style_scheme;
        engine_class->get_context_class_tag = gtk_source_context_engine_get_context_class_tag;
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceContextEnginePrivate));
 }
 
 static void
 _gtk_source_context_engine_init (GtkSourceContextEngine *ce)
 {
-       ce->priv = G_TYPE_INSTANCE_GET_PRIVATE (ce, GTK_SOURCE_TYPE_CONTEXT_ENGINE,
-                                               GtkSourceContextEnginePrivate);
+       ce->priv = _gtk_source_context_engine_get_instance_private (ce);
 }
 
 GtkSourceContextEngine *
diff --git a/gtksourceview/gtksourceengine.c b/gtksourceview/gtksourceengine.c
index be8efb9..5e3f732 100644
--- a/gtksourceview/gtksourceengine.c
+++ b/gtksourceview/gtksourceengine.c
@@ -29,7 +29,6 @@
 
 G_DEFINE_TYPE (GtkSourceEngine, _gtk_source_engine, G_TYPE_OBJECT)
 
-
 static void
 _gtk_source_engine_class_init (GtkSourceEngineClass *klass)
 {
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index 0539ca0..6585b83 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -50,8 +50,6 @@
  *
  */
 
-#define GTK_SOURCE_GUTTER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GTK_SOURCE_TYPE_GUTTER, 
GtkSourceGutterPrivate))
-
 /* Properties */
 enum
 {
@@ -105,7 +103,7 @@ struct _GtkSourceGutterPrivate
        guint is_drawing : 1;
 };
 
-G_DEFINE_TYPE (GtkSourceGutter, gtk_source_gutter, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceGutter, gtk_source_gutter, G_TYPE_OBJECT)
 
 static gboolean on_view_draw (GtkSourceView   *view,
                               cairo_t         *cr,
@@ -567,9 +565,6 @@ gtk_source_gutter_class_init (GtkSourceGutterClass *klass)
                                                            0,
                                                            G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
-       g_type_class_add_private (object_class, sizeof(GtkSourceGutterPrivate));
-
-
        g_object_class_install_property (object_class,
                                         PROP_XPAD,
                                         g_param_spec_int ("xpad",
@@ -595,7 +590,7 @@ gtk_source_gutter_class_init (GtkSourceGutterClass *klass)
 static void
 gtk_source_gutter_init (GtkSourceGutter *self)
 {
-       self->priv = GTK_SOURCE_GUTTER_GET_PRIVATE (self);
+       self->priv = gtk_source_gutter_get_instance_private (self);
 }
 
 static gint
diff --git a/gtksourceview/gtksourcegutterrenderer.c b/gtksourceview/gtksourcegutterrenderer.c
index 75d7fda..508e686 100644
--- a/gtksourceview/gtksourcegutterrenderer.c
+++ b/gtksourceview/gtksourcegutterrenderer.c
@@ -25,8 +25,6 @@
 #include "gtksourceview-typebuiltins.h"
 #include "gtksourceview-i18n.h"
 
-#define GTK_SOURCE_GUTTER_RENDERER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_GUTTER_RENDERER, GtkSourceGutterRendererPrivate))
-
 enum
 {
        ACTIVATE,
@@ -62,9 +60,7 @@ struct _GtkSourceGutterRendererPrivate
 
 static guint signals[NUM_SIGNALS] = {0,};
 
-G_DEFINE_ABSTRACT_TYPE (GtkSourceGutterRenderer,
-                        gtk_source_gutter_renderer,
-                        G_TYPE_INITIALLY_UNOWNED)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkSourceGutterRenderer, gtk_source_gutter_renderer, 
G_TYPE_INITIALLY_UNOWNED)
 
 enum
 {
@@ -472,8 +468,6 @@ gtk_source_gutter_renderer_class_init (GtkSourceGutterRendererClass *klass)
        klass->draw = renderer_draw_impl;
        klass->change_view = renderer_change_view_impl;
 
-       g_type_class_add_private (object_class, sizeof (GtkSourceGutterRendererPrivate));
-
        /**
         * GtkSourceGutterRenderer:visible:
         *
@@ -756,7 +750,7 @@ gtk_source_gutter_renderer_class_init (GtkSourceGutterRendererClass *klass)
 static void
 gtk_source_gutter_renderer_init (GtkSourceGutterRenderer *self)
 {
-       self->priv = GTK_SOURCE_GUTTER_RENDERER_GET_PRIVATE (self);
+       self->priv = gtk_source_gutter_renderer_get_instance_private (self);
 }
 
 /**
diff --git a/gtksourceview/gtksourcegutterrendererlines.c b/gtksourceview/gtksourcegutterrendererlines.c
index d04a586..32afd54 100644
--- a/gtksourceview/gtksourcegutterrendererlines.c
+++ b/gtksourceview/gtksourcegutterrendererlines.c
@@ -22,8 +22,6 @@
 #include "gtksourcegutterrendererlines.h"
 #include "gtksourceview.h"
 
-#define GTK_SOURCE_GUTTER_RENDERER_LINES_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_GUTTER_RENDERER_LINES, GtkSourceGutterRendererLinesPrivate))
-
 struct _GtkSourceGutterRendererLinesPrivate
 {
        gint num_line_digits;
@@ -31,7 +29,7 @@ struct _GtkSourceGutterRendererLinesPrivate
        guint changed_handler_id;
 };
 
-G_DEFINE_TYPE (GtkSourceGutterRendererLines, gtk_source_gutter_renderer_lines, 
GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceGutterRendererLines, gtk_source_gutter_renderer_lines, 
GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT)
 
 static void
 gtk_source_gutter_renderer_lines_finalize (GObject *object)
@@ -289,14 +287,12 @@ gtk_source_gutter_renderer_lines_class_init (GtkSourceGutterRendererLinesClass *
        renderer_class->query_activatable = gutter_renderer_query_activatable;
        renderer_class->activate = gutter_renderer_activate;
        renderer_class->change_buffer = gutter_renderer_change_buffer;
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceGutterRendererLinesPrivate));
 }
 
 static void
 gtk_source_gutter_renderer_lines_init (GtkSourceGutterRendererLines *self)
 {
-       self->priv = GTK_SOURCE_GUTTER_RENDERER_LINES_GET_PRIVATE (self);
+       self->priv = gtk_source_gutter_renderer_lines_get_instance_private (self);
 }
 
 GtkSourceGutterRenderer *
diff --git a/gtksourceview/gtksourcegutterrenderermarks.c b/gtksourceview/gtksourcegutterrenderermarks.c
index 2190753..97c1af0 100644
--- a/gtksourceview/gtksourcegutterrenderermarks.c
+++ b/gtksourceview/gtksourcegutterrenderermarks.c
@@ -27,8 +27,6 @@
 
 #define COMPOSITE_ALPHA                 225
 
-#define GTK_SOURCE_GUTTER_RENDERER_MARKS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_GUTTER_RENDERER_MARKS, GtkSourceGutterRendererMarksPrivate))
-
 struct _GtkSourceGutterRendererMarksPrivate
 {
 };
@@ -442,14 +440,11 @@ gtk_source_gutter_renderer_marks_class_init (GtkSourceGutterRendererMarksClass *
        renderer_class->query_tooltip = gutter_renderer_query_tooltip;
        renderer_class->query_activatable = gutter_renderer_query_activatable;
        renderer_class->change_view = gutter_renderer_change_view;
-
-       /*g_type_class_add_private (object_class, sizeof (GtkSourceGutterRendererMarksPrivate));*/
 }
 
 static void
 gtk_source_gutter_renderer_marks_init (GtkSourceGutterRendererMarks *self)
 {
-       /*self->priv = GTK_SOURCE_GUTTER_RENDERER_MARKS_GET_PRIVATE (self);*/
 }
 
 GtkSourceGutterRenderer *
diff --git a/gtksourceview/gtksourcegutterrendererpixbuf.c b/gtksourceview/gtksourcegutterrendererpixbuf.c
index 5666baf..ece47ae 100644
--- a/gtksourceview/gtksourcegutterrendererpixbuf.c
+++ b/gtksourceview/gtksourcegutterrendererpixbuf.c
@@ -24,14 +24,12 @@
 #include "gtksourceview-i18n.h"
 #include "gtksourcepixbufhelper.h"
 
-#define GTK_SOURCE_GUTTER_RENDERER_PIXBUF_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_GUTTER_RENDERER_PIXBUF, GtkSourceGutterRendererPixbufPrivate))
-
 struct _GtkSourceGutterRendererPixbufPrivate
 {
        GtkSourcePixbufHelper *helper;
 };
 
-G_DEFINE_TYPE (GtkSourceGutterRendererPixbuf, gtk_source_gutter_renderer_pixbuf, 
GTK_SOURCE_TYPE_GUTTER_RENDERER)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceGutterRendererPixbuf, gtk_source_gutter_renderer_pixbuf, 
GTK_SOURCE_TYPE_GUTTER_RENDERER)
 
 enum
 {
@@ -285,8 +283,6 @@ gtk_source_gutter_renderer_pixbuf_class_init (GtkSourceGutterRendererPixbufClass
 
        renderer_class->draw = gutter_renderer_pixbuf_draw;
 
-       g_type_class_add_private (object_class, sizeof (GtkSourceGutterRendererPixbufPrivate));
-
        g_object_class_install_property (object_class,
                                         PROP_PIXBUF,
                                         g_param_spec_object ("pixbuf",
@@ -330,7 +326,7 @@ gtk_source_gutter_renderer_pixbuf_class_init (GtkSourceGutterRendererPixbufClass
 static void
 gtk_source_gutter_renderer_pixbuf_init (GtkSourceGutterRendererPixbuf *self)
 {
-       self->priv = GTK_SOURCE_GUTTER_RENDERER_PIXBUF_GET_PRIVATE (self);
+       self->priv = gtk_source_gutter_renderer_pixbuf_get_instance_private (self);
 
        self->priv->helper = gtk_source_pixbuf_helper_new ();
 }
diff --git a/gtksourceview/gtksourcegutterrenderertext.c b/gtksourceview/gtksourcegutterrenderertext.c
index ec9e91e..8ea08bd 100644
--- a/gtksourceview/gtksourcegutterrenderertext.c
+++ b/gtksourceview/gtksourcegutterrenderertext.c
@@ -22,8 +22,6 @@
 #include "gtksourcegutterrenderertext.h"
 #include "gtksourceview-i18n.h"
 
-#define GTK_SOURCE_GUTTER_RENDERER_TEXT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT, GtkSourceGutterRendererTextPrivate))
-
 struct _GtkSourceGutterRendererTextPrivate
 {
        gchar *text;
@@ -35,7 +33,7 @@ struct _GtkSourceGutterRendererTextPrivate
        guint is_markup : 1;
 };
 
-G_DEFINE_TYPE (GtkSourceGutterRendererText, gtk_source_gutter_renderer_text, GTK_SOURCE_TYPE_GUTTER_RENDERER)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceGutterRendererText, gtk_source_gutter_renderer_text, 
GTK_SOURCE_TYPE_GUTTER_RENDERER)
 
 enum
 {
@@ -387,8 +385,6 @@ gtk_source_gutter_renderer_text_class_init (GtkSourceGutterRendererTextClass *kl
        renderer_class->draw = gutter_renderer_text_draw;
        renderer_class->end = gutter_renderer_text_end;
 
-       g_type_class_add_private (object_class, sizeof (GtkSourceGutterRendererTextPrivate));
-
        g_object_class_install_property (object_class,
                                         PROP_MARKUP,
                                         g_param_spec_string ("markup",
@@ -409,7 +405,7 @@ gtk_source_gutter_renderer_text_class_init (GtkSourceGutterRendererTextClass *kl
 static void
 gtk_source_gutter_renderer_text_init (GtkSourceGutterRendererText *self)
 {
-       self->priv = GTK_SOURCE_GUTTER_RENDERER_TEXT_GET_PRIVATE (self);
+       self->priv = gtk_source_gutter_renderer_text_get_instance_private (self);
 
        self->priv->is_markup = TRUE;
 }
diff --git a/gtksourceview/gtksourcelanguage.c b/gtksourceview/gtksourcelanguage.c
index b42921d..b5447fc 100644
--- a/gtksourceview/gtksourcelanguage.c
+++ b/gtksourceview/gtksourcelanguage.c
@@ -63,7 +63,7 @@ enum {
        PROP_HIDDEN
 };
 
-G_DEFINE_TYPE (GtkSourceLanguage, gtk_source_language, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceLanguage, gtk_source_language, G_TYPE_OBJECT)
 
 static GtkSourceLanguage *process_language_node (xmlTextReaderPtr       reader,
                                                 const gchar            *filename);
@@ -253,15 +253,13 @@ gtk_source_language_class_init (GtkSourceLanguageClass *klass)
                                                               _("Whether the language should be hidden from 
the user"),
                                                               FALSE,
                                                               G_PARAM_READABLE));
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceLanguagePrivate));
 }
 
 static void
 gtk_source_language_init (GtkSourceLanguage *lang)
 {
-       lang->priv = G_TYPE_INSTANCE_GET_PRIVATE (lang, GTK_SOURCE_TYPE_LANGUAGE,
-                                                 GtkSourceLanguagePrivate);
+       lang->priv = gtk_source_language_get_instance_private (lang);
+
        lang->priv->styles = g_hash_table_new_full (g_str_hash,
                                                    g_str_equal,
                                                    g_free,
diff --git a/gtksourceview/gtksourcelanguagemanager.c b/gtksourceview/gtksourcelanguagemanager.c
index 9acf58a..5af9872 100644
--- a/gtksourceview/gtksourcelanguagemanager.c
+++ b/gtksourceview/gtksourcelanguagemanager.c
@@ -65,8 +65,7 @@ struct _GtkSourceLanguageManagerPrivate
        gchar          **ids; /* Cache the IDs of the available languages */
 };
 
-G_DEFINE_TYPE (GtkSourceLanguageManager, gtk_source_language_manager, G_TYPE_OBJECT)
-
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceLanguageManager, gtk_source_language_manager, G_TYPE_OBJECT)
 
 static void
 gtk_source_language_manager_set_property (GObject      *object,
@@ -162,15 +161,12 @@ gtk_source_language_manager_class_init (GtkSourceLanguageManagerClass *klass)
                                                               "languages"),
                                                             G_TYPE_STRV,
                                                             G_PARAM_READABLE));
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceLanguageManagerPrivate));
 }
 
 static void
 gtk_source_language_manager_init (GtkSourceLanguageManager *lm)
 {
-       lm->priv = G_TYPE_INSTANCE_GET_PRIVATE (lm, GTK_SOURCE_TYPE_LANGUAGE_MANAGER,
-                                               GtkSourceLanguageManagerPrivate);
+       lm->priv = gtk_source_language_manager_get_instance_private (lm);
        lm->priv->language_ids = NULL;
        lm->priv->ids = NULL;
        lm->priv->lang_dirs = NULL;
diff --git a/gtksourceview/gtksourcemark.c b/gtksourceview/gtksourcemark.c
index f05cfbc..01d11a7 100644
--- a/gtksourceview/gtksourcemark.c
+++ b/gtksourceview/gtksourcemark.c
@@ -53,7 +53,7 @@ struct _GtkSourceMarkPrivate
        gchar *category;
 };
 
-G_DEFINE_TYPE (GtkSourceMark, gtk_source_mark, GTK_TYPE_TEXT_MARK);
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceMark, gtk_source_mark, GTK_TYPE_TEXT_MARK);
 
 static void
 gtk_source_mark_set_property (GObject      *object,
@@ -140,15 +140,12 @@ gtk_source_mark_class_init (GtkSourceMarkClass *klass)
                                                              _("The mark category"),
                                                              NULL,
                                                              G_PARAM_READABLE | G_PARAM_WRITABLE | 
G_PARAM_CONSTRUCT_ONLY));
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceMarkPrivate));
 }
 
 static void
 gtk_source_mark_init (GtkSourceMark *mark)
 {
-       mark->priv = G_TYPE_INSTANCE_GET_PRIVATE (mark, GTK_SOURCE_TYPE_MARK,
-                                                 GtkSourceMarkPrivate);
+       mark->priv = gtk_source_mark_get_instance_private (mark);
 }
 
 /**
diff --git a/gtksourceview/gtksourcemarkattributes.c b/gtksourceview/gtksourcemarkattributes.c
index 972571d..9249e2d 100644
--- a/gtksourceview/gtksourcemarkattributes.c
+++ b/gtksourceview/gtksourcemarkattributes.c
@@ -80,8 +80,6 @@
  * takes precedence.
  */
 
-#define GTK_SOURCE_MARK_ATTRIBUTES_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), 
GTK_SOURCE_TYPE_MARK_ATTRIBUTES, GtkSourceMarkAttributesPrivate))
-
 struct _GtkSourceMarkAttributesPrivate
 {
        GdkRGBA background;
@@ -91,7 +89,7 @@ struct _GtkSourceMarkAttributesPrivate
        guint background_set : 1;
 };
 
-G_DEFINE_TYPE (GtkSourceMarkAttributes, gtk_source_mark_attributes, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceMarkAttributes, gtk_source_mark_attributes, G_TYPE_OBJECT)
 
 enum
 {
@@ -279,8 +277,6 @@ gtk_source_mark_attributes_class_init (GtkSourceMarkAttributesClass *klass)
        object_class->get_property = gtk_source_mark_attributes_get_property;
        object_class->set_property = gtk_source_mark_attributes_set_property;
 
-       g_type_class_add_private (object_class, sizeof (GtkSourceMarkAttributesPrivate));
-
        /**
         * GtkSourceMarkAttributes:background:
         *
@@ -396,7 +392,7 @@ gtk_source_mark_attributes_class_init (GtkSourceMarkAttributesClass *klass)
 static void
 gtk_source_mark_attributes_init (GtkSourceMarkAttributes *self)
 {
-       self->priv = GTK_SOURCE_MARK_ATTRIBUTES_GET_PRIVATE (self);
+       self->priv = gtk_source_mark_attributes_get_instance_private (self);
 
        self->priv->helper = gtk_source_pixbuf_helper_new ();
 }
diff --git a/gtksourceview/gtksourceprintcompositor.c b/gtksourceview/gtksourceprintcompositor.c
index 61df8f6..253cf67 100644
--- a/gtksourceview/gtksourceprintcompositor.c
+++ b/gtksourceview/gtksourceprintcompositor.c
@@ -196,7 +196,7 @@ enum
        PROP_N_PAGES
 };
 
-G_DEFINE_TYPE (GtkSourcePrintCompositor, gtk_source_print_compositor, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourcePrintCompositor, gtk_source_print_compositor, G_TYPE_OBJECT)
 
 #define MM_PER_INCH 25.4
 #define POINTS_PER_INCH 72
@@ -687,8 +687,6 @@ gtk_source_print_compositor_class_init (GtkSourcePrintCompositorClass *klass)
                                                             "completely paginated)."),
                                                           -1, G_MAXINT, -1,
                                                           G_PARAM_READABLE));
-
-       g_type_class_add_private (object_class, sizeof(GtkSourcePrintCompositorPrivate));
 }
 
 static void
@@ -696,9 +694,7 @@ gtk_source_print_compositor_init (GtkSourcePrintCompositor *compositor)
 {
        GtkSourcePrintCompositorPrivate *priv;
 
-       priv = G_TYPE_INSTANCE_GET_PRIVATE (compositor,
-                                           GTK_SOURCE_TYPE_PRINT_COMPOSITOR,
-                                           GtkSourcePrintCompositorPrivate);
+       priv = gtk_source_print_compositor_get_instance_private (compositor);
 
        compositor->priv = priv;
 
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 2265907..a3789ae 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -84,7 +84,7 @@ struct _GtkSourceStyleSchemePrivate
        GtkCssProvider *css;
 };
 
-G_DEFINE_TYPE (GtkSourceStyleScheme, gtk_source_style_scheme, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceStyleScheme, gtk_source_style_scheme, G_TYPE_OBJECT)
 
 static void
 gtk_source_style_scheme_dispose (GObject *object)
@@ -252,8 +252,6 @@ gtk_source_style_scheme_class_init (GtkSourceStyleSchemeClass *klass)
                                                              _("Style scheme filename"),
                                                              NULL,
                                                              G_PARAM_READABLE));
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceStyleSchemePrivate));
 }
 
 static void
@@ -266,8 +264,7 @@ unref_if_not_null (gpointer object)
 static void
 gtk_source_style_scheme_init (GtkSourceStyleScheme *scheme)
 {
-       scheme->priv = G_TYPE_INSTANCE_GET_PRIVATE (scheme, GTK_SOURCE_TYPE_STYLE_SCHEME,
-                                                   GtkSourceStyleSchemePrivate);
+       scheme->priv = gtk_source_style_scheme_get_instance_private (scheme);
 
        scheme->priv->defined_styles = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                              g_free, g_object_unref);
diff --git a/gtksourceview/gtksourcestyleschememanager.c b/gtksourceview/gtksourcestyleschememanager.c
index f1580ac..2d16483 100644
--- a/gtksourceview/gtksourcestyleschememanager.c
+++ b/gtksourceview/gtksourcestyleschememanager.c
@@ -45,15 +45,13 @@ struct _GtkSourceStyleSchemeManagerPrivate
        gchar          **ids; /* Cache the IDs of the available schemes */
 };
 
-
 enum {
        PROP_0,
        PROP_SEARCH_PATH,
        PROP_SCHEME_IDS
 };
 
-
-G_DEFINE_TYPE (GtkSourceStyleSchemeManager, gtk_source_style_scheme_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceStyleSchemeManager, gtk_source_style_scheme_manager, G_TYPE_OBJECT)
 
 static void
 gtk_source_style_scheme_manager_set_property (GObject     *object,
@@ -163,16 +161,12 @@ gtk_source_style_scheme_manager_class_init (GtkSourceStyleSchemeManagerClass *kl
                                                               "style schemes"),
                                                             G_TYPE_STRV,
                                                             G_PARAM_READABLE));
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceStyleSchemeManagerPrivate));
 }
 
 static void
 gtk_source_style_scheme_manager_init (GtkSourceStyleSchemeManager *mgr)
 {
-       mgr->priv = G_TYPE_INSTANCE_GET_PRIVATE (mgr,
-                                                GTK_SOURCE_TYPE_STYLE_SCHEME_MANAGER,
-                                                GtkSourceStyleSchemeManagerPrivate);
+       mgr->priv = gtk_source_style_scheme_manager_get_instance_private (mgr);
        mgr->priv->schemes_hash = NULL;
        mgr->priv->ids = NULL;
        mgr->priv->search_path = NULL;
diff --git a/gtksourceview/gtksourceundomanagerdefault.c b/gtksourceview/gtksourceundomanagerdefault.c
index 698e57b..47c8bcd 100644
--- a/gtksourceview/gtksourceundomanagerdefault.c
+++ b/gtksourceview/gtksourceundomanagerdefault.c
@@ -183,6 +183,7 @@ static gboolean merge_action          (GtkSourceUndoManagerDefault      *um,
 static void gtk_source_undo_manager_iface_init (GtkSourceUndoManagerIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GtkSourceUndoManagerDefault, gtk_source_undo_manager_default, G_TYPE_OBJECT,
+                        G_ADD_PRIVATE (GtkSourceUndoManagerDefault)
                          G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_UNDO_MANAGER,
                                                 gtk_source_undo_manager_iface_init))
 
@@ -417,16 +418,12 @@ gtk_source_undo_manager_default_class_init (GtkSourceUndoManagerDefaultClass *kl
                                                           G_MAXINT,
                                                           DEFAULT_MAX_UNDO_LEVELS,
                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
-       g_type_class_add_private (object_class, sizeof(GtkSourceUndoManagerDefaultPrivate));
 }
 
 static void
 gtk_source_undo_manager_default_init (GtkSourceUndoManagerDefault *um)
 {
-       um->priv = G_TYPE_INSTANCE_GET_PRIVATE (um, GTK_SOURCE_TYPE_UNDO_MANAGER_DEFAULT,
-                                               GtkSourceUndoManagerDefaultPrivate);
-
+       um->priv = gtk_source_undo_manager_default_get_instance_private (um);
        um->priv->actions = g_ptr_array_new ();
 }
 
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 35ef01b..1f28614 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -173,8 +173,7 @@ struct _MarkCategory
        gint                     priority;
 };
 
-G_DEFINE_TYPE (GtkSourceView, gtk_source_view, GTK_TYPE_TEXT_VIEW)
-
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceView, gtk_source_view, GTK_TYPE_TEXT_VIEW)
 
 /* Implement DnD for application/x-color drops */
 typedef enum {
@@ -756,8 +755,6 @@ gtk_source_view_class_init (GtkSourceViewClass *klass)
                                      "move_viewport", 2,
                                      GTK_TYPE_SCROLL_STEP, GTK_SCROLL_ENDS,
                                      G_TYPE_INT, 1);
-
-       g_type_class_add_private (object_class, sizeof (GtkSourceViewPrivate));
 }
 
 static void
@@ -937,8 +934,7 @@ gtk_source_view_init (GtkSourceView *view)
 {
        GtkTargetList *tl;
 
-       view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view, GTK_SOURCE_TYPE_VIEW,
-                                                 GtkSourceViewPrivate);
+       view->priv = gtk_source_view_get_instance_private (view);
 
        view->priv->tab_width = DEFAULT_TAB_WIDTH;
        view->priv->tabs_set = FALSE;



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