[tracker/miner-fs-refactor: 34/74] libtracker-miner: Add tracker_file_system_traverse()



commit eb9a00bf83305ebcbd6c8c797631a213f6d1f66d
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Sep 28 17:40:36 2011 +0200

    libtracker-miner: Add tracker_file_system_traverse()
    
    This function iterates over all known files, it is possible
    to provide a root to start from, or NULL.

 src/libtracker-miner/tracker-file-system.c |   21 +++++++++++++++++++++
 src/libtracker-miner/tracker-file-system.h |    9 +++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-system.c b/src/libtracker-miner/tracker-file-system.c
index f4dd010..5670380 100644
--- a/src/libtracker-miner/tracker-file-system.c
+++ b/src/libtracker-miner/tracker-file-system.c
@@ -433,6 +433,27 @@ tracker_file_system_resolve_file (TrackerFileSystem *file_system,
 }
 
 void
+tracker_file_system_traverse (TrackerFileSystem             *file_system,
+			      TrackerFile                   *root,
+			      GTraverseType                  order,
+			      TrackerFileSystemTraverseFunc  func,
+			      gpointer                       user_data)
+{
+	TrackerFileSystemPrivate *priv;
+
+	g_return_if_fail (TRACKER_IS_FILE_SYSTEM (file_system));
+	g_return_if_fail (func != NULL);
+
+	priv = file_system->priv;
+	g_node_traverse ((root) ? (GNode *) root : priv->file_tree,
+			 order,
+			 G_TRAVERSE_ALL,
+			 -1,
+			 (GNodeTraverseFunc) func,
+			 user_data);
+}
+
+void
 tracker_file_system_register_property (TrackerFileSystem *file_system,
                                        GQuark             prop,
                                        GDestroyNotify     destroy_notify)
diff --git a/src/libtracker-miner/tracker-file-system.h b/src/libtracker-miner/tracker-file-system.h
index 312bab3..70df3e1 100644
--- a/src/libtracker-miner/tracker-file-system.h
+++ b/src/libtracker-miner/tracker-file-system.h
@@ -50,6 +50,9 @@ struct _TrackerFileSystemClass {
 	GObjectClass parent_class;
 };
 
+typedef gboolean (* TrackerFileSystemTraverseFunc) (TrackerFile *file,
+						    gpointer     user_data);
+
 GType      tracker_file_system_get_type      (void) G_GNUC_CONST;
 
 TrackerFileSystem * tracker_file_system_new  (void);
@@ -66,6 +69,12 @@ void          tracker_file_system_unref_file     (TrackerFileSystem  *file_syste
 TrackerFile * tracker_file_system_peek_file      (TrackerFileSystem  *file_system,
 						  GFile              *file);
 
+void          tracker_file_system_traverse       (TrackerFileSystem             *file_system,
+						  TrackerFile                   *root,
+						  GTraverseType                  order,
+						  TrackerFileSystemTraverseFunc  func,
+						  gpointer                       user_data);
+
 /* TrackerFile -> GFile */
 GFile *       tracker_file_system_resolve_file   (TrackerFileSystem  *file_system,
                                                   TrackerFile        *file);



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