[tracker/miner-fs-refactor: 48/127] libtracker-miner: Add TrackerFileNotifier::directory-started/finished
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-refactor: 48/127] libtracker-miner: Add TrackerFileNotifier::directory-started/finished
- Date: Mon, 5 Dec 2011 13:23:38 +0000 (UTC)
commit 2dbd053d94079339ee33e1818462894a7f8210b0
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Sep 30 11:59:29 2011 +0200
libtracker-miner: Add TrackerFileNotifier::directory-started/finished
These 2 signals notify when does indexing of a config root directory, or
a recently added directory, happens.
src/libtracker-miner/tracker-file-notifier.c | 38 +++++++++++++++++++++++++-
src/libtracker-miner/tracker-file-notifier.h | 10 +++++++
src/libtracker-miner/tracker-marshal.list | 1 +
3 files changed, 48 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 5bc74ef..5d2f4a6 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -44,6 +44,8 @@ enum {
FILE_UPDATED,
FILE_DELETED,
FILE_MOVED,
+ DIRECTORY_STARTED,
+ DIRECTORY_FINISHED,
LAST_SIGNAL
};
@@ -309,9 +311,10 @@ crawler_directory_crawled_cb (TrackerCrawler *crawler,
guint files_ignored,
gpointer user_data)
{
+ TrackerFileNotifier *notifier;
DirectoryCrawledData data = { 0 };
- data.notifier = user_data;
+ notifier = data.notifier = user_data;
g_node_traverse (tree,
G_PRE_ORDER,
G_TRAVERSE_ALL,
@@ -319,6 +322,11 @@ crawler_directory_crawled_cb (TrackerCrawler *crawler,
file_notifier_add_node_foreach,
&data);
+ g_signal_emit (notifier, signals[DIRECTORY_FINISHED], 0,
+ directory,
+ directories_found, directories_ignored,
+ files_found, files_ignored);
+
g_message (" Found %d directories, ignored %d directories",
directories_found,
directories_ignored);
@@ -447,10 +455,17 @@ crawl_directories_start (TrackerFileNotifier *notifier)
sparql_query_cb,
notifier);
+ g_signal_emit (notifier, signals[DIRECTORY_STARTED], 0, directory);
+
g_free (sparql);
g_free (uri);
return TRUE;
+ } else {
+ /* Emit both signals for consistency */
+ g_signal_emit (notifier, signals[DIRECTORY_STARTED], 0, directory);
+ g_signal_emit (notifier, signals[DIRECTORY_FINISHED], 0,
+ directory, 0, 0, 0, 0);
}
/* Remove index root and try the next one */
@@ -944,6 +959,27 @@ tracker_file_notifier_class_init (TrackerFileNotifierClass *klass)
tracker_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE,
2, G_TYPE_FILE, G_TYPE_FILE);
+ signals[DIRECTORY_STARTED] =
+ g_signal_new ("directory-started",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerFileNotifierClass,
+ directory_started),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, G_TYPE_FILE);
+ signals[DIRECTORY_FINISHED] =
+ g_signal_new ("directory-finished",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerFileNotifierClass,
+ directory_finished),
+ NULL, NULL,
+ tracker_marshal_VOID__OBJECT_UINT_UINT_UINT_UINT,
+ G_TYPE_NONE,
+ 5, G_TYPE_FILE, G_TYPE_UINT,
+ G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
g_object_class_install_property (object_class,
PROP_INDEXING_TREE,
diff --git a/src/libtracker-miner/tracker-file-notifier.h b/src/libtracker-miner/tracker-file-notifier.h
index 674c81a..e2145d5 100644
--- a/src/libtracker-miner/tracker-file-notifier.h
+++ b/src/libtracker-miner/tracker-file-notifier.h
@@ -59,6 +59,16 @@ struct _TrackerFileNotifierClass {
void (* file_moved) (TrackerFileNotifier *notifier,
GFile *from,
GFile *to);
+
+ /* Directory notifications */
+ void (* directory_started) (TrackerFileNotifier *notifier,
+ GFile *directory);
+ void (* directory_finished) (TrackerFileNotifier *notifier,
+ GFile *directory,
+ guint directories_found,
+ guint directories_ignored,
+ guint files_found,
+ guint files_ignored);
};
GType tracker_file_notifier_get_type (void) G_GNUC_CONST;
diff --git a/src/libtracker-miner/tracker-marshal.list b/src/libtracker-miner/tracker-marshal.list
index 785edc5..5c311fb 100644
--- a/src/libtracker-miner/tracker-marshal.list
+++ b/src/libtracker-miner/tracker-marshal.list
@@ -2,6 +2,7 @@ VOID:OBJECT,BOOLEAN
VOID:OBJECT,OBJECT
VOID:OBJECT,OBJECT,BOOLEAN,BOOLEAN
VOID:OBJECT,POINTER,UINT,UINT,UINT,UINT
+VOID:OBJECT,UINT,UINT,UINT,UINT
VOID:DOUBLE,UINT,UINT,UINT,UINT
VOID:STRING,DOUBLE,INT
VOID:STRING,STRING
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]