[tracker] TrackerMinerFS: Forward the check-directory-contents signals.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] TrackerMinerFS: Forward the check-directory-contents signals.
- Date: Fri, 11 Sep 2009 11:31:54 +0000 (UTC)
commit f4d24218e9fc04f31c17eb552c5c7359d80b2a9b
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Sep 11 13:28:08 2009 +0200
TrackerMinerFS: Forward the check-directory-contents signals.
This way miner implementations may choose whether to index a folder or not
based on its contents.
src/libtracker-miner/tracker-miner-fs.c | 43 +++++++++++++++++++++++++++++++
src/libtracker-miner/tracker-miner-fs.h | 3 ++
2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 6bbaa12..b66352d 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -92,6 +92,7 @@ enum {
enum {
CHECK_FILE,
CHECK_DIRECTORY,
+ CHECK_DIRECTORY_CONTENTS,
MONITOR_DIRECTORY,
FINISHED,
LAST_SIGNAL
@@ -100,6 +101,9 @@ enum {
static void fs_finalize (GObject *object);
static gboolean fs_defaults (TrackerMinerFS *fs,
GFile *file);
+static gboolean fs_contents_defaults (TrackerMinerFS *fs,
+ GFile *parent,
+ GList *children);
static void miner_started (TrackerMiner *miner);
static void miner_stopped (TrackerMiner *miner);
static void miner_paused (TrackerMiner *miner);
@@ -135,6 +139,10 @@ static gboolean crawler_check_file_cb (TrackerCrawler *crawler,
static gboolean crawler_check_directory_cb (TrackerCrawler *crawler,
GFile *file,
gpointer user_data);
+static gboolean crawler_check_directory_contents_cb (TrackerCrawler *crawler,
+ GFile *parent,
+ GList *children,
+ gpointer user_data);
static void crawler_finished_cb (TrackerCrawler *crawler,
GQueue *found,
gboolean was_interrupted,
@@ -170,6 +178,7 @@ tracker_miner_fs_class_init (TrackerMinerFSClass *klass)
fs_class->check_file = fs_defaults;
fs_class->check_directory = fs_defaults;
fs_class->monitor_directory = fs_defaults;
+ fs_class->check_directory_contents = fs_contents_defaults;
signals[CHECK_FILE] =
g_signal_new ("check-file",
@@ -189,6 +198,15 @@ tracker_miner_fs_class_init (TrackerMinerFSClass *klass)
NULL,
tracker_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN, 1, G_TYPE_FILE);
+ signals[CHECK_DIRECTORY_CONTENTS] =
+ g_signal_new ("check-directory-contents",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerMinerFSClass, check_directory_contents),
+ tracker_accumulator_check_file,
+ NULL,
+ tracker_marshal_BOOLEAN__OBJECT_POINTER,
+ G_TYPE_BOOLEAN, 2, G_TYPE_FILE, G_TYPE_POINTER);
signals[MONITOR_DIRECTORY] =
g_signal_new ("monitor-directory",
G_OBJECT_CLASS_TYPE (object_class),
@@ -242,6 +260,9 @@ tracker_miner_fs_init (TrackerMinerFS *object)
g_signal_connect (priv->crawler, "check-directory",
G_CALLBACK (crawler_check_directory_cb),
object);
+ g_signal_connect (priv->crawler, "check-directory-contents",
+ G_CALLBACK (crawler_check_directory_contents_cb),
+ object);
g_signal_connect (priv->crawler, "finished",
G_CALLBACK (crawler_finished_cb),
object);
@@ -317,6 +338,14 @@ fs_defaults (TrackerMinerFS *fs,
return TRUE;
}
+static gboolean
+fs_contents_defaults (TrackerMinerFS *fs,
+ GFile *parent,
+ GList *children)
+{
+ return TRUE;
+}
+
static void
miner_started (TrackerMiner *miner)
{
@@ -1254,6 +1283,20 @@ crawler_check_directory_cb (TrackerCrawler *crawler,
return should_check;
}
+static gboolean
+crawler_check_directory_contents_cb (TrackerCrawler *crawler,
+ GFile *parent,
+ GList *children,
+ gpointer user_data)
+{
+ TrackerMinerFS *fs = user_data;
+ gboolean process;
+
+ g_signal_emit (fs, signals[CHECK_DIRECTORY_CONTENTS], 0, parent, children, &process);
+
+ return process;
+}
+
static void
crawler_finished_cb (TrackerCrawler *crawler,
GQueue *found,
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index d8da89d..a850f98 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -59,6 +59,9 @@ struct TrackerMinerFSClass {
GFile *file);
gboolean (* check_directory) (TrackerMinerFS *fs,
GFile *file);
+ gboolean (* check_directory_contents) (TrackerMinerFS *fs,
+ GFile *parent,
+ GList *children);
gboolean (* process_file) (TrackerMinerFS *fs,
GFile *file,
TrackerSparqlBuilder *builder,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]