[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 84/115] libtracker-miner: Port to G_ADD_PRIVATE



commit 5ded90055aaec2e1bec4f2cc123ca6c492b808ee
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 1 01:10:50 2018 +0200

    libtracker-miner: Port to G_ADD_PRIVATE
    
    The priv pointer has been removed from object structs for all private
    types. For public types it's got to be kept there for ABI stability.

 src/libtracker-miner/tracker-crawler.c       | 126 +++++++++++++--------
 src/libtracker-miner/tracker-crawler.h       |   1 -
 src/libtracker-miner/tracker-decorator-fs.c  |   7 +-
 src/libtracker-miner/tracker-decorator.c     |   7 +-
 src/libtracker-miner/tracker-file-notifier.c | 117 ++++++++++---------
 src/libtracker-miner/tracker-file-notifier.h |   1 -
 src/libtracker-miner/tracker-file-system.c   |  23 ++--
 src/libtracker-miner/tracker-file-system.h   |   1 -
 src/libtracker-miner/tracker-indexing-tree.c |  11 +-
 src/libtracker-miner/tracker-miner-fs.c      |  13 +--
 src/libtracker-miner/tracker-miner-object.c  |   7 +-
 src/libtracker-miner/tracker-monitor.c       | 162 ++++++++++++++++++---------
 src/libtracker-miner/tracker-monitor.h       |   2 -
 src/libtracker-miner/tracker-sparql-buffer.c |  27 ++---
 src/libtracker-miner/tracker-sparql-buffer.h |   1 -
 src/libtracker-miner/tracker-task-pool.c     |  28 ++---
 src/libtracker-miner/tracker-task-pool.h     |   1 -
 17 files changed, 298 insertions(+), 237 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index 5601cb36b..10f270a4f 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -25,8 +25,6 @@
 #include "tracker-miner-enum-types.h"
 #include "tracker-utils.h"
 
-#define TRACKER_CRAWLER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_CRAWLER, 
TrackerCrawlerPrivate))
-
 #define FILE_ATTRIBUTES          \
        G_FILE_ATTRIBUTE_STANDARD_NAME "," \
        G_FILE_ATTRIBUTE_STANDARD_TYPE
@@ -41,6 +39,7 @@
 
 #define MAX_SIMULTANEOUS_ITEMS       64
 
+typedef struct TrackerCrawlerPrivate  TrackerCrawlerPrivate;
 typedef struct DirectoryChildData DirectoryChildData;
 typedef struct DirectoryProcessingData DirectoryProcessingData;
 typedef struct DirectoryRootInfo DirectoryRootInfo;
@@ -149,7 +148,7 @@ static void     directory_root_info_free (DirectoryRootInfo *info);
 static guint signals[LAST_SIGNAL] = { 0, };
 static GQuark file_info_quark = 0;
 
-G_DEFINE_TYPE (TrackerCrawler, tracker_crawler, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerCrawler, tracker_crawler, G_TYPE_OBJECT)
 
 static void
 tracker_crawler_class_init (TrackerCrawlerClass *klass)
@@ -231,8 +230,6 @@ tracker_crawler_class_init (TrackerCrawlerClass *klass)
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY));
 
-       g_type_class_add_private (object_class, sizeof (TrackerCrawlerPrivate));
-
        file_info_quark = g_quark_from_static_string ("tracker-crawler-file-info");
 }
 
@@ -241,10 +238,7 @@ tracker_crawler_init (TrackerCrawler *object)
 {
        TrackerCrawlerPrivate *priv;
 
-       object->priv = TRACKER_CRAWLER_GET_PRIVATE (object);
-
-       priv = object->priv;
-
+       priv = tracker_crawler_get_instance_private (TRACKER_CRAWLER (object));
        priv->directories = g_queue_new ();
 }
 
@@ -256,7 +250,7 @@ crawler_set_property (GObject      *object,
 {
        TrackerCrawlerPrivate *priv;
 
-       priv = TRACKER_CRAWLER (object)->priv;
+       priv = tracker_crawler_get_instance_private (TRACKER_CRAWLER (object));
 
        switch (prop_id) {
        case PROP_DATA_PROVIDER:
@@ -276,7 +270,7 @@ crawler_get_property (GObject    *object,
 {
        TrackerCrawlerPrivate *priv;
 
-       priv = TRACKER_CRAWLER (object)->priv;
+       priv = tracker_crawler_get_instance_private (TRACKER_CRAWLER (object));
 
        switch (prop_id) {
        case PROP_DATA_PROVIDER:
@@ -293,7 +287,7 @@ crawler_finalize (GObject *object)
 {
        TrackerCrawlerPrivate *priv;
 
-       priv = TRACKER_CRAWLER_GET_PRIVATE (object);
+       priv = tracker_crawler_get_instance_private (TRACKER_CRAWLER (object));
 
        if (priv->timer) {
                g_timer_destroy (priv->timer);
@@ -371,7 +365,7 @@ check_file (TrackerCrawler    *crawler,
        gboolean use = FALSE;
        TrackerCrawlerPrivate *priv;
 
-       priv = TRACKER_CRAWLER_GET_PRIVATE (crawler);
+       priv = tracker_crawler_get_instance_private (crawler);
 
        g_signal_emit (crawler, signals[CHECK_FILE], 0, file, &use);
 
@@ -398,7 +392,7 @@ check_directory (TrackerCrawler    *crawler,
        gboolean use = FALSE;
        TrackerCrawlerPrivate *priv;
 
-       priv = TRACKER_CRAWLER_GET_PRIVATE (crawler);
+       priv = tracker_crawler_get_instance_private (crawler);
 
        g_signal_emit (crawler, signals[CHECK_DIRECTORY], 0, file, &use);
 
@@ -590,7 +584,7 @@ process_next (TrackerCrawler *crawler)
        DirectoryProcessingData *dir_data = NULL;
        gboolean                 stop_idle = FALSE;
 
-       priv = crawler->priv;
+       priv = tracker_crawler_get_instance_private (crawler);
 
        if (priv->is_paused) {
                /* Stop the idle func for now until we are unpaused */
@@ -710,16 +704,20 @@ process_func (gpointer data)
 static gboolean
 process_func_start (TrackerCrawler *crawler)
 {
-       if (crawler->priv->is_paused) {
+       TrackerCrawlerPrivate *priv;
+
+       priv = tracker_crawler_get_instance_private (crawler);
+
+       if (priv->is_paused) {
                return FALSE;
        }
 
-       if (crawler->priv->is_finished) {
+       if (priv->is_finished) {
                return FALSE;
        }
 
-       if (crawler->priv->idle_id == 0) {
-               crawler->priv->idle_id = g_idle_add (process_func, crawler);
+       if (priv->idle_id == 0) {
+               priv->idle_id = g_idle_add (process_func, crawler);
        }
 
        return TRUE;
@@ -728,9 +726,13 @@ process_func_start (TrackerCrawler *crawler)
 static void
 process_func_stop (TrackerCrawler *crawler)
 {
-       if (crawler->priv->idle_id != 0) {
-               g_source_remove (crawler->priv->idle_id);
-               crawler->priv->idle_id = 0;
+       TrackerCrawlerPrivate *priv;
+
+       priv = tracker_crawler_get_instance_private (crawler);
+
+       if (priv->idle_id != 0) {
+               g_source_remove (priv->idle_id);
+               priv->idle_id = 0;
        }
 }
 
@@ -783,12 +785,14 @@ data_provider_data_process (DataProviderData *dpd)
 static void
 data_provider_data_add (DataProviderData *dpd)
 {
+       TrackerCrawlerPrivate *priv;
        TrackerCrawler *crawler;
        GFile *parent;
        GList *l;
 
        crawler = dpd->crawler;
        parent = dpd->dir_file;
+       priv = tracker_crawler_get_instance_private (crawler);
 
        for (l = dpd->files; l; l = l->next) {
                GFileInfo *info;
@@ -802,7 +806,7 @@ data_provider_data_add (DataProviderData *dpd)
                child = g_file_get_child (parent, child_name);
                is_dir = g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY;
 
-               if (crawler->priv->file_attributes) {
+               if (priv->file_attributes) {
                        /* Store the file info for future retrieval */
                        g_object_set_qdata_full (G_OBJECT (child),
                                                 file_info_quark,
@@ -929,12 +933,16 @@ enumerate_next_cb (GObject      *object,
 
                process_func_start (dpd->crawler);
        } else {
+               TrackerCrawlerPrivate *priv;
+
+               priv = tracker_crawler_get_instance_private (dpd->crawler);
+
                /* More work to do, we keep reference given to us */
                dpd->files = g_list_concat (dpd->files, info);
                g_file_enumerator_next_files_async (G_FILE_ENUMERATOR (object),
                                                    MAX_SIMULTANEOUS_ITEMS,
                                                    G_PRIORITY_LOW,
-                                                   dpd->crawler->priv->cancellable,
+                                                   priv->cancellable,
                                                    enumerate_next_cb,
                                                    dpd);
        }
@@ -945,6 +953,7 @@ data_provider_begin_cb (GObject      *object,
                         GAsyncResult *result,
                         gpointer      user_data)
 {
+       TrackerCrawlerPrivate *priv;
        GFileEnumerator *enumerator;
        DirectoryRootInfo *info;
        DataProviderData *dpd;
@@ -971,10 +980,11 @@ data_provider_begin_cb (GObject      *object,
 
        dpd = info->dpd;
        dpd->enumerator = enumerator;
+       priv = tracker_crawler_get_instance_private (dpd->crawler);
        g_file_enumerator_next_files_async (enumerator,
                                            MAX_SIMULTANEOUS_ITEMS,
                                            G_PRIORITY_LOW,
-                                           dpd->crawler->priv->cancellable,
+                                           priv->cancellable,
                                            enumerate_next_cb,
                                            dpd);
 }
@@ -984,9 +994,12 @@ data_provider_begin (TrackerCrawler          *crawler,
                      DirectoryRootInfo       *info,
                      DirectoryProcessingData *dir_data)
 {
+       TrackerCrawlerPrivate *priv;
        DataProviderData *dpd;
        gchar *attrs;
 
+       priv = tracker_crawler_get_instance_private (crawler);
+
        /* DataProviderData is freed in data_provider_end() call. This
         * call must _ALWAYS_ be reached even on cancellation or
         * failure, this is normally the case when we return to the
@@ -996,20 +1009,20 @@ data_provider_begin (TrackerCrawler          *crawler,
        dpd = data_provider_data_new (crawler, info, dir_data);
        info->dpd = dpd;
 
-       if (crawler->priv->file_attributes) {
+       if (priv->file_attributes) {
                attrs = g_strconcat (FILE_ATTRIBUTES ",",
-                                    crawler->priv->file_attributes,
+                                    priv->file_attributes,
                                     NULL);
        } else {
                attrs = g_strdup (FILE_ATTRIBUTES);
        }
 
-       tracker_data_provider_begin_async (crawler->priv->data_provider,
+       tracker_data_provider_begin_async (priv->data_provider,
                                           dpd->dir_file,
                                           attrs,
                                           info->flags,
                                           G_PRIORITY_LOW,
-                                          crawler->priv->cancellable,
+                                          priv->cancellable,
                                           data_provider_begin_cb,
                                           info);
        g_free (attrs);
@@ -1028,7 +1041,7 @@ tracker_crawler_start (TrackerCrawler        *crawler,
        g_return_val_if_fail (TRACKER_IS_CRAWLER (crawler), FALSE);
        g_return_val_if_fail (G_IS_FILE (file), FALSE);
 
-       priv = crawler->priv;
+       priv = tracker_crawler_get_instance_private (crawler);
 
        enable_stat = (flags & TRACKER_DIRECTORY_FLAG_NO_STAT) == 0;
 
@@ -1095,7 +1108,7 @@ tracker_crawler_stop (TrackerCrawler *crawler)
 
        g_return_if_fail (TRACKER_IS_CRAWLER (crawler));
 
-       priv = crawler->priv;
+       priv = tracker_crawler_get_instance_private (crawler);
 
        /* If already not running, just ignore */
        if (!priv->is_running) {
@@ -1127,51 +1140,62 @@ tracker_crawler_stop (TrackerCrawler *crawler)
 void
 tracker_crawler_pause (TrackerCrawler *crawler)
 {
+       TrackerCrawlerPrivate *priv;
+
        g_return_if_fail (TRACKER_IS_CRAWLER (crawler));
 
-       crawler->priv->is_paused = TRUE;
+       priv = tracker_crawler_get_instance_private (crawler);
+       priv->is_paused = TRUE;
 
-       if (crawler->priv->is_running) {
-               g_timer_stop (crawler->priv->timer);
+       if (priv->is_running) {
+               g_timer_stop (priv->timer);
                process_func_stop (crawler);
        }
 
        g_message ("Crawler is paused, %s",
-                  crawler->priv->is_running ? "currently running" : "not running");
+                  priv->is_running ? "currently running" : "not running");
 }
 
 void
 tracker_crawler_resume (TrackerCrawler *crawler)
 {
+       TrackerCrawlerPrivate *priv;
+
        g_return_if_fail (TRACKER_IS_CRAWLER (crawler));
 
-       crawler->priv->is_paused = FALSE;
+       priv = tracker_crawler_get_instance_private (crawler);
+
+       priv->is_paused = FALSE;
 
-       if (crawler->priv->is_running) {
-               g_timer_continue (crawler->priv->timer);
+       if (priv->is_running) {
+               g_timer_continue (priv->timer);
                process_func_start (crawler);
        }
 
        g_message ("Crawler is resuming, %s",
-                  crawler->priv->is_running ? "currently running" : "not running");
+                  priv->is_running ? "currently running" : "not running");
 }
 
 void
 tracker_crawler_set_throttle (TrackerCrawler *crawler,
                               gdouble         throttle)
 {
+       TrackerCrawlerPrivate *priv;
+
        g_return_if_fail (TRACKER_IS_CRAWLER (crawler));
 
+       priv = tracker_crawler_get_instance_private (crawler);
+
        throttle = CLAMP (throttle, 0, 1);
-       crawler->priv->throttle = throttle;
+       priv->throttle = throttle;
 
        /* Update timeouts */
-       if (crawler->priv->idle_id != 0) {
+       if (priv->idle_id != 0) {
                guint interval, idle_id;
 
-               interval = TRACKER_CRAWLER_MAX_TIMEOUT_INTERVAL * crawler->priv->throttle;
+               interval = TRACKER_CRAWLER_MAX_TIMEOUT_INTERVAL * priv->throttle;
 
-               g_source_remove (crawler->priv->idle_id);
+               g_source_remove (priv->idle_id);
 
                if (interval == 0) {
                        idle_id = g_idle_add (process_func, crawler);
@@ -1179,7 +1203,7 @@ tracker_crawler_set_throttle (TrackerCrawler *crawler,
                        idle_id = g_timeout_add (interval, process_func, crawler);
                }
 
-               crawler->priv->idle_id = idle_id;
+               priv->idle_id = idle_id;
        }
 }
 
@@ -1196,10 +1220,14 @@ void
 tracker_crawler_set_file_attributes (TrackerCrawler *crawler,
                                     const gchar    *file_attributes)
 {
+       TrackerCrawlerPrivate *priv;
+
        g_return_if_fail (TRACKER_IS_CRAWLER (crawler));
 
-       g_free (crawler->priv->file_attributes);
-       crawler->priv->file_attributes = g_strdup (file_attributes);
+       priv = tracker_crawler_get_instance_private (crawler);
+
+       g_free (priv->file_attributes);
+       priv->file_attributes = g_strdup (file_attributes);
 }
 
 /**
@@ -1213,9 +1241,13 @@ tracker_crawler_set_file_attributes (TrackerCrawler *crawler,
 const gchar *
 tracker_crawler_get_file_attributes (TrackerCrawler *crawler)
 {
+       TrackerCrawlerPrivate *priv;
+
        g_return_val_if_fail (TRACKER_IS_CRAWLER (crawler), NULL);
 
-       return crawler->priv->file_attributes;
+       priv = tracker_crawler_get_instance_private (crawler);
+
+       return priv->file_attributes;
 }
 
 /**
diff --git a/src/libtracker-miner/tracker-crawler.h b/src/libtracker-miner/tracker-crawler.h
index 3d61e55a5..8a1034b59 100644
--- a/src/libtracker-miner/tracker-crawler.h
+++ b/src/libtracker-miner/tracker-crawler.h
@@ -47,7 +47,6 @@ typedef struct TrackerCrawlerPrivate  TrackerCrawlerPrivate;
 
 struct TrackerCrawler {
        GObject parent;
-       TrackerCrawlerPrivate *priv;
 };
 
 struct TrackerCrawlerClass {
diff --git a/src/libtracker-miner/tracker-decorator-fs.c b/src/libtracker-miner/tracker-decorator-fs.c
index 9f4d82398..f5c93efe3 100644
--- a/src/libtracker-miner/tracker-decorator-fs.c
+++ b/src/libtracker-miner/tracker-decorator-fs.c
@@ -26,8 +26,6 @@
 #include "tracker-decorator-private.h"
 #include "tracker-decorator-fs.h"
 
-#define TRACKER_DECORATOR_FS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DECORATOR_FS, 
TrackerDecoratorFSPrivate))
-
 /**
  * SECTION:tracker-decorator-fs
  * @short_description: Filesystem implementation for TrackerDecorator
@@ -51,6 +49,7 @@ static void tracker_decorator_fs_initable_iface_init (GInitableIface *iface);
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (TrackerDecoratorFS, tracker_decorator_fs,
                                   TRACKER_TYPE_DECORATOR,
+                                  G_ADD_PRIVATE (TrackerDecoratorFS)
                                   G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, 
tracker_decorator_fs_initable_iface_init))
 
 static void
@@ -72,8 +71,6 @@ tracker_decorator_fs_class_init (TrackerDecoratorFSClass *klass)
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
        object_class->finalize = tracker_decorator_fs_finalize;
-
-       g_type_class_add_private (object_class, sizeof (TrackerDecoratorFSPrivate));
 }
 
 static void
@@ -276,7 +273,7 @@ tracker_decorator_fs_initable_iface_init (GInitableIface *iface)
 static void
 tracker_decorator_fs_init (TrackerDecoratorFS *decorator)
 {
-       decorator->priv = TRACKER_DECORATOR_FS_GET_PRIVATE (decorator);
+       decorator->priv = tracker_decorator_fs_get_instance_private (decorator);
 }
 
 /**
diff --git a/src/libtracker-miner/tracker-decorator.c b/src/libtracker-miner/tracker-decorator.c
index e8948f79f..fbe222a2c 100644
--- a/src/libtracker-miner/tracker-decorator.c
+++ b/src/libtracker-miner/tracker-decorator.c
@@ -28,8 +28,6 @@
 #define QUERY_BATCH_SIZE 100
 #define DEFAULT_BATCH_SIZE 200
 
-#define TRACKER_DECORATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DECORATOR, 
TrackerDecoratorPrivate))
-
 /**
  * SECTION:tracker-decorator
  * @short_description: A miner tasked with listening for DB resource changes and extracting metadata
@@ -139,6 +137,7 @@ static void notifier_events_cb (TrackerDecorator *decorator,
 G_DEFINE_QUARK (TrackerDecoratorError, tracker_decorator_error)
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (TrackerDecorator, tracker_decorator, TRACKER_TYPE_MINER,
+                                  G_ADD_PRIVATE (TrackerDecorator)
                                   G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, 
tracker_decorator_initable_iface_init))
 
 static TrackerDecoratorInfo *
@@ -1287,8 +1286,6 @@ tracker_decorator_class_init (TrackerDecoratorClass *klass)
                              G_STRUCT_OFFSET (TrackerDecoratorClass, finished),
                              NULL, NULL, NULL,
                              G_TYPE_NONE, 0);
-
-       g_type_class_add_private (object_class, sizeof (TrackerDecoratorPrivate));
 }
 
 static void
@@ -1302,7 +1299,7 @@ tracker_decorator_init (TrackerDecorator *decorator)
 {
        TrackerDecoratorPrivate *priv;
 
-       decorator->priv = priv = TRACKER_DECORATOR_GET_PRIVATE (decorator);
+       decorator->priv = priv = tracker_decorator_get_instance_private (decorator);
        priv->classes = g_array_new (FALSE, FALSE, sizeof (ClassInfo));
        g_array_set_clear_func (priv->classes, (GDestroyNotify) class_info_clear);
        priv->blacklist_items = g_sequence_new (NULL);
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index f809f8fea..abc527cd9 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -103,7 +103,7 @@ static void     sparql_files_query_start (TrackerFileNotifier  *notifier,
                                           GFile               **files,
                                           guint                 n_files);
 
-G_DEFINE_TYPE (TrackerFileNotifier, tracker_file_notifier, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerFileNotifier, tracker_file_notifier, G_TYPE_OBJECT)
 
 static void
 tracker_file_notifier_set_property (GObject      *object,
@@ -113,7 +113,7 @@ tracker_file_notifier_set_property (GObject      *object,
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = TRACKER_FILE_NOTIFIER (object)->priv;
+       priv = tracker_file_notifier_get_instance_private (TRACKER_FILE_NOTIFIER (object));
 
        switch (prop_id) {
        case PROP_INDEXING_TREE:
@@ -141,7 +141,7 @@ tracker_file_notifier_get_property (GObject    *object,
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = TRACKER_FILE_NOTIFIER (object)->priv;
+       priv = tracker_file_notifier_get_instance_private (TRACKER_FILE_NOTIFIER (object));
 
        switch (prop_id) {
        case PROP_INDEXING_TREE:
@@ -199,7 +199,7 @@ crawler_check_file_cb (TrackerCrawler *crawler,
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = TRACKER_FILE_NOTIFIER (user_data)->priv;
+       priv = tracker_file_notifier_get_instance_private (user_data);
 
        return tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
                                                        file,
@@ -214,7 +214,7 @@ crawler_check_directory_cb (TrackerCrawler *crawler,
        TrackerFileNotifierPrivate *priv;
        GFile *root, *canonical;
 
-       priv = TRACKER_FILE_NOTIFIER (user_data)->priv;
+       priv = tracker_file_notifier_get_instance_private (user_data);
        g_assert (priv->current_index_root != NULL);
 
        canonical = tracker_file_system_peek_file (priv->file_system, directory);
@@ -243,7 +243,7 @@ crawler_check_directory_contents_cb (TrackerCrawler *crawler,
        TrackerFileNotifierPrivate *priv;
        gboolean process = TRUE;
 
-       priv = TRACKER_FILE_NOTIFIER (user_data)->priv;
+       priv = tracker_file_notifier_get_instance_private (user_data);
 
        /* Do not let content filter apply to configured roots themselves. This
         * is a measure to trim undesired portions of the filesystem, and if
@@ -285,7 +285,7 @@ file_notifier_traverse_tree_foreach (GFile    *file,
        GFile *current_root;
 
        notifier = user_data;
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        current_root = priv->current_index_root->current_dir;
 
        store_mtime = tracker_file_system_steal_property (priv->file_system, file,
@@ -346,7 +346,7 @@ notifier_check_next_root (TrackerFileNotifier *notifier)
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        g_assert (priv->current_index_root == NULL);
 
        if (priv->pending_index_roots) {
@@ -363,7 +363,7 @@ file_notifier_traverse_tree (TrackerFileNotifier *notifier)
        TrackerFileNotifierPrivate *priv;
        GFile *directory;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        g_assert (priv->current_index_root != NULL);
 
        directory = priv->current_index_root->current_dir;
@@ -386,7 +386,7 @@ file_notifier_is_directory_modified (TrackerFileNotifier *notifier,
        if (G_UNLIKELY (force_check_updated))
                return TRUE;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        store_mtime = tracker_file_system_get_property (priv->file_system, file,
                                                        quark_property_store_mtime);
        disk_mtime = tracker_file_system_get_property (priv->file_system, file,
@@ -404,7 +404,7 @@ file_notifier_add_node_foreach (GNode    *node,
        GFileInfo *file_info;
        GFile *canonical, *file;
 
-       priv = data->notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (data->notifier);
        file = node->data;
 
        if (node->parent &&
@@ -478,7 +478,7 @@ crawler_directory_crawled_cb (TrackerCrawler *crawler,
        DirectoryCrawledData data = { 0 };
 
        notifier = data.notifier = user_data;
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        g_node_traverse (tree,
                         G_PRE_ORDER,
@@ -504,7 +504,7 @@ _insert_store_info (TrackerFileNotifier *notifier,
        TrackerFileNotifierPrivate *priv;
        GFile *canonical;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        canonical = tracker_file_system_get_file (priv->file_system,
                                                  file, file_type,
                                                  parent);
@@ -525,7 +525,7 @@ sparql_files_query_populate (TrackerFileNotifier *notifier,
        TrackerFileNotifierPrivate *priv;
        GFile *parent = NULL;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
                GFile *file, *canonical, *root;
@@ -580,7 +580,7 @@ sparql_contents_check_deleted (TrackerFileNotifier *notifier,
        GFile *file, *canonical, *parent = NULL;
        const gchar *iri;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
                const gchar *uri;
@@ -632,9 +632,11 @@ sparql_contents_check_deleted (TrackerFileNotifier *notifier,
 static gboolean
 crawl_directory_in_current_root (TrackerFileNotifier *notifier)
 {
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        GFile *directory;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
+
        if (!priv->current_index_root)
                return FALSE;
 
@@ -665,7 +667,7 @@ finish_current_directory (TrackerFileNotifier *notifier,
        TrackerFileNotifierPrivate *priv;
        GFile *directory;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        directory = priv->current_index_root->current_dir;
        priv->current_index_root->current_dir = NULL;
        priv->current_index_root->current_dir_content_filtered = FALSE;
@@ -739,7 +741,7 @@ file_notifier_current_root_check_remove_directory (TrackerFileNotifier *notifier
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        if (priv->current_index_root &&
            root_data_remove_directory (priv->current_index_root, file)) {
@@ -809,7 +811,7 @@ sparql_contents_query_start (TrackerFileNotifier *notifier,
        TrackerFileNotifierPrivate *priv;
        gchar *sparql;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        if (G_UNLIKELY (priv->connection == NULL)) {
                return;
@@ -831,13 +833,14 @@ sparql_files_query_cb (GObject      *object,
                       gpointer      user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        TrackerSparqlCursor *cursor;
        gboolean directory_modified;
        GError *error = NULL;
        GFile *directory;
        guint flags;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (object),
                                                         result, &error);
        if (error) {
@@ -909,7 +912,7 @@ sparql_files_query_start (TrackerFileNotifier  *notifier,
        TrackerFileNotifierPrivate *priv;
        gchar *sparql;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        if (G_UNLIKELY (priv->connection == NULL)) {
                return;
@@ -927,10 +930,12 @@ sparql_files_query_start (TrackerFileNotifier  *notifier,
 static gboolean
 crawl_directories_start (TrackerFileNotifier *notifier)
 {
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        TrackerDirectoryFlags flags;
        GFile *directory;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
+
        if (priv->current_index_root) {
                return FALSE;
        }
@@ -988,10 +993,12 @@ crawler_finished_cb (TrackerCrawler *crawler,
                      gpointer        user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        GFile *directory;
        gboolean check_mtime;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
+
        g_assert (priv->current_index_root != NULL);
 
        if (was_interrupted) {
@@ -1033,9 +1040,11 @@ notifier_queue_root (TrackerFileNotifier   *notifier,
                      TrackerDirectoryFlags  flags,
                      gboolean               ignore_root)
 {
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        RootData *data;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
+
        if (priv->current_index_root &&
            priv->current_index_root->root == file)
                return;
@@ -1065,9 +1074,10 @@ static void
 tracker_file_notifier_ensure_parents (TrackerFileNotifier *notifier,
                                       GFile               *file)
 {
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        GFile *parent, *canonical;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        parent = g_file_get_parent (file);
 
        while (parent) {
@@ -1100,10 +1110,11 @@ monitor_item_created_cb (TrackerMonitor *monitor,
                          gpointer        user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        GFileType file_type;
        GFile *canonical;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        file_type = (is_directory) ? G_FILE_TYPE_DIRECTORY : G_FILE_TYPE_REGULAR;
 
        if (!tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
@@ -1190,10 +1201,11 @@ monitor_item_updated_cb (TrackerMonitor *monitor,
                          gpointer        user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        GFileType file_type;
        GFile *canonical;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        file_type = (is_directory) ? G_FILE_TYPE_DIRECTORY : G_FILE_TYPE_REGULAR;
 
        if (!tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
@@ -1222,10 +1234,11 @@ monitor_item_attribute_updated_cb (TrackerMonitor *monitor,
                                    gpointer        user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        GFile *canonical;
        GFileType file_type;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        file_type = (is_directory) ? G_FILE_TYPE_DIRECTORY : G_FILE_TYPE_REGULAR;
 
        if (!tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
@@ -1252,10 +1265,11 @@ monitor_item_deleted_cb (TrackerMonitor *monitor,
                          gpointer        user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        GFile *canonical;
        GFileType file_type;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        file_type = (is_directory) ? G_FILE_TYPE_DIRECTORY : G_FILE_TYPE_REGULAR;
 
        /* Remove monitors if any */
@@ -1363,7 +1377,7 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
        TrackerDirectoryFlags flags;
 
        notifier = user_data;
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        tracker_indexing_tree_get_root (priv->indexing_tree, other_file, &flags);
 
        if (!is_source_monitored) {
@@ -1498,9 +1512,10 @@ indexing_tree_directory_added (TrackerIndexingTree *indexing_tree,
                                gpointer             user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        TrackerDirectoryFlags flags;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        tracker_indexing_tree_get_root (indexing_tree, directory, &flags);
 
        directory = tracker_file_system_get_file (priv->file_system, directory,
@@ -1514,9 +1529,10 @@ indexing_tree_directory_updated (TrackerIndexingTree *indexing_tree,
                                  gpointer             user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        TrackerDirectoryFlags flags;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
        tracker_indexing_tree_get_root (indexing_tree, directory, &flags);
        flags |= TRACKER_DIRECTORY_FLAG_CHECK_DELETED;
 
@@ -1531,10 +1547,12 @@ indexing_tree_directory_removed (TrackerIndexingTree *indexing_tree,
                                  gpointer             user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        TrackerDirectoryFlags flags;
        GList *elem;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
+
        /* Flags are still valid at the moment of deletion */
        tracker_indexing_tree_get_root (indexing_tree, directory, &flags);
        directory = tracker_file_system_peek_file (priv->file_system, directory);
@@ -1615,11 +1633,13 @@ indexing_tree_child_updated (TrackerIndexingTree *indexing_tree,
                              gpointer             user_data)
 {
        TrackerFileNotifier *notifier = user_data;
-       TrackerFileNotifierPrivate *priv = notifier->priv;
+       TrackerFileNotifierPrivate *priv;
        TrackerDirectoryFlags flags;
        GFileType child_type;
        GFile *canonical;
 
+       priv = tracker_file_notifier_get_instance_private (notifier);
+
        child_type = g_file_query_file_type (child,
                                             G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                                             NULL);
@@ -1647,7 +1667,7 @@ tracker_file_notifier_finalize (GObject *object)
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = TRACKER_FILE_NOTIFIER (object)->priv;
+       priv = tracker_file_notifier_get_instance_private (TRACKER_FILE_NOTIFIER (object));
 
        if (priv->indexing_tree) {
                g_object_unref (priv->indexing_tree);
@@ -1684,7 +1704,7 @@ check_disable_monitor (TrackerFileNotifier *notifier)
        gint64 folder_count = 0;
        GError *error = NULL;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        cursor = tracker_sparql_connection_query (priv->connection,
                                                  "SELECT COUNT(?f) { ?f a nfo:Folder }",
                                                  NULL, &error);
@@ -1721,7 +1741,7 @@ tracker_file_notifier_constructed (GObject *object)
 
        G_OBJECT_CLASS (tracker_file_notifier_parent_class)->constructed (object);
 
-       priv = TRACKER_FILE_NOTIFIER (object)->priv;
+       priv = tracker_file_notifier_get_instance_private (TRACKER_FILE_NOTIFIER (object));
        g_assert (priv->indexing_tree);
 
        /* Initialize filesystem and register properties */
@@ -1767,7 +1787,7 @@ tracker_file_notifier_real_finished (TrackerFileNotifier *notifier)
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        if (!tracker_monitor_get_enabled (priv->monitor)) {
                /* If the monitor was disabled on ::constructed (see
@@ -1888,9 +1908,6 @@ tracker_file_notifier_class_init (TrackerFileNotifierClass *klass)
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY));
 
-       g_type_class_add_private (object_class,
-                                 sizeof (TrackerFileNotifierClass));
-
        /* Initialize property quarks */
        quark_property_iri = g_quark_from_static_string ("tracker-property-iri");
        tracker_file_system_register_property (quark_property_iri, g_free);
@@ -1911,11 +1928,7 @@ tracker_file_notifier_init (TrackerFileNotifier *notifier)
 {
        TrackerFileNotifierPrivate *priv;
 
-       priv = notifier->priv =
-               G_TYPE_INSTANCE_GET_PRIVATE (notifier,
-                                            TRACKER_TYPE_FILE_NOTIFIER,
-                                            TrackerFileNotifierPrivate);
-
+       priv = tracker_file_notifier_get_instance_private (notifier);
        priv->timer = g_timer_new ();
        priv->stopped = TRUE;
 
@@ -1960,7 +1973,7 @@ tracker_file_notifier_start (TrackerFileNotifier *notifier)
 
        g_return_val_if_fail (TRACKER_IS_FILE_NOTIFIER (notifier), FALSE);
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        if (priv->stopped) {
                priv->stopped = FALSE;
@@ -1982,7 +1995,7 @@ tracker_file_notifier_stop (TrackerFileNotifier *notifier)
 
        g_return_if_fail (TRACKER_IS_FILE_NOTIFIER (notifier));
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        if (!priv->stopped) {
                tracker_crawler_stop (priv->crawler);
@@ -2000,7 +2013,7 @@ tracker_file_notifier_is_active (TrackerFileNotifier *notifier)
 
        g_return_val_if_fail (TRACKER_IS_FILE_NOTIFIER (notifier), FALSE);
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        return priv->pending_index_roots || priv->current_index_root;
 }
 
@@ -2017,7 +2030,7 @@ tracker_file_notifier_get_file_iri (TrackerFileNotifier *notifier,
        g_return_val_if_fail (TRACKER_IS_FILE_NOTIFIER (notifier), NULL);
        g_return_val_if_fail (G_IS_FILE (file), NULL);
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
 
        if (G_UNLIKELY (priv->connection == NULL)) {
                return NULL;
@@ -2101,7 +2114,7 @@ tracker_file_notifier_invalidate_file_iri (TrackerFileNotifier *notifier,
        g_return_if_fail (TRACKER_IS_FILE_NOTIFIER (notifier));
        g_return_if_fail (G_IS_FILE (file));
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        canonical = tracker_file_system_peek_file (priv->file_system, file);
        if (!canonical) {
                return;
@@ -2134,7 +2147,7 @@ tracker_file_notifier_get_file_type (TrackerFileNotifier *notifier,
        g_return_val_if_fail (TRACKER_IS_FILE_NOTIFIER (notifier), G_FILE_TYPE_UNKNOWN);
        g_return_val_if_fail (G_IS_FILE (file), G_FILE_TYPE_UNKNOWN);
 
-       priv = notifier->priv;
+       priv = tracker_file_notifier_get_instance_private (notifier);
        canonical = tracker_file_system_get_file (priv->file_system,
                                                  file,
                                                  G_FILE_TYPE_REGULAR,
diff --git a/src/libtracker-miner/tracker-file-notifier.h b/src/libtracker-miner/tracker-file-notifier.h
index 921c2a65e..592dfee2c 100644
--- a/src/libtracker-miner/tracker-file-notifier.h
+++ b/src/libtracker-miner/tracker-file-notifier.h
@@ -45,7 +45,6 @@ typedef enum _TrackerFileNotifierType TrackerFileNotifierType;
 
 struct _TrackerFileNotifier {
        GObject parent_instance;
-       gpointer priv;
 };
 
 struct _TrackerFileNotifierClass {
diff --git a/src/libtracker-miner/tracker-file-system.c b/src/libtracker-miner/tracker-file-system.c
index e21bded18..5e92602f0 100644
--- a/src/libtracker-miner/tracker-file-system.c
+++ b/src/libtracker-miner/tracker-file-system.c
@@ -65,7 +65,7 @@ static GQuark quark_file_node = 0;
 static void file_weak_ref_notify (gpointer    user_data,
                                   GObject    *prev_location);
 
-G_DEFINE_TYPE (TrackerFileSystem, tracker_file_system, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerFileSystem, tracker_file_system, G_TYPE_OBJECT)
 
 /*
  * TrackerFileSystem is a filesystem abstraction, it mainly serves 2 purposes:
@@ -343,7 +343,7 @@ file_system_finalize (GObject *object)
 {
        TrackerFileSystemPrivate *priv;
 
-       priv = TRACKER_FILE_SYSTEM (object)->priv;
+       priv = tracker_file_system_get_instance_private (TRACKER_FILE_SYSTEM (object));
 
        g_node_traverse (priv->file_tree,
                         G_POST_ORDER,
@@ -367,7 +367,7 @@ file_system_constructed (GObject *object)
 
        G_OBJECT_CLASS (tracker_file_system_parent_class)->constructed (object);
 
-       priv = TRACKER_FILE_SYSTEM (object)->priv;
+       priv = tracker_file_system_get_instance_private (TRACKER_FILE_SYSTEM (object));
 
        if (priv->root == NULL) {
                priv->root = g_file_new_for_uri ("file:///");
@@ -385,7 +385,7 @@ file_system_get_property (GObject    *object,
 {
        TrackerFileSystemPrivate *priv;
 
-       priv = TRACKER_FILE_SYSTEM (object)->priv;
+       priv = tracker_file_system_get_instance_private (TRACKER_FILE_SYSTEM (object));
 
        switch (prop_id) {
        case PROP_ROOT:
@@ -405,7 +405,7 @@ file_system_set_property (GObject      *object,
 {
        TrackerFileSystemPrivate *priv;
 
-       priv = TRACKER_FILE_SYSTEM (object)->priv;
+       priv = tracker_file_system_get_instance_private (TRACKER_FILE_SYSTEM (object));
 
        switch (prop_id) {
        case PROP_ROOT:
@@ -435,19 +435,12 @@ tracker_file_system_class_init (TrackerFileSystemClass *klass)
                                                              G_TYPE_FILE,
                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
-       g_type_class_add_private (object_class,
-                                 sizeof (TrackerFileSystemPrivate));
-
        quark_file_node =
                g_quark_from_static_string ("tracker-quark-file-node");
 }
 static void
 tracker_file_system_init (TrackerFileSystem *file_system)
 {
-       file_system->priv =
-               G_TYPE_INSTANCE_GET_PRIVATE (file_system,
-                                            TRACKER_TYPE_FILE_SYSTEM,
-                                            TrackerFileSystemPrivate);
 }
 
 TrackerFileSystem *
@@ -525,7 +518,7 @@ file_system_get_node (TrackerFileSystem *file_system,
        if (lookup_data && lookup_data->file_system == file_system)
                return lookup_data->node;
 
-       priv = file_system->priv;
+       priv = tracker_file_system_get_instance_private (file_system);
        return file_tree_lookup (priv->file_tree, file, NULL, NULL);
 }
 
@@ -545,7 +538,7 @@ tracker_file_system_get_file (TrackerFileSystem *file_system,
        g_return_val_if_fail (G_IS_FILE (file), NULL);
        g_return_val_if_fail (TRACKER_IS_FILE_SYSTEM (file_system), NULL);
 
-       priv = file_system->priv;
+       priv = tracker_file_system_get_instance_private (file_system);
        node = NULL;
        lookup_data = g_object_get_qdata (G_OBJECT (file), quark_file_node);
 
@@ -714,7 +707,7 @@ tracker_file_system_traverse (TrackerFileSystem             *file_system,
        g_return_if_fail (TRACKER_IS_FILE_SYSTEM (file_system));
        g_return_if_fail (func != NULL);
 
-       priv = file_system->priv;
+       priv = tracker_file_system_get_instance_private (file_system);
 
        if (root) {
                node = file_system_get_node (file_system, root);
diff --git a/src/libtracker-miner/tracker-file-system.h b/src/libtracker-miner/tracker-file-system.h
index dc3e72474..5da7fbab8 100644
--- a/src/libtracker-miner/tracker-file-system.h
+++ b/src/libtracker-miner/tracker-file-system.h
@@ -42,7 +42,6 @@ typedef struct _TrackerFileSystemClass TrackerFileSystemClass;
 
 struct _TrackerFileSystem {
        GObject parent_instance;
-       gpointer priv;
 };
 
 struct _TrackerFileSystemClass {
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index d56c7f882..f240bfcd5 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -30,8 +30,6 @@
  * by the #TrackerMinerFS.
  **/
 
-G_DEFINE_TYPE (TrackerIndexingTree, tracker_indexing_tree, G_TYPE_OBJECT)
-
 typedef struct _TrackerIndexingTreePrivate TrackerIndexingTreePrivate;
 typedef struct _NodeData NodeData;
 typedef struct _PatternData PatternData;
@@ -69,6 +67,8 @@ struct _TrackerIndexingTreePrivate
        guint filter_hidden : 1;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerIndexingTree, tracker_indexing_tree, G_TYPE_OBJECT)
+
 enum {
        PROP_0,
        PROP_ROOT,
@@ -356,9 +356,6 @@ tracker_indexing_tree_class_init (TrackerIndexingTreeClass *klass)
                              NULL, NULL,
                              NULL,
                              G_TYPE_NONE, 2, G_TYPE_FILE, G_TYPE_FILE);
-
-       g_type_class_add_private (object_class,
-                                 sizeof (TrackerIndexingTreePrivate));
 }
 
 static void
@@ -367,9 +364,7 @@ tracker_indexing_tree_init (TrackerIndexingTree *tree)
        TrackerIndexingTreePrivate *priv;
        gint i;
 
-       priv = tree->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree,
-                                                        TRACKER_TYPE_INDEXING_TREE,
-                                                        TrackerIndexingTreePrivate);
+       priv = tree->priv = tracker_indexing_tree_get_instance_private (tree);
 
        for (i = TRACKER_FILTER_FILE; i <= TRACKER_FILTER_PARENT_DIRECTORY; i++) {
                priv->policies[i] = TRACKER_FILTER_POLICY_ACCEPT;
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 2b25d3817..07b6e14ef 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -137,8 +137,6 @@ static gboolean miner_fs_queues_status_trace_timeout_cb (gpointer data);
  * ]|
  **/
 
-#define TRACKER_MINER_FS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_MINER_FS, 
TrackerMinerFSPrivate))
-
 typedef struct {
        guint16 type;
        guint attributes_update : 1;
@@ -327,6 +325,7 @@ static guint signals[LAST_SIGNAL] = { 0, };
 G_DEFINE_QUARK (TrackerMinerFSError, tracker_miner_fs_error)
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (TrackerMinerFS, tracker_miner_fs, TRACKER_TYPE_MINER,
+                                  G_ADD_PRIVATE (TrackerMinerFS)
                                   G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
                                                          miner_fs_initable_iface_init));
 
@@ -568,8 +567,6 @@ tracker_miner_fs_class_init (TrackerMinerFSClass *klass)
                              G_TYPE_STRING,
                              3, G_TYPE_FILE, G_TYPE_FILE, G_TYPE_BOOLEAN);
 
-       g_type_class_add_private (object_class, sizeof (TrackerMinerFSPrivate));
-
        quark_last_queue_event = g_quark_from_static_string ("tracker-last-queue-event");
 }
 
@@ -578,7 +575,7 @@ tracker_miner_fs_init (TrackerMinerFS *object)
 {
        TrackerMinerFSPrivate *priv;
 
-       object->priv = TRACKER_MINER_FS_GET_PRIVATE (object);
+       object->priv = tracker_miner_fs_get_instance_private (object);
 
        priv = object->priv;
 
@@ -624,7 +621,7 @@ miner_fs_initable_init (GInitable     *initable,
                return FALSE;
        }
 
-       priv = TRACKER_MINER_FS_GET_PRIVATE (initable);
+       priv = TRACKER_MINER_FS (initable)->priv;
 
        g_object_get (initable, "processing-pool-ready-limit", &limit, NULL);
        priv->sparql_buffer = tracker_sparql_buffer_new (tracker_miner_get_connection (TRACKER_MINER 
(initable)),
@@ -848,7 +845,7 @@ fs_finalize (GObject *object)
 {
        TrackerMinerFSPrivate *priv;
 
-       priv = TRACKER_MINER_FS_GET_PRIVATE (object);
+       priv = TRACKER_MINER_FS (object)->priv;
 
        g_timer_destroy (priv->timer);
        g_timer_destroy (priv->extraction_timer);
@@ -923,7 +920,7 @@ fs_constructed (GObject *object)
         */
        G_OBJECT_CLASS (tracker_miner_fs_parent_class)->constructed (object);
 
-       priv = TRACKER_MINER_FS_GET_PRIVATE (object);
+       priv = TRACKER_MINER_FS (object)->priv;
 
        /* Create root if one didn't exist */
        if (priv->root == NULL) {
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 7c19ef6be..20d4591eb 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -59,8 +59,6 @@
  * just after creation (or directly created with g_initable_new()).
  **/
 
-#define TRACKER_MINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_MINER, 
TrackerMinerPrivate))
-
 struct _TrackerMinerPrivate {
        TrackerSparqlConnection *connection;
        gboolean started;
@@ -118,6 +116,7 @@ static gboolean   miner_initable_init          (GInitable              *initable
 G_DEFINE_QUARK (TrackerMinerError, tracker_miner_error)
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (TrackerMiner, tracker_miner, G_TYPE_OBJECT,
+                                  G_ADD_PRIVATE (TrackerMiner)
                                   G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
                                                          miner_initable_iface_init));
 
@@ -275,8 +274,6 @@ tracker_miner_class_init (TrackerMinerClass *klass)
                                                              TRACKER_SPARQL_TYPE_CONNECTION,
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY));
-
-       g_type_class_add_private (object_class, sizeof (TrackerMinerPrivate));
 }
 
 static void
@@ -309,7 +306,7 @@ miner_initable_init (GInitable     *initable,
 static void
 tracker_miner_init (TrackerMiner *miner)
 {
-       miner->priv = TRACKER_MINER_GET_PRIVATE (miner);
+       miner->priv = tracker_miner_get_instance_private (miner);
 }
 
 static gboolean
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index 0ec09abae..51876c086 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -32,11 +32,11 @@
 
 #include "tracker-monitor.h"
 
-#define TRACKER_MONITOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_MONITOR, 
TrackerMonitorPrivate))
-
 /* The life time of an item in the cache */
 #define CACHE_LIFETIME_SECONDS 1
 
+typedef struct TrackerMonitorPrivate  TrackerMonitorPrivate;
+
 struct TrackerMonitorPrivate {
        GHashTable    *monitors;
 
@@ -107,7 +107,7 @@ static gboolean       monitor_cancel_recursively   (TrackerMonitor *monitor,
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
-G_DEFINE_TYPE(TrackerMonitor, tracker_monitor, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerMonitor, tracker_monitor, G_TYPE_OBJECT)
 
 static void
 tracker_monitor_class_init (TrackerMonitorClass *klass)
@@ -185,8 +185,6 @@ tracker_monitor_class_init (TrackerMonitorClass *klass)
                                                               "Enabled",
                                                               TRUE,
                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
-       g_type_class_add_private (object_class, sizeof (TrackerMonitorPrivate));
 }
 
 static void
@@ -197,9 +195,7 @@ tracker_monitor_init (TrackerMonitor *object)
        GFileMonitor          *monitor;
        GError                *error = NULL;
 
-       object->priv = TRACKER_MONITOR_GET_PRIVATE (object);
-
-       priv = object->priv;
+       priv = tracker_monitor_get_instance_private (object);
 
        /* By default we enable monitoring */
        priv->enabled = TRUE;
@@ -314,7 +310,7 @@ tracker_monitor_finalize (GObject *object)
 {
        TrackerMonitorPrivate *priv;
 
-       priv = TRACKER_MONITOR_GET_PRIVATE (object);
+       priv = tracker_monitor_get_instance_private (TRACKER_MONITOR (object));
 
        g_hash_table_unref (priv->cached_events);
        g_hash_table_unref (priv->monitors);
@@ -347,7 +343,7 @@ tracker_monitor_get_property (GObject      *object,
 {
        TrackerMonitorPrivate *priv;
 
-       priv = TRACKER_MONITOR_GET_PRIVATE (object);
+       priv = tracker_monitor_get_instance_private (TRACKER_MONITOR (object));
 
        switch (prop_id) {
        case PROP_ENABLED:
@@ -420,11 +416,15 @@ check_is_directory (TrackerMonitor *monitor,
                return TRUE;
 
        if (file_type == G_FILE_TYPE_UNKNOWN) {
+               TrackerMonitorPrivate *priv;
+
+               priv = tracker_monitor_get_instance_private (monitor);
+
                /* Whatever it was, it's gone. Check the monitors
                 * hashtable to know whether it was a directory
                 * we knew about
                 */
-               if (g_hash_table_lookup (monitor->priv->monitors, file) != NULL)
+               if (g_hash_table_lookup (priv->monitors, file) != NULL)
                        return TRUE;
        }
 
@@ -436,12 +436,15 @@ tracker_monitor_move (TrackerMonitor *monitor,
                       GFile          *old_file,
                       GFile          *new_file)
 {
+       TrackerMonitorPrivate *priv;
        GHashTableIter iter;
        GHashTable *new_monitors;
        gchar *old_prefix;
        gpointer iter_file, iter_file_monitor;
        guint items_moved = 0;
 
+       priv = tracker_monitor_get_instance_private (monitor);
+
        /* So this is tricky. What we have to do is:
         *
         * 1) Add all monitors for the new_file directory hierarchy
@@ -459,7 +462,7 @@ tracker_monitor_move (TrackerMonitor *monitor,
        old_prefix = g_file_get_path (old_file);
 
        /* Find out which subdirectories should have a file monitor added */
-       g_hash_table_iter_init (&iter, monitor->priv->monitors);
+       g_hash_table_iter_init (&iter, priv->monitors);
        while (g_hash_table_iter_next (&iter, &iter_file, &iter_file_monitor)) {
                GFile *f;
                gchar *old_path, *new_path;
@@ -612,10 +615,13 @@ flush_cached_event (TrackerMonitor *monitor,
                     gboolean        is_directory)
 {
        GFileMonitorEvent prev_event_type;
+       TrackerMonitorPrivate *priv;
 
-       if (g_hash_table_lookup_extended (monitor->priv->cached_events,
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       if (g_hash_table_lookup_extended (priv->cached_events,
                                          file, NULL, (gpointer*) &prev_event_type)) {
-               g_hash_table_remove (monitor->priv->cached_events, file);
+               g_hash_table_remove (priv->cached_events, file);
                emit_signal_for_event (monitor, prev_event_type,
                                       is_directory, file, NULL);
        }
@@ -626,7 +632,10 @@ cache_event (TrackerMonitor    *monitor,
              GFile             *file,
              GFileMonitorEvent  event_type)
 {
-       g_hash_table_insert (monitor->priv->cached_events,
+       TrackerMonitorPrivate *priv;
+
+       priv = tracker_monitor_get_instance_private (monitor);
+       g_hash_table_insert (priv->cached_events,
                             g_object_ref (file),
                             GUINT_TO_POINTER (event_type));
 }
@@ -642,10 +651,12 @@ monitor_event_cb (GFileMonitor      *file_monitor,
        gchar *file_uri;
        gchar *other_file_uri;
        gboolean is_directory = FALSE;
+       TrackerMonitorPrivate *priv;
 
        monitor = user_data;
+       priv = tracker_monitor_get_instance_private (monitor);
 
-       if (G_UNLIKELY (!monitor->priv->enabled)) {
+       if (G_UNLIKELY (!priv->enabled)) {
                g_debug ("Silently dropping monitor event, monitor disabled for now");
                return;
        }
@@ -657,8 +668,8 @@ monitor_event_cb (GFileMonitor      *file_monitor,
                is_directory = check_is_directory (monitor, file);
 
                /* Avoid non-indexable-files */
-               if (monitor->priv->tree &&
-                   !tracker_indexing_tree_file_is_indexable (monitor->priv->tree,
+               if (priv->tree &&
+                   !tracker_indexing_tree_file_is_indexable (priv->tree,
                                                              file,
                                                              (is_directory ?
                                                               G_FILE_TYPE_DIRECTORY :
@@ -684,13 +695,13 @@ monitor_event_cb (GFileMonitor      *file_monitor,
                /* Avoid doing anything of both
                 * file/other_file are non-indexable
                 */
-               if (monitor->priv->tree &&
-                   !tracker_indexing_tree_file_is_indexable (monitor->priv->tree,
+               if (priv->tree &&
+                   !tracker_indexing_tree_file_is_indexable (priv->tree,
                                                              file,
                                                              (is_directory ?
                                                               G_FILE_TYPE_DIRECTORY :
                                                               G_FILE_TYPE_REGULAR)) &&
-                   !tracker_indexing_tree_file_is_indexable (monitor->priv->tree,
+                   !tracker_indexing_tree_file_is_indexable (priv->tree,
                                                              other_file,
                                                              (is_directory ?
                                                               G_FILE_TYPE_DIRECTORY :
@@ -710,7 +721,7 @@ monitor_event_cb (GFileMonitor      *file_monitor,
        switch (event_type) {
        case G_FILE_MONITOR_EVENT_CREATED:
        case G_FILE_MONITOR_EVENT_CHANGED:
-               if (monitor->priv->use_changed_event) {
+               if (priv->use_changed_event) {
                        cache_event (monitor, file, event_type);
                } else {
                        emit_signal_for_event (monitor, event_type,
@@ -818,33 +829,45 @@ tracker_monitor_new (void)
 gboolean
 tracker_monitor_get_enabled (TrackerMonitor *monitor)
 {
+       TrackerMonitorPrivate *priv;
+
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
 
-       return monitor->priv->enabled;
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       return priv->enabled;
 }
 
 TrackerIndexingTree *
 tracker_monitor_get_indexing_tree (TrackerMonitor *monitor)
 {
+       TrackerMonitorPrivate *priv;
+
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), NULL);
 
-       return monitor->priv->tree;
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       return priv->tree;
 }
 
 void
 tracker_monitor_set_indexing_tree (TrackerMonitor      *monitor,
                                    TrackerIndexingTree *tree)
 {
+       TrackerMonitorPrivate *priv;
+
        g_return_if_fail (TRACKER_IS_MONITOR (monitor));
        g_return_if_fail (!tree || TRACKER_IS_INDEXING_TREE (tree));
 
-       if (monitor->priv->tree) {
-               g_object_unref (monitor->priv->tree);
-               monitor->priv->tree = NULL;
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       if (priv->tree) {
+               g_object_unref (priv->tree);
+               priv->tree = NULL;
        }
 
        if (tree) {
-               monitor->priv->tree = g_object_ref (tree);
+               priv->tree = g_object_ref (tree);
        }
 }
 
@@ -852,21 +875,24 @@ void
 tracker_monitor_set_enabled (TrackerMonitor *monitor,
                              gboolean        enabled)
 {
+       TrackerMonitorPrivate *priv;
        GList *keys, *k;
 
        g_return_if_fail (TRACKER_IS_MONITOR (monitor));
 
+       priv = tracker_monitor_get_instance_private (monitor);
+
        /* Don't replace all monitors if we are already
         * enabled/disabled.
         */
-       if (monitor->priv->enabled == enabled) {
+       if (priv->enabled == enabled) {
                return;
        }
 
-       monitor->priv->enabled = enabled;
+       priv->enabled = enabled;
        g_object_notify (G_OBJECT (monitor), "enabled");
 
-       keys = g_hash_table_get_keys (monitor->priv->monitors);
+       keys = g_hash_table_get_keys (priv->monitors);
 
        /* Update state on all monitored dirs */
        for (k = keys; k != NULL; k = k->next) {
@@ -878,11 +904,11 @@ tracker_monitor_set_enabled (TrackerMonitor *monitor,
                        GFileMonitor *dir_monitor;
 
                        dir_monitor = directory_monitor_new (monitor, file);
-                       g_hash_table_replace (monitor->priv->monitors,
+                       g_hash_table_replace (priv->monitors,
                                              g_object_ref (file), dir_monitor);
                } else {
                        /* Remove monitor */
-                       g_hash_table_replace (monitor->priv->monitors,
+                       g_hash_table_replace (priv->monitors,
                                              g_object_ref (file), NULL);
                }
        }
@@ -894,25 +920,28 @@ gboolean
 tracker_monitor_add (TrackerMonitor *monitor,
                      GFile          *file)
 {
+       TrackerMonitorPrivate *priv;
        GFileMonitor *dir_monitor = NULL;
        gchar *uri;
 
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
        g_return_val_if_fail (G_IS_FILE (file), FALSE);
 
-       if (g_hash_table_lookup (monitor->priv->monitors, file)) {
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       if (g_hash_table_lookup (priv->monitors, file)) {
                return TRUE;
        }
 
        /* Cap the number of monitors */
-       if (g_hash_table_size (monitor->priv->monitors) >= monitor->priv->monitor_limit) {
-               monitor->priv->monitors_ignored++;
+       if (g_hash_table_size (priv->monitors) >= priv->monitor_limit) {
+               priv->monitors_ignored++;
 
-               if (!monitor->priv->monitor_limit_warned) {
+               if (!priv->monitor_limit_warned) {
                        g_warning ("The maximum number of monitors to set (%d) "
                                   "has been reached, not adding any new ones",
-                                  monitor->priv->monitor_limit);
-                       monitor->priv->monitor_limit_warned = TRUE;
+                                  priv->monitor_limit);
+                       priv->monitor_limit_warned = TRUE;
                }
 
                return FALSE;
@@ -920,7 +949,7 @@ tracker_monitor_add (TrackerMonitor *monitor,
 
        uri = g_file_get_uri (file);
 
-       if (monitor->priv->enabled) {
+       if (priv->enabled) {
                /* We don't check if a file exists or not since we might want
                 * to monitor locations which don't exist yet.
                 *
@@ -940,13 +969,13 @@ tracker_monitor_add (TrackerMonitor *monitor,
         * enabled/disabled state changes, we iterate all keys and
         * add or remove monitors.
         */
-       g_hash_table_insert (monitor->priv->monitors,
+       g_hash_table_insert (priv->monitors,
                             g_object_ref (file),
                             dir_monitor);
 
        g_debug ("Added monitor for path:'%s', total monitors:%d",
                 uri,
-                g_hash_table_size (monitor->priv->monitors));
+                g_hash_table_size (priv->monitors));
 
        g_free (uri);
 
@@ -957,12 +986,14 @@ gboolean
 tracker_monitor_remove (TrackerMonitor *monitor,
                         GFile          *file)
 {
+       TrackerMonitorPrivate *priv;
        gboolean removed;
 
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
        g_return_val_if_fail (G_IS_FILE (file), FALSE);
 
-       removed = g_hash_table_remove (monitor->priv->monitors, file);
+       priv = tracker_monitor_get_instance_private (monitor);
+       removed = g_hash_table_remove (priv->monitors, file);
 
        if (removed) {
                gchar *uri;
@@ -970,7 +1001,7 @@ tracker_monitor_remove (TrackerMonitor *monitor,
                uri = g_file_get_uri (file);
                g_debug ("Removed monitor for path:'%s', total monitors:%d",
                         uri,
-                        g_hash_table_size (monitor->priv->monitors));
+                        g_hash_table_size (priv->monitors));
 
                g_free (uri);
        }
@@ -995,6 +1026,7 @@ remove_recursively (TrackerMonitor *monitor,
                     GFile          *file,
                     gboolean        remove_top_level)
 {
+       TrackerMonitorPrivate *priv;
        GHashTableIter iter;
        gpointer iter_file, iter_file_monitor;
        guint items_removed = 0;
@@ -1003,7 +1035,9 @@ remove_recursively (TrackerMonitor *monitor,
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
        g_return_val_if_fail (G_IS_FILE (file), FALSE);
 
-       g_hash_table_iter_init (&iter, monitor->priv->monitors);
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       g_hash_table_iter_init (&iter, priv->monitors);
        while (g_hash_table_iter_next (&iter, &iter_file, &iter_file_monitor)) {
                if (!file_has_maybe_strict_prefix (iter_file, file,
                                                   !remove_top_level)) {
@@ -1018,12 +1052,12 @@ remove_recursively (TrackerMonitor *monitor,
        g_debug ("Removed all monitors %srecursively for path:'%s', "
                 "total monitors:%d",
                 !remove_top_level ? "(except top level) " : "",
-                uri, g_hash_table_size (monitor->priv->monitors));
+                uri, g_hash_table_size (priv->monitors));
        g_free (uri);
 
        if (items_removed > 0) {
                /* We reset this because now it is possible we have limit - 1 */
-               monitor->priv->monitor_limit_warned = FALSE;
+               priv->monitor_limit_warned = FALSE;
                return TRUE;
        }
 
@@ -1048,11 +1082,14 @@ static gboolean
 monitor_cancel_recursively (TrackerMonitor *monitor,
                             GFile          *file)
 {
+       TrackerMonitorPrivate *priv;
        GHashTableIter iter;
        gpointer iter_file, iter_file_monitor;
        guint items_cancelled = 0;
 
-       g_hash_table_iter_init (&iter, monitor->priv->monitors);
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       g_hash_table_iter_init (&iter, priv->monitors);
        while (g_hash_table_iter_next (&iter, &iter_file, &iter_file_monitor)) {
                gchar *uri;
 
@@ -1076,24 +1113,31 @@ gboolean
 tracker_monitor_is_watched (TrackerMonitor *monitor,
                             GFile          *file)
 {
+       TrackerMonitorPrivate *priv;
+
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
        g_return_val_if_fail (G_IS_FILE (file), FALSE);
 
-       return g_hash_table_lookup (monitor->priv->monitors, file) != NULL;
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       return g_hash_table_lookup (priv->monitors, file) != NULL;
 }
 
 gboolean
 tracker_monitor_is_watched_by_string (TrackerMonitor *monitor,
                                       const gchar    *path)
 {
+       TrackerMonitorPrivate *priv;
        GFile      *file;
        gboolean    watched;
 
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
        g_return_val_if_fail (path != NULL, FALSE);
 
+       priv = tracker_monitor_get_instance_private (monitor);
+
        file = g_file_new_for_path (path);
-       watched = g_hash_table_lookup (monitor->priv->monitors, file) != NULL;
+       watched = g_hash_table_lookup (priv->monitors, file) != NULL;
        g_object_unref (file);
 
        return watched;
@@ -1102,23 +1146,35 @@ tracker_monitor_is_watched_by_string (TrackerMonitor *monitor,
 guint
 tracker_monitor_get_count (TrackerMonitor *monitor)
 {
+       TrackerMonitorPrivate *priv;
+
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), 0);
 
-       return g_hash_table_size (monitor->priv->monitors);
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       return g_hash_table_size (priv->monitors);
 }
 
 guint
 tracker_monitor_get_ignored (TrackerMonitor *monitor)
 {
+       TrackerMonitorPrivate *priv;
+
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), 0);
 
-       return monitor->priv->monitors_ignored;
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       return priv->monitors_ignored;
 }
 
 guint
 tracker_monitor_get_limit (TrackerMonitor *monitor)
 {
+       TrackerMonitorPrivate *priv;
+
        g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), 0);
 
-       return monitor->priv->monitor_limit;
+       priv = tracker_monitor_get_instance_private (monitor);
+
+       return priv->monitor_limit;
 }
diff --git a/src/libtracker-miner/tracker-monitor.h b/src/libtracker-miner/tracker-monitor.h
index a4a610682..c65427379 100644
--- a/src/libtracker-miner/tracker-monitor.h
+++ b/src/libtracker-miner/tracker-monitor.h
@@ -39,11 +39,9 @@ G_BEGIN_DECLS
 
 typedef struct TrackerMonitor         TrackerMonitor;
 typedef struct TrackerMonitorClass    TrackerMonitorClass;
-typedef struct TrackerMonitorPrivate  TrackerMonitorPrivate;
 
 struct TrackerMonitor {
        GObject         parent;
-       TrackerMonitorPrivate *priv;
 };
 
 struct TrackerMonitorClass {
diff --git a/src/libtracker-miner/tracker-sparql-buffer.c b/src/libtracker-miner/tracker-sparql-buffer.c
index 0bedd07b6..cfbb2f7c7 100644
--- a/src/libtracker-miner/tracker-sparql-buffer.c
+++ b/src/libtracker-miner/tracker-sparql-buffer.c
@@ -63,14 +63,14 @@ struct _UpdateArrayData {
        GArray *sparql_array;
 };
 
-G_DEFINE_TYPE (TrackerSparqlBuffer, tracker_sparql_buffer, TRACKER_TYPE_TASK_POOL)
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerSparqlBuffer, tracker_sparql_buffer, TRACKER_TYPE_TASK_POOL)
 
 static void
 tracker_sparql_buffer_finalize (GObject *object)
 {
        TrackerSparqlBufferPrivate *priv;
 
-       priv = TRACKER_SPARQL_BUFFER (object)->priv;
+       priv = tracker_sparql_buffer_get_instance_private (TRACKER_SPARQL_BUFFER (object));
 
        if (priv->flush_timeout_id != 0) {
                g_source_remove (priv->flush_timeout_id);
@@ -87,7 +87,7 @@ tracker_sparql_buffer_set_property (GObject      *object,
 {
        TrackerSparqlBufferPrivate *priv;
 
-       priv = TRACKER_SPARQL_BUFFER (object)->priv;
+       priv = tracker_sparql_buffer_get_instance_private (TRACKER_SPARQL_BUFFER (object));
 
        switch (param_id) {
        case PROP_CONNECTION:
@@ -107,7 +107,7 @@ tracker_sparql_buffer_get_property (GObject    *object,
 {
        TrackerSparqlBufferPrivate *priv;
 
-       priv = TRACKER_SPARQL_BUFFER (object)->priv;
+       priv = tracker_sparql_buffer_get_instance_private (TRACKER_SPARQL_BUFFER (object));
 
        switch (param_id) {
        case PROP_CONNECTION:
@@ -137,17 +137,15 @@ tracker_sparql_buffer_class_init (TrackerSparqlBufferClass *klass)
                                                              TRACKER_SPARQL_TYPE_CONNECTION,
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY));
-
-       g_type_class_add_private (object_class,
-                                 sizeof (TrackerSparqlBufferPrivate));
 }
 
 static gboolean
 flush_timeout_cb (gpointer user_data)
 {
        TrackerSparqlBuffer *buffer = user_data;
-       TrackerSparqlBufferPrivate *priv = buffer->priv;
+       TrackerSparqlBufferPrivate *priv;
 
+       priv = tracker_sparql_buffer_get_instance_private (buffer);
        tracker_sparql_buffer_flush (buffer, "Buffer time reached");
        priv->flush_timeout_id = 0;
 
@@ -159,7 +157,7 @@ reset_flush_timeout (TrackerSparqlBuffer *buffer)
 {
        TrackerSparqlBufferPrivate *priv;
 
-       priv = buffer->priv;
+       priv = tracker_sparql_buffer_get_instance_private (buffer);
 
        if (priv->flush_timeout_id != 0) {
                g_source_remove (priv->flush_timeout_id);
@@ -173,9 +171,6 @@ reset_flush_timeout (TrackerSparqlBuffer *buffer)
 static void
 tracker_sparql_buffer_init (TrackerSparqlBuffer *buffer)
 {
-       buffer->priv = G_TYPE_INSTANCE_GET_PRIVATE (buffer,
-                                                   TRACKER_TYPE_SPARQL_BUFFER,
-                                                   TrackerSparqlBufferPrivate);
 }
 
 TrackerSparqlBuffer *
@@ -230,7 +225,7 @@ tracker_sparql_buffer_update_array_cb (GObject      *object,
        /* Get arrays of errors and queries */
        update_data = user_data;
        buffer = TRACKER_SPARQL_BUFFER (update_data->buffer);
-       priv = buffer->priv;
+       priv = tracker_sparql_buffer_get_instance_private (buffer);
        priv->n_updates--;
 
        g_debug ("(Sparql buffer) Finished array-update with %u tasks",
@@ -313,7 +308,7 @@ tracker_sparql_buffer_flush (TrackerSparqlBuffer *buffer,
        UpdateArrayData *update_data;
        gint i;
 
-       priv = buffer->priv;
+       priv = tracker_sparql_buffer_get_instance_private (buffer);
 
        if (priv->n_updates > 0) {
                return FALSE;
@@ -405,7 +400,7 @@ sparql_buffer_push_high_priority (TrackerSparqlBuffer *buffer,
        TrackerSparqlBufferPrivate *priv;
        UpdateData *update_data;
 
-       priv = buffer->priv;
+       priv = tracker_sparql_buffer_get_instance_private (buffer);
 
        /* Task pool addition adds a reference (below) */
        update_data = g_slice_new0 (UpdateData);
@@ -427,7 +422,7 @@ sparql_buffer_push_to_pool (TrackerSparqlBuffer *buffer,
 {
        TrackerSparqlBufferPrivate *priv;
 
-       priv = buffer->priv;
+       priv = tracker_sparql_buffer_get_instance_private (buffer);
 
        if (tracker_task_pool_get_size (TRACKER_TASK_POOL (buffer)) == 0) {
                reset_flush_timeout (buffer);
diff --git a/src/libtracker-miner/tracker-sparql-buffer.h b/src/libtracker-miner/tracker-sparql-buffer.h
index 8aedd69fb..bc3b11035 100644
--- a/src/libtracker-miner/tracker-sparql-buffer.h
+++ b/src/libtracker-miner/tracker-sparql-buffer.h
@@ -45,7 +45,6 @@ typedef struct _TrackerSparqlBufferClass TrackerSparqlBufferClass;
 struct _TrackerSparqlBuffer
 {
        TrackerTaskPool parent_instance;
-       gpointer priv;
 };
 
 struct _TrackerSparqlBufferClass
diff --git a/src/libtracker-miner/tracker-task-pool.c b/src/libtracker-miner/tracker-task-pool.c
index 93c42964a..476aab28f 100644
--- a/src/libtracker-miner/tracker-task-pool.c
+++ b/src/libtracker-miner/tracker-task-pool.c
@@ -29,8 +29,6 @@ enum {
        PROP_LIMIT_REACHED
 };
 
-G_DEFINE_TYPE (TrackerTaskPool, tracker_task_pool, G_TYPE_OBJECT)
-
 typedef struct _TrackerTaskPoolPrivate TrackerTaskPoolPrivate;
 
 struct _TrackerTaskPoolPrivate
@@ -47,12 +45,14 @@ struct _TrackerTask
        gint ref_count;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerTaskPool, tracker_task_pool, G_TYPE_OBJECT)
+
 static void
 tracker_task_pool_finalize (GObject *object)
 {
        TrackerTaskPoolPrivate *priv;
 
-       priv = TRACKER_TASK_POOL (object)->priv;
+       priv = tracker_task_pool_get_instance_private (TRACKER_TASK_POOL (object));
        g_hash_table_unref (priv->tasks);
 
        G_OBJECT_CLASS (tracker_task_pool_parent_class)->finalize (object);
@@ -122,8 +122,6 @@ tracker_task_pool_class_init (TrackerTaskPoolClass *klass)
                                                               "Task limit reached",
                                                               FALSE,
                                                               G_PARAM_READABLE));
-
-       g_type_class_add_private (klass, sizeof (TrackerTaskPoolPrivate));
 }
 
 static gboolean
@@ -142,9 +140,7 @@ tracker_task_pool_init (TrackerTaskPool *pool)
 {
        TrackerTaskPoolPrivate *priv;
 
-       priv = pool->priv = G_TYPE_INSTANCE_GET_PRIVATE (pool,
-                                                        TRACKER_TYPE_TASK_POOL,
-                                                        TrackerTaskPoolPrivate);
+       priv = tracker_task_pool_get_instance_private (pool);
        priv->tasks = g_hash_table_new_full (g_file_hash,
                                             (GEqualFunc) file_equal,
                                             NULL,
@@ -171,7 +167,7 @@ tracker_task_pool_set_limit (TrackerTaskPool *pool,
 
        old_limit_reached = tracker_task_pool_limit_reached (pool);
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
        priv->limit = limit;
 
        if (old_limit_reached !=
@@ -187,7 +183,7 @@ tracker_task_pool_get_limit (TrackerTaskPool *pool)
 
        g_return_val_if_fail (TRACKER_IS_TASK_POOL (pool), 0);
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
        return priv->limit;
 }
 
@@ -198,7 +194,7 @@ tracker_task_pool_get_size (TrackerTaskPool *pool)
 
        g_return_val_if_fail (TRACKER_IS_TASK_POOL (pool), 0);
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
        return g_hash_table_size (priv->tasks);
 }
 
@@ -209,7 +205,7 @@ tracker_task_pool_limit_reached (TrackerTaskPool *pool)
 
        g_return_val_if_fail (TRACKER_IS_TASK_POOL (pool), FALSE);
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
        return (g_hash_table_size (priv->tasks) >= priv->limit);
 }
 
@@ -222,7 +218,7 @@ tracker_task_pool_add (TrackerTaskPool *pool,
 
        g_return_if_fail (TRACKER_IS_TASK_POOL (pool));
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
 
        file = tracker_task_get_file (task);
 
@@ -251,7 +247,7 @@ tracker_task_pool_remove (TrackerTaskPool *pool,
 
        g_return_val_if_fail (TRACKER_IS_TASK_POOL (pool), FALSE);
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
 
        if (g_hash_table_remove (priv->tasks,
                                 tracker_task_get_file (task))) {
@@ -278,7 +274,7 @@ tracker_task_pool_foreach (TrackerTaskPool *pool,
        g_return_if_fail (TRACKER_IS_TASK_POOL (pool));
        g_return_if_fail (func != NULL);
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
        g_hash_table_iter_init (&iter, priv->tasks);
 
        while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &task)) {
@@ -295,7 +291,7 @@ tracker_task_pool_find (TrackerTaskPool *pool,
        g_return_val_if_fail (TRACKER_IS_TASK_POOL (pool), NULL);
        g_return_val_if_fail (G_IS_FILE (file), NULL);
 
-       priv = pool->priv;
+       priv = tracker_task_pool_get_instance_private (pool);
        return g_hash_table_lookup (priv->tasks, file);
 }
 
diff --git a/src/libtracker-miner/tracker-task-pool.h b/src/libtracker-miner/tracker-task-pool.h
index 7a2b86d07..ea0f48769 100644
--- a/src/libtracker-miner/tracker-task-pool.h
+++ b/src/libtracker-miner/tracker-task-pool.h
@@ -42,7 +42,6 @@ typedef struct _TrackerTask TrackerTask;
 struct _TrackerTaskPool
 {
        GObject parent_instance;
-       gpointer priv;
 };
 
 struct _TrackerTaskPoolClass


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