[tracker/libtracker-miner] TrackerCrawler: invert meaning of process-file/dir return value once again.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-miner] TrackerCrawler: invert meaning of process-file/dir return value once again.
- Date: Tue, 25 Aug 2009 11:58:28 +0000 (UTC)
commit c2bfaa1767c20d78c0539279bc5be305c7f0df80
Author: Carlos Garnacho <carlos lanedo com>
Date: Tue Aug 25 13:56:28 2009 +0200
TrackerCrawler: invert meaning of process-file/dir return value once again.
Now a custom accumulator is used with inverted logic to
g_signal_accumulator_true_handled, TRUE means keeps processing, and FALSE
ignore.
src/libtracker-miner/Makefile.am | 4 ++-
src/libtracker-miner/tracker-crawler.c | 23 +++++++++--------
src/libtracker-miner/tracker-miner-process.c | 4 +-
src/libtracker-miner/tracker-utils.c | 35 ++++++++++++++++++++++++++
src/libtracker-miner/tracker-utils.h | 35 ++++++++++++++++++++++++++
5 files changed, 87 insertions(+), 14 deletions(-)
---
diff --git a/src/libtracker-miner/Makefile.am b/src/libtracker-miner/Makefile.am
index bc97147..24bc4d0 100644
--- a/src/libtracker-miner/Makefile.am
+++ b/src/libtracker-miner/Makefile.am
@@ -37,7 +37,9 @@ libtracker_miner_la_SOURCES = \
tracker-miner-process.c \
tracker-miner-process.h \
tracker-monitor.c \
- tracker-monitor.h
+ tracker-monitor.h \
+ tracker-utils.c \
+ tracker-utils.h
libtracker_minerinclude_HEADERS = \
tracker-miner.h \
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index 592c913..71b2ce0 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -22,6 +22,7 @@
#include "tracker-crawler.h"
#include "tracker-marshal.h"
+#include "tracker-utils.h"
#define TRACKER_CRAWLER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_CRAWLER, TrackerCrawlerPrivate))
@@ -107,7 +108,7 @@ tracker_crawler_class_init (TrackerCrawlerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (TrackerCrawlerClass, process_directory),
- g_signal_accumulator_true_handled,
+ tracker_accumulator_process_file,
NULL,
tracker_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN,
@@ -118,7 +119,7 @@ tracker_crawler_class_init (TrackerCrawlerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (TrackerCrawlerClass, process_file),
- g_signal_accumulator_true_handled,
+ tracker_accumulator_process_file,
NULL,
tracker_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN,
@@ -183,7 +184,7 @@ static gboolean
process_defaults (TrackerCrawler *crawler,
GFile *file)
{
- return FALSE;
+ return TRUE;
}
TrackerCrawler *
@@ -221,36 +222,36 @@ static gboolean
process_file (TrackerCrawler *crawler,
GFile *file)
{
- gboolean should_ignore = FALSE;
+ gboolean should_process = FALSE;
- g_signal_emit (crawler, signals[PROCESS_FILE], 0, file, &should_ignore);
+ g_signal_emit (crawler, signals[PROCESS_FILE], 0, file, &should_process);
crawler->private->files_found++;
- if (should_ignore) {
+ if (!should_process) {
crawler->private->files_ignored++;
}
- return !should_ignore;
+ return should_process;
}
static gboolean
process_directory (TrackerCrawler *crawler,
GFile *file)
{
- gboolean should_ignore = FALSE;
+ gboolean should_process = FALSE;
- g_signal_emit (crawler, signals[PROCESS_DIRECTORY], 0, file, &should_ignore);
+ g_signal_emit (crawler, signals[PROCESS_DIRECTORY], 0, file, &should_process);
crawler->private->directories_found++;
- if (!should_ignore) {
+ if (should_process) {
file_enumerate_children (crawler, file);
} else {
crawler->private->directories_ignored++;
}
- return !should_ignore;
+ return should_process;
}
static gboolean
diff --git a/src/libtracker-miner/tracker-miner-process.c b/src/libtracker-miner/tracker-miner-process.c
index ba63bd8..0bfc60d 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
diff --git a/src/libtracker-miner/tracker-utils.c b/src/libtracker-miner/tracker-utils.c
new file mode 100644
index 0000000..70c1464
--- /dev/null
+++ b/src/libtracker-miner/tracker-utils.c
@@ -0,0 +1,35 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "tracker-utils.h"
+
+gboolean
+tracker_accumulator_process_file (GSignalInvocationHint *hint,
+ GValue *return_accumulator,
+ const GValue *handler_return,
+ gpointer accumulator_data)
+{
+ gboolean process;
+
+ process = g_value_get_boolean (handler_return);
+ g_value_set_boolean (return_accumulator, process);
+
+ return (process == TRUE);
+}
diff --git a/src/libtracker-miner/tracker-utils.h b/src/libtracker-miner/tracker-utils.h
new file mode 100644
index 0000000..5947290
--- /dev/null
+++ b/src/libtracker-miner/tracker-utils.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_UTILS_H__
+#define __TRACKER_UTILS_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+gboolean tracker_accumulator_process_file (GSignalInvocationHint *hint,
+ GValue *return_accumulator,
+ const GValue *handler_return,
+ gpointer accumulator_data);
+
+G_END_DECLS
+
+#endif /* __TRACKER_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]