[tracker/miner-fs-refactor: 83/127] libtracker-miner: Add tracker_indexing_tree_list_roots()



commit 8c3256f1d212dbaf136d34b9de8941d35f44b387
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Oct 5 15:17:10 2011 +0200

    libtracker-miner: Add tracker_indexing_tree_list_roots()
    
    This function retrieves the configured roots, the flags can be
    later queried with tracker_indexing_tree_get_root() on these
    files.

 src/libtracker-miner/tracker-indexing-tree.c |   29 ++++++++++++++++++++++++++
 src/libtracker-miner/tracker-indexing-tree.h |    3 ++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index ebeaa4c..47e8c0a 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -820,3 +820,32 @@ tracker_indexing_tree_file_is_root (TrackerIndexingTree *tree,
 	                            (GEqualFunc) g_file_equal);
 	return node != NULL;
 }
+
+static gboolean
+prepend_config_root (GNode    *node,
+		     gpointer  user_data)
+{
+	GList **list = user_data;
+	NodeData *data = node->data;
+
+	*list = g_list_prepend (*list, data->file);
+	return FALSE;
+}
+
+GList *
+tracker_indexing_tree_list_roots (TrackerIndexingTree *tree)
+{
+	TrackerIndexingTreePrivate *priv;
+	GList *nodes = NULL;
+
+	g_return_val_if_fail (TRACKER_IS_INDEXING_TREE (tree), NULL);
+
+	priv = tree->priv;
+	g_node_traverse (priv->config_tree,
+			 G_POST_ORDER,
+			 G_TRAVERSE_ALL,
+			 -1,
+			 prepend_config_root,
+			 &nodes);
+	return nodes;
+}
diff --git a/src/libtracker-miner/tracker-indexing-tree.h b/src/libtracker-miner/tracker-indexing-tree.h
index f79d8b6..f004dcd 100644
--- a/src/libtracker-miner/tracker-indexing-tree.h
+++ b/src/libtracker-miner/tracker-indexing-tree.h
@@ -101,6 +101,9 @@ GFile *   tracker_indexing_tree_get_root             (TrackerIndexingTree   *tre
 gboolean  tracker_indexing_tree_file_is_root         (TrackerIndexingTree   *tree,
                                                       GFile                 *file);
 
+GList *   tracker_indexing_tree_list_roots           (TrackerIndexingTree   *tree);
+
+
 G_END_DECLS
 
 #endif /* __TRACKER_INDEXING_TREE_H__ */



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