[tracker/miner-fs-dbus-api: 7/13] Rename tracker_miner_fs_file_add() to check_file().
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-dbus-api: 7/13] Rename tracker_miner_fs_file_add() to check_file().
- Date: Mon, 23 Aug 2010 13:35:51 +0000 (UTC)
commit 5061aed356749b75e14052a692dc882a4ad40790
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Aug 19 18:08:40 2010 +0200
Rename tracker_miner_fs_file_add() to check_file().
src/libtracker-miner/tracker-miner-fs.c | 93 ++++++++++++++++------------
src/libtracker-miner/tracker-miner-fs.h | 2 +-
src/miners/fs/tracker-main.c | 2 +-
src/miners/fs/tracker-miner-files-index.c | 4 +-
4 files changed, 57 insertions(+), 44 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index bfe7023..e576942 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -3586,17 +3586,61 @@ tracker_miner_fs_directory_remove_full (TrackerMinerFS *fs,
return FALSE;
}
+static gboolean
+check_file_parents (TrackerMinerFS *fs,
+ GFile *file)
+{
+ DirectoryData *data;
+ GFile *parent;
+ GList *parents = NULL, *p;
+
+ parent = g_file_get_parent (file);
+
+ if (!parent) {
+ return FALSE;
+ }
+
+ data = find_config_directory (fs, parent);
+
+ if (!data) {
+ return FALSE;
+ }
+
+ /* Add parent directories until we're past the config dir */
+ while (parent &&
+ !g_file_has_prefix (data->file, parent)) {
+ parents = g_list_prepend (parents, parent);
+ parent = g_file_get_parent (parent);
+ }
+
+ /* Last parent fetched is not added to the list */
+ if (parent) {
+ g_object_unref (parent);
+ }
+
+ for (p = parents; p; p = p->next) {
+ g_queue_push_tail (fs->private->items_updated, p->data);
+ }
+
+ g_list_free (parents);
+
+ return TRUE;
+}
+
/**
- * tracker_miner_fs_file_add:
+ * tracker_miner_fs_check_file:
* @fs: a #TrackerMinerFS
- * @file: #GFile for the file to inspect
+ * @file: #GFile for the file to check
+ * @check_parents: whether to check parents as well or not
*
- * Tells the filesystem miner to inspect a file.
+ * Tells the filesystem miner to check and index a file,
+ * this file must be part of the usual crawling directories
+ * of #TrackerMinerFS. See tracker_miner_fs_directory_add().
**/
void
-tracker_miner_fs_file_add (TrackerMinerFS *fs,
- GFile *file,
- gboolean check_parents)
+tracker_miner_fs_check_file (TrackerMinerFS *fs,
+ GFile *file,
+ gboolean check_parents)
{
gboolean should_process;
gchar *path;
@@ -3613,40 +3657,9 @@ tracker_miner_fs_file_add (TrackerMinerFS *fs,
path);
if (should_process) {
- if (check_parents) {
- DirectoryData *data;
- GFile *parent;
- GList *parents = NULL, *p;
-
- parent = g_file_get_parent (file);
-
- if (!parent) {
- return;
- }
-
- data = find_config_directory (fs, parent);
-
- if (!data) {
- return;
- }
-
- /* Add parent directories until we're past the config dir */
- while (parent &&
- !g_file_has_prefix (data->file, parent)) {
- parents = g_list_prepend (parents, parent);
- parent = g_file_get_parent (parent);
- }
-
- /* Last parent fetched is not added to the list */
- if (parent) {
- g_object_unref (parent);
- }
-
- for (p = parents; p; p = p->next) {
- g_queue_push_tail (fs->private->items_updated, p->data);
- }
-
- g_list_free (parents);
+ if (check_parents &&
+ !check_file_parents (fs, file)) {
+ return;
}
g_queue_push_tail (fs->private->items_updated,
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index a959809..9fffc23 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -102,7 +102,7 @@ gboolean tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
GFile *file);
gboolean tracker_miner_fs_directory_remove_full (TrackerMinerFS *fs,
GFile *file);
-void tracker_miner_fs_file_add (TrackerMinerFS *fs,
+void tracker_miner_fs_check_file (TrackerMinerFS *fs,
GFile *file,
gboolean check_parents);
void tracker_miner_fs_file_notify (TrackerMinerFS *fs,
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 676faad..7c2151a 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -636,7 +636,7 @@ main (gint argc, gchar *argv[])
file = g_file_new_for_commandline_arg (add_file);
miner_files = tracker_miner_files_new (NULL);
- tracker_miner_fs_file_add (TRACKER_MINER_FS (miner_files), file, FALSE);
+ tracker_miner_fs_check_file (TRACKER_MINER_FS (miner_files), file, FALSE);
g_object_unref (file);
}
diff --git a/src/miners/fs/tracker-miner-files-index.c b/src/miners/fs/tracker-miner-files-index.c
index 5d25eae..b7ab154 100644
--- a/src/miners/fs/tracker-miner-files-index.c
+++ b/src/miners/fs/tracker-miner-files-index.c
@@ -184,7 +184,7 @@ mime_types_cb (GObject *object,
url = tracker_sparql_cursor_get_string (cursor, 0, NULL);
file = g_file_new_for_uri (url);
- tracker_miner_fs_file_add (TRACKER_MINER_FS (mtd->miner_files), file, FALSE);
+ tracker_miner_fs_check_file (TRACKER_MINER_FS (mtd->miner_files), file, FALSE);
g_object_unref (file);
}
@@ -377,7 +377,7 @@ tracker_miner_files_index_index_file (TrackerMinerFilesIndex *object,
return;
}
- tracker_miner_fs_file_add (TRACKER_MINER_FS (priv->files_miner), file, TRUE);
+ tracker_miner_fs_check_file (TRACKER_MINER_FS (priv->files_miner), file, TRUE);
tracker_dbus_request_success (request_id, context);
dbus_g_method_return (context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]