[tracker/libtracker-miner] TrackerCrawler: Use an accumulator for process-[directory|file].
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-miner] TrackerCrawler: Use an accumulator for process-[directory|file].
- Date: Tue, 25 Aug 2009 09:50:08 +0000 (UTC)
commit 45b1471258ef021da327b7559e763faea73bf5eb
Author: Carlos Garnacho <carlos lanedo com>
Date: Tue Aug 25 11:42:46 2009 +0200
TrackerCrawler: Use an accumulator for process-[directory|file].
The meaning of the boolean return value in these signals is now inverted.
Returning TRUE will also stop further processing, so the default
implementations for these signals won't be able to clobber the result of
any added handlers.
src/libtracker-miner/tracker-crawler.c | 28 +++++++++++++------------
src/libtracker-miner/tracker-miner-process.c | 4 +-
2 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index b571b37..592c913 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -107,21 +107,23 @@ tracker_crawler_class_init (TrackerCrawlerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (TrackerCrawlerClass, process_directory),
- NULL, NULL,
+ g_signal_accumulator_true_handled,
+ NULL,
tracker_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN,
1,
- G_TYPE_OBJECT);
+ G_TYPE_FILE);
signals[PROCESS_FILE] =
g_signal_new ("process-file",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (TrackerCrawlerClass, process_file),
- NULL, NULL,
+ g_signal_accumulator_true_handled,
+ NULL,
tracker_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN,
1,
- G_TYPE_OBJECT);
+ G_TYPE_FILE);
signals[FINISHED] =
g_signal_new ("finished",
G_TYPE_FROM_CLASS (klass),
@@ -181,7 +183,7 @@ static gboolean
process_defaults (TrackerCrawler *crawler,
GFile *file)
{
- return TRUE;
+ return FALSE;
}
TrackerCrawler *
@@ -219,36 +221,36 @@ static gboolean
process_file (TrackerCrawler *crawler,
GFile *file)
{
- gboolean should_process = TRUE;
+ gboolean should_ignore = FALSE;
- g_signal_emit (crawler, signals[PROCESS_FILE], 0, file, &should_process);
+ g_signal_emit (crawler, signals[PROCESS_FILE], 0, file, &should_ignore);
crawler->private->files_found++;
- if (!should_process) {
+ if (should_ignore) {
crawler->private->files_ignored++;
}
- return should_process;
+ return !should_ignore;
}
static gboolean
process_directory (TrackerCrawler *crawler,
GFile *file)
{
- gboolean should_process = TRUE;
+ gboolean should_ignore = FALSE;
- g_signal_emit (crawler, signals[PROCESS_DIRECTORY], 0, file, &should_process);
+ g_signal_emit (crawler, signals[PROCESS_DIRECTORY], 0, file, &should_ignore);
crawler->private->directories_found++;
- if (should_process) {
+ if (!should_ignore) {
file_enumerate_children (crawler, file);
} else {
crawler->private->directories_ignored++;
}
- return should_process;
+ return !should_ignore;
}
static gboolean
diff --git a/src/libtracker-miner/tracker-miner-process.c b/src/libtracker-miner/tracker-miner-process.c
index 0bfc60d..ba63bd8 100644
--- a/src/libtracker-miner/tracker-miner-process.c
+++ b/src/libtracker-miner/tracker-miner-process.c
@@ -1019,7 +1019,7 @@ crawler_process_file_cb (TrackerCrawler *crawler,
g_free (path);
- return should_process;
+ return !should_process;
}
static gboolean
@@ -1058,7 +1058,7 @@ crawler_process_directory_cb (TrackerCrawler *crawler,
g_free (path);
- return should_process;
+ return !should_process;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]