[tracker/external-crawler: 36/42] libtracker-miner: Create nodes / cahces in constructed() not init()
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/external-crawler: 36/42] libtracker-miner: Create nodes / cahces in constructed() not init()
- Date: Wed, 6 Aug 2014 07:43:32 +0000 (UTC)
commit 011eccbd624aa494e42482c0d809ec588ee2a671
Author: Martyn Russell <martyn lanedo com>
Date: Tue Jul 1 10:48:11 2014 +0100
libtracker-miner: Create nodes / cahces in constructed() not init()
We do this because the GFile which is the root for the TrackerFileSystem is a
property which is set on object construction. If we try to do this in init()
the root is unset at that point. So we wait until constructed where properties
are guaranteed to be set.
Also Chain parent constructed() in TrackerFileSystem
src/libtracker-miner/tracker-file-system.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-system.c b/src/libtracker-miner/tracker-file-system.c
index 9d5384d..72943b0 100644
--- a/src/libtracker-miner/tracker-file-system.c
+++ b/src/libtracker-miner/tracker-file-system.c
@@ -364,6 +364,24 @@ file_system_finalize (GObject *object)
}
static void
+file_system_constructed (GObject *object)
+{
+ TrackerFileSystemPrivate *priv;
+ FileNodeData *root_data;
+
+ G_OBJECT_CLASS (tracker_file_system_parent_class)->constructed (object);
+
+ priv = TRACKER_FILE_SYSTEM (object)->priv;
+
+ if (priv->root == NULL) {
+ priv->root = g_file_new_for_uri ("file:///");
+ }
+
+ root_data = file_node_data_root_new (priv->root);
+ priv->file_tree = g_node_new (root_data);
+}
+
+static void
file_system_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -409,6 +427,7 @@ tracker_file_system_class_init (TrackerFileSystemClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = file_system_finalize;
+ object_class->constructed = file_system_constructed;
object_class->get_property = file_system_get_property;
object_class->set_property = file_system_set_property;
@@ -430,19 +449,11 @@ static void
tracker_file_system_init (TrackerFileSystem *file_system)
{
TrackerFileSystemPrivate *priv;
- FileNodeData *root_data;
file_system->priv = priv =
G_TYPE_INSTANCE_GET_PRIVATE (file_system,
TRACKER_TYPE_FILE_SYSTEM,
TrackerFileSystemPrivate);
-
- if (priv->root == NULL) {
- priv->root = g_file_new_for_uri ("file:///");
- }
-
- root_data = file_node_data_root_new (priv->root);
- priv->file_tree = g_node_new (root_data);
}
TrackerFileSystem *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]