[tracker/miner-fs-refactor: 16/93] libtracker-miner: Add ::directory-added/removed signals to TrackerIndexingTree
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-refactor: 16/93] libtracker-miner: Add ::directory-added/removed signals to TrackerIndexingTree
- Date: Fri, 7 Oct 2011 09:45:11 +0000 (UTC)
commit 2247fdfa6cc343b81ca65fa58a9109a8e5c88727
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Sep 8 16:06:08 2011 +0200
libtracker-miner: Add ::directory-added/removed signals to TrackerIndexingTree
src/libtracker-miner/tracker-indexing-tree.c | 31 ++++++++++++++++++++++++++
src/libtracker-miner/tracker-indexing-tree.h | 5 ++++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index 98fc34a..630a409 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -54,6 +54,14 @@ struct _TrackerIndexingTreePrivate
GList *filter_patterns;
};
+enum {
+ DIRECTORY_ADDED,
+ DIRECTORY_REMOVED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
static NodeData *
node_data_new (GFile *file,
guint flags)
@@ -131,6 +139,25 @@ tracker_indexing_tree_class_init (TrackerIndexingTreeClass *klass)
object_class->finalize = tracker_indexing_tree_finalize;
+ signals[DIRECTORY_ADDED] =
+ g_signal_new ("directory-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerIndexingTreeClass,
+ directory_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_FILE);
+ signals[DIRECTORY_REMOVED] =
+ g_signal_new ("directory-removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerIndexingTreeClass,
+ directory_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_FILE);
+
g_type_class_add_private (object_class,
sizeof (TrackerIndexingTreePrivate));
}
@@ -308,6 +335,8 @@ tracker_indexing_tree_add (TrackerIndexingTree *tree,
/* Add the new node underneath the parent */
g_node_append (parent, node);
+ g_signal_emit (tree, signals[DIRECTORY_ADDED], 0, directory);
+
#ifdef PRINT_INDEXING_TREE
/* Print tree */
print_tree (priv->config_tree);
@@ -357,6 +386,8 @@ tracker_indexing_tree_remove (TrackerIndexingTree *tree,
g_node_children_foreach (node, G_TRAVERSE_ALL,
check_reparent_node, parent);
+ g_signal_emit (tree, signals[DIRECTORY_REMOVED], 0, directory);
+
node_data_free (node->data);
g_node_destroy (node);
}
diff --git a/src/libtracker-miner/tracker-indexing-tree.h b/src/libtracker-miner/tracker-indexing-tree.h
index b57b4e8..0623365 100644
--- a/src/libtracker-miner/tracker-indexing-tree.h
+++ b/src/libtracker-miner/tracker-indexing-tree.h
@@ -50,6 +50,11 @@ struct _TrackerIndexingTree
struct _TrackerIndexingTreeClass
{
GObjectClass parent_class;
+
+ void (* directory_added) (TrackerIndexingTree *indexing_tree,
+ GFile *directory);
+ void (* directory_removed) (TrackerIndexingTree *indexing_tree,
+ GFile *directory);
};
GType tracker_indexing_tree_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]