[tracker/rss-enclosures] Add tracker_miner_fs_check_directory().



commit 1dac9d853ac514b95bcea5f67787b19c7e6e0260
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 19 18:11:21 2010 +0200

    Add tracker_miner_fs_check_directory().
    
    This function differs with tracker_miner_fs_directory_add() in that
    the directory is not added to priv->config_directories, and the dir
    is only inspected if it's part of one of the configured directories.

 src/libtracker-miner/tracker-miner-fs.c |   41 +++++++++++++++++++++++++++++++
 src/libtracker-miner/tracker-miner-fs.h |    3 ++
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index e576942..d612f1a 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -3672,6 +3672,47 @@ tracker_miner_fs_check_file (TrackerMinerFS *fs,
 }
 
 /**
+ * tracker_miner_fs_check_directory:
+ * @fs: a #TrackerMinerFS
+ * @file: #GFile for the directory to check
+ * @check_parents: whether to check parents as well or not
+ *
+ * Tells the filesystem miner to check and index a directory,
+ * this file must be part of the usual crawling directories
+ * of #TrackerMinerFS. See tracker_miner_fs_directory_add().
+ **/
+void
+tracker_miner_fs_check_directory (TrackerMinerFS *fs,
+                                  GFile          *file,
+                                  gboolean        check_parents)
+{
+	gboolean should_process;
+	gchar *path;
+
+	g_return_if_fail (TRACKER_IS_MINER_FS (fs));
+	g_return_if_fail (G_IS_FILE (file));
+
+	should_process = should_check_file (fs, file, TRUE);
+
+	path = g_file_get_path (file);
+
+	g_debug ("%s:'%s' (DIR) (requested by application)",
+	         should_process ? "Found " : "Ignored",
+	         path);
+
+	if (should_process) {
+		if (check_parents &&
+		    !check_file_parents (fs, file)) {
+			return;
+		}
+
+		tracker_miner_fs_directory_add_internal (fs, file);
+	}
+
+	g_free (path);
+}
+
+/**
  * tracker_miner_fs_file_notify:
  * @fs: a #TrackerMinerFS
  * @file: a #GFile
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index 9fffc23..fb6b9b6 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -105,6 +105,9 @@ gboolean              tracker_miner_fs_directory_remove_full (TrackerMinerFS *fs
 void                  tracker_miner_fs_check_file           (TrackerMinerFS *fs,
                                                              GFile          *file,
                                                              gboolean        check_parents);
+void                  tracker_miner_fs_check_directory      (TrackerMinerFS *fs,
+                                                             GFile          *file,
+                                                             gboolean        check_parents);
 void                  tracker_miner_fs_file_notify          (TrackerMinerFS *fs,
                                                              GFile          *file,
                                                              const GError   *error);



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