[tracker/libtracker-miner] Removed module_name from everywhere
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-miner] Removed module_name from everywhere
- Date: Tue, 4 Aug 2009 14:59:02 +0000 (UTC)
commit 044b95e2de66218fcb7b4ef01a320905fa560b6f
Author: Martyn Russell <martyn imendio com>
Date: Mon Aug 3 12:00:42 2009 +0100
Removed module_name from everywhere
src/libtracker-miner/tracker-crawler.c | 32 +--
src/libtracker-miner/tracker-crawler.h | 3 +-
src/libtracker-miner/tracker-monitor.c | 325 +++---------------
src/libtracker-miner/tracker-monitor.h | 7 +-
src/libtracker-miner/tracker-processor.c | 538 +++++++-----------------------
src/tracker-miner-fs/tracker-indexer.c | 5 -
6 files changed, 196 insertions(+), 714 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index 1cc1be3..e64abef 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -55,8 +55,6 @@
struct _TrackerCrawlerPrivate {
TrackerConfig *config;
- gchar *module_name;
-
/* Found data */
GQueue *directories;
GQueue *files;
@@ -258,37 +256,31 @@ tracker_crawler_finalize (GObject *object)
g_queue_foreach (priv->directories, (GFunc) g_object_unref, NULL);
g_queue_free (priv->directories);
- g_free (priv->module_name);
-
g_object_unref (priv->config);
G_OBJECT_CLASS (tracker_crawler_parent_class)->finalize (object);
}
TrackerCrawler *
-tracker_crawler_new (TrackerConfig *config,
- const gchar *module_name)
+tracker_crawler_new (TrackerConfig *config)
{
TrackerCrawler *crawler;
g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
- g_return_val_if_fail (module_name != NULL, NULL);
crawler = g_object_new (TRACKER_TYPE_CRAWLER, NULL);
crawler->private->config = g_object_ref (config);
- crawler->private->module_name = g_strdup (module_name);
-
/* Set up crawl data */
crawler->private->ignored_directory_patterns =
- tracker_module_config_get_ignored_directory_patterns (module_name);
+ tracker_module_config_get_ignored_directory_patterns ("files");
crawler->private->ignored_file_patterns =
- tracker_module_config_get_ignored_file_patterns (module_name);
+ tracker_module_config_get_ignored_file_patterns ("files");
crawler->private->index_file_patterns =
- tracker_module_config_get_index_file_patterns (module_name);
+ tracker_module_config_get_index_file_patterns ("files");
crawler->private->ignored_directories_with_content =
- tracker_module_config_get_ignored_directories_with_content (module_name);
+ tracker_module_config_get_ignored_directories_with_content ("files");
/* Should we use module config paths? If true, when we
* _start() the module config paths are used to import paths
@@ -472,8 +464,7 @@ static void
process_file (TrackerCrawler *crawler,
GFile *file)
{
- g_signal_emit (crawler, signals[PROCESSING_FILE], 0,
- crawler->private->module_name, file);
+ g_signal_emit (crawler, signals[PROCESSING_FILE], 0, file);
}
static void
@@ -696,8 +687,7 @@ enumerator_data_process (EnumeratorData *ed)
}
crawler->private->directories_found++;
- g_signal_emit (crawler, signals[PROCESSING_DIRECTORY], 0,
- crawler->private->module_name, ed->parent);
+ g_signal_emit (crawler, signals[PROCESSING_DIRECTORY], 0, ed->parent);
g_hash_table_iter_init (&iter, ed->children);
@@ -969,8 +959,7 @@ tracker_crawler_start (TrackerCrawler *crawler)
priv->was_started = TRUE;
- g_message ("Crawling directories for module:'%s'",
- crawler->private->module_name);
+ g_message ("Crawling directories...");
if (priv->use_module_paths) {
GSList *new_paths;
@@ -979,8 +968,8 @@ tracker_crawler_start (TrackerCrawler *crawler)
g_message (" Using module paths");
- recurse_paths = tracker_module_config_get_monitor_recurse_directories (priv->module_name);
- paths = tracker_module_config_get_monitor_directories (priv->module_name);
+ recurse_paths = tracker_module_config_get_monitor_recurse_directories ("files");
+ paths = tracker_module_config_get_monitor_directories ("files");
if (recurse_paths || paths) {
/* First we do non-recursive directories */
@@ -1111,7 +1100,6 @@ tracker_crawler_stop (TrackerCrawler *crawler)
}
g_signal_emit (crawler, signals[FINISHED], 0,
- priv->module_name,
priv->directories_found,
priv->directories_ignored,
priv->files_found,
diff --git a/src/libtracker-miner/tracker-crawler.h b/src/libtracker-miner/tracker-crawler.h
index 8d6a8d8..f2844c0 100644
--- a/src/libtracker-miner/tracker-crawler.h
+++ b/src/libtracker-miner/tracker-crawler.h
@@ -48,8 +48,7 @@ struct _TrackerCrawlerClass {
};
GType tracker_crawler_get_type (void);
-TrackerCrawler *tracker_crawler_new (TrackerConfig *config,
- const gchar *module_name);
+TrackerCrawler *tracker_crawler_new (TrackerConfig *config);
gboolean tracker_crawler_start (TrackerCrawler *crawler);
void tracker_crawler_stop (TrackerCrawler *crawler);
gboolean tracker_crawler_is_path_ignored (TrackerCrawler *crawler,
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index c56dd64..a20a410 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -54,8 +54,8 @@
struct _TrackerMonitorPrivate {
TrackerConfig *config;
- GHashTable *modules;
-
+ GHashTable *monitors;
+
gboolean enabled;
GType monitor_backend;
@@ -202,7 +202,6 @@ tracker_monitor_init (TrackerMonitor *object)
TrackerMonitorPrivate *priv;
GFile *file;
GFileMonitor *monitor;
- GList *all_modules, *l;
const gchar *name;
object->private = TRACKER_MONITOR_GET_PRIVATE (object);
@@ -212,13 +211,6 @@ tracker_monitor_init (TrackerMonitor *object)
/* By default we enable monitoring */
priv->enabled = TRUE;
- /* For each module we create a hash table for monitors */
- priv->modules =
- g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- (GDestroyNotify) g_hash_table_unref);
-
/* We have a hash table with cookies so we can pair up move
* events.
*/
@@ -238,22 +230,12 @@ tracker_monitor_init (TrackerMonitor *object)
g_object_unref,
event_data_free);
- all_modules = tracker_module_config_get_modules ();
-
- for (l = all_modules; l; l = l->next) {
- GHashTable *monitors;
-
- /* Create monitors table for this module */
- monitors =
- g_hash_table_new_full (g_file_hash,
- (GEqualFunc) g_file_equal,
- (GDestroyNotify) g_object_unref,
- (GDestroyNotify) libinotify_monitor_cancel);
-
- g_hash_table_insert (priv->modules, g_strdup (l->data), monitors);
- }
-
- g_list_free (all_modules);
+ /* Create monitors table for this module */
+ priv->monitors =
+ g_hash_table_new_full (g_file_hash,
+ (GEqualFunc) g_file_equal,
+ (GDestroyNotify) g_object_unref,
+ (GDestroyNotify) libinotify_monitor_cancel);
/* For the first monitor we get the type and find out if we
* are using inotify, FAM, polling, etc.
@@ -361,8 +343,6 @@ tracker_monitor_finalize (GObject *object)
g_hash_table_unref (priv->cached_events);
g_hash_table_unref (priv->event_pairs);
- g_hash_table_unref (priv->modules);
-
g_object_unref (priv->config);
G_OBJECT_CLASS (tracker_monitor_parent_class)->finalize (object);
@@ -472,99 +452,6 @@ get_inotify_limit (void)
return limit;
}
-static const gchar *
-get_queue_from_gfile (GHashTable *modules,
- GFile *file)
-{
- GHashTableIter iter;
- gpointer key, value;
-
- g_hash_table_iter_init (&iter, modules);
-
- while (g_hash_table_iter_next (&iter, &key, &value)) {
- GHashTable *hash_table;
-
- hash_table = value;
-
- if (g_hash_table_lookup (hash_table, file)) {
- return key;
- }
- }
-
- return NULL;
-}
-
-static const gchar *
-get_module_name_from_gfile (TrackerMonitor *monitor,
- GFile *file,
- gboolean *is_directory)
-{
- const gchar *module_name;
-
- if (is_directory) {
- *is_directory = TRUE;
- }
-
- /* First try to get the module name from the file, this will
- * only work if the event we received is for a directory.
- */
- module_name = get_queue_from_gfile (monitor->private->modules, file);
- if (!module_name) {
- GFile *parent;
-
- /* Second we try to get the module name from the base
- * name of the file.
- */
- parent = g_file_get_parent (file);
-
- if (!parent) {
- gchar *path;
-
- path = g_file_get_path (file);
-
- g_debug ("Could not get module name from GFile (path:'%s')",
- path);
-
- g_free (path);
-
- return NULL;
- }
-
- module_name = get_queue_from_gfile (monitor->private->modules, parent);
-
- if (!module_name) {
- gchar *parent_path;
- gchar *child_path;
-
- parent_path = g_file_get_path (parent);
- child_path = g_file_get_path (file);
-
- if (is_directory) {
- *is_directory = g_file_test (child_path, G_FILE_TEST_IS_DIR);
- }
-
- g_debug ("Could not get module name from GFile (path:'%s' or parent:'%s')",
- child_path,
- parent_path);
-
- g_free (parent_path);
- g_free (child_path);
- } else {
- if (is_directory) {
- gchar *child_path;
-
- child_path = g_file_get_path (file);
- *is_directory = g_file_test (child_path, G_FILE_TEST_IS_DIR);
- g_free (child_path);
- }
- }
-
- g_object_unref (parent);
- }
-
- return module_name;
-}
-
#ifdef PAUSE_ON_IO
static gboolean
@@ -683,7 +570,6 @@ libinotify_event_pairs_timeout_cb (gpointer data)
EventData *event;
glong seconds;
glong seconds_then;
- const gchar *module_name;
gboolean is_directory;
event = value;
@@ -711,10 +597,6 @@ libinotify_event_pairs_timeout_cb (gpointer data)
GPOINTER_TO_UINT (key),
seconds);
- module_name = get_module_name_from_gfile (monitor,
- event->file,
- &is_directory);
-
switch (event->event_type) {
case IN_MOVED_FROM:
case IN_DELETE:
@@ -724,13 +606,11 @@ libinotify_event_pairs_timeout_cb (gpointer data)
*/
if (is_directory) {
tracker_monitor_remove (monitor,
- module_name,
event->file);
}
g_signal_emit (monitor,
signals[ITEM_DELETED], 0,
- module_name,
event->file,
is_directory);
break;
@@ -742,7 +622,6 @@ libinotify_event_pairs_timeout_cb (gpointer data)
*/
g_signal_emit (monitor,
signals[ITEM_CREATED], 0,
- module_name,
event->file,
is_directory);
break;
@@ -765,7 +644,6 @@ libinotify_event_pairs_timeout_cb (gpointer data)
static void
libinotify_cached_event_handle (TrackerMonitor *monitor,
EventData *data,
- const gchar *module_name,
gboolean is_directory)
{
switch (data->event_type) {
@@ -774,7 +652,6 @@ libinotify_cached_event_handle (TrackerMonitor *monitor,
case IN_ATTRIB:
g_signal_emit (monitor,
signals[ITEM_UPDATED], 0,
- module_name,
data->file,
is_directory);
break;
@@ -788,13 +665,11 @@ libinotify_cached_event_handle (TrackerMonitor *monitor,
case IN_DELETE_SELF:
if (is_directory) {
tracker_monitor_remove (monitor,
- module_name,
data->file);
}
g_signal_emit (monitor,
signals[ITEM_DELETED], 0,
- module_name,
data->file,
is_directory);
@@ -808,7 +683,6 @@ libinotify_cached_event_handle (TrackerMonitor *monitor,
case IN_CREATE:
g_signal_emit (monitor,
signals[ITEM_CREATED], 0,
- module_name,
data->file,
is_directory);
@@ -839,7 +713,6 @@ libinotify_cached_events_timeout_cb (gpointer data)
glong start_event_seconds;
gint cache_timeout;
gint scan_timeout;
- const gchar *module_name;
gboolean is_directory;
gboolean force_emit = FALSE;
gboolean timed_out = FALSE;
@@ -856,26 +729,14 @@ libinotify_cached_events_timeout_cb (gpointer data)
last_event_seconds,
start_event_seconds);
- module_name = get_module_name_from_gfile (monitor,
- event->file,
- &is_directory);
-
- if (!module_name) {
- /* File was deleted before we could check its
- * cached events, just discard it
- */
- g_hash_table_iter_remove (&iter);
- continue;
- }
-
/* If the item has been in the cache for too long
* according to the module config options, then we
* force the cache to expire in order to not starve
* the indexer of events for files which are ALWAYS
* changing.
*/
- cache_timeout = tracker_module_config_get_cache_timeout (module_name);
- scan_timeout = tracker_module_config_get_scan_timeout (module_name);
+ cache_timeout = tracker_module_config_get_cache_timeout ("files");
+ scan_timeout = tracker_module_config_get_scan_timeout ("files");
if (cache_timeout > 0) {
force_emit = start_event_seconds > cache_timeout;
@@ -910,7 +771,6 @@ libinotify_cached_events_timeout_cb (gpointer data)
/* Signal event */
libinotify_cached_event_handle (monitor,
event,
- module_name,
is_directory);
@@ -955,7 +815,6 @@ static void
libinotify_monitor_force_emission (TrackerMonitor *monitor,
GFile *file,
guint32 event_type,
- const gchar *module_name,
gboolean is_directory)
{
EventData *data;
@@ -974,7 +833,6 @@ libinotify_monitor_force_emission (TrackerMonitor *monitor,
/* Signal event */
libinotify_cached_event_handle (monitor,
data,
- module_name,
is_directory);
/* Clean up */
@@ -993,7 +851,6 @@ libinotify_monitor_event_cb (INotifyHandle *handle,
TrackerMonitor *monitor;
GFile *file;
GFile *other_file;
- const gchar *module_name;
gchar *str1;
gchar *str2;
gboolean is_directory;
@@ -1031,13 +888,6 @@ libinotify_monitor_event_cb (INotifyHandle *handle,
}
other_file = NULL;
- module_name = get_module_name_from_gfile (monitor, file, &is_directory);
-
- if (!module_name) {
- g_free (str1);
- g_object_unref (file);
- return;
- }
if (!str1) {
str1 = g_file_get_path (file);
@@ -1141,7 +991,6 @@ libinotify_monitor_event_cb (INotifyHandle *handle,
libinotify_monitor_force_emission (monitor,
file,
event_type,
- module_name,
is_directory);
/* Fall through */
@@ -1172,9 +1021,7 @@ libinotify_monitor_event_cb (INotifyHandle *handle,
if (is_directory) {
gint count;
- tracker_monitor_remove (monitor,
- module_name,
- file);
+ tracker_monitor_remove (monitor, file);
count = g_hash_table_foreach_remove (monitor->private->cached_events,
libinotify_cached_event_delete_children_func,
@@ -1201,7 +1048,6 @@ libinotify_monitor_event_cb (INotifyHandle *handle,
} else if (other_file) {
g_signal_emit (monitor,
signals[ITEM_MOVED], 0,
- module_name,
file,
other_file,
is_directory,
@@ -1232,14 +1078,12 @@ libinotify_monitor_event_cb (INotifyHandle *handle,
* handle that cache first. Otherwise we have
* disparity when the cache expires.
*/
- libinotify_monitor_force_emission (monitor, file, event_type,
- module_name, is_directory);
+ libinotify_monitor_force_emission (monitor, file, event_type, is_directory);
/* Handle event */
if (cookie == 0) {
g_signal_emit (monitor,
signals[ITEM_CREATED], 0,
- module_name,
file,
is_directory);
} else if (other_file) {
@@ -1264,7 +1108,6 @@ libinotify_monitor_event_cb (INotifyHandle *handle,
g_signal_emit (monitor,
signals[ITEM_MOVED], 0,
- module_name,
other_file,
file,
is_directory,
@@ -1375,36 +1218,31 @@ tracker_monitor_set_enabled (TrackerMonitor *monitor,
gboolean
tracker_monitor_add (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file)
{
INotifyHandle *file_monitor;
- GHashTable *monitors;
GSList *ignored_roots;
GSList *l;
gchar *path;
g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
- g_return_val_if_fail (module_name != NULL, FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
if (!tracker_config_get_enable_watches (monitor->private->config)) {
return TRUE;
}
- monitors = g_hash_table_lookup (monitor->private->modules, module_name);
- if (!monitors) {
- g_warning ("No monitor hash table for module:'%s'",
- module_name);
+ if (!monitor->private->monitors) {
+ g_critical ("Could not add monitor, no monitors are set up");
return FALSE;
}
- if (g_hash_table_lookup (monitors, file)) {
+ if (g_hash_table_lookup (monitor->private->monitors, file)) {
return TRUE;
}
/* Cap the number of monitors */
- if (g_hash_table_size (monitors) >= monitor->private->monitor_limit) {
+ if (g_hash_table_size (monitor->private->monitors) >= monitor->private->monitor_limit) {
monitor->private->monitors_ignored++;
if (!monitor->private->monitor_limit_warned) {
@@ -1445,14 +1283,13 @@ tracker_monitor_add (TrackerMonitor *monitor,
return FALSE;
}
- g_hash_table_insert (monitors,
+ g_hash_table_insert (monitor->private->monitors,
g_object_ref (file),
file_monitor);
- g_debug ("Added monitor for module:'%s', path:'%s', total monitors:%d",
- module_name,
+ g_debug ("Added monitor for path:'%s', total monitors:%d",
path,
- g_hash_table_size (monitors));
+ g_hash_table_size (monitor->private->monitors));
g_free (path);
@@ -1461,7 +1298,6 @@ tracker_monitor_add (TrackerMonitor *monitor,
gboolean
tracker_monitor_remove (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file)
{
GHashTable *monitors;
@@ -1469,73 +1305,59 @@ tracker_monitor_remove (TrackerMonitor *monitor,
gboolean removed;
g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
- g_return_val_if_fail (module_name != NULL, FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
-
- monitors = g_hash_table_lookup (monitor->private->modules, module_name);
- if (!monitors) {
- g_warning ("No monitor hash table for module:'%s'",
- module_name);
+
+ if (!monitor->private->monitors) {
+ g_critical ("Could not remove monitor, no monitors are set up");
return FALSE;
}
-
+
removed = g_hash_table_remove (monitors, file);
path = g_file_get_path (file);
- g_debug ("Removed monitor for module:'%s', path:'%s', total monitors:%d",
- module_name,
+ g_debug ("Removed monitor for path:'%s', total monitors:%d",
path,
g_hash_table_size (monitors));
g_free (path);
- /* tracker_monitor_remove_recursively (monitor, event->file); */
-
return removed;
}
-
gboolean
tracker_monitor_remove_recursively (TrackerMonitor *monitor,
GFile *file)
{
- GHashTableIter iter1;
- gpointer iter_module_name, iter_hash_table;
+ GHashTableIter iter;
+ gpointer iter_hash_table, iter_file, iter_file_monitor;
guint items_removed = 0;
g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
- g_hash_table_iter_init (&iter1, monitor->private->modules);
- while (g_hash_table_iter_next (&iter1, &iter_module_name, &iter_hash_table)) {
- GHashTableIter iter2;
- gpointer iter_file, iter_file_monitor;
-
- g_hash_table_iter_init (&iter2, iter_hash_table);
- while (g_hash_table_iter_next (&iter2, &iter_file, &iter_file_monitor)) {
- gchar *path;
-
- if (!g_file_has_prefix (iter_file, file) &&
- !g_file_equal (iter_file, file)) {
- continue;
- }
-
- path = g_file_get_path (iter_file);
-
- g_debug ("Removed monitor for module:'%s', path:'%s', total monitors:%d",
- (gchar*) iter_module_name,
- path,
- g_hash_table_size (iter_hash_table));
-
- g_free (path);
-
- g_hash_table_iter_remove (&iter2);
+ g_hash_table_iter_init (&iter, monitor->private->monitors);
+ while (g_hash_table_iter_next (&iter, &iter_file, &iter_file_monitor)) {
+ gchar *path;
- /* We reset this because now it is possible we have limit - 1 */
- monitor->private->monitor_limit_warned = FALSE;
-
- items_removed++;
+ if (!g_file_has_prefix (iter_file, file) &&
+ !g_file_equal (iter_file, file)) {
+ continue;
}
+
+ path = g_file_get_path (iter_file);
+
+ g_debug ("Removed monitor for path:'%s', total monitors:%d",
+ path,
+ g_hash_table_size (iter_hash_table));
+
+ g_free (path);
+
+ g_hash_table_iter_remove (&iter);
+
+ /* We reset this because now it is possible we have limit - 1 */
+ monitor->private->monitor_limit_warned = FALSE;
+
+ items_removed++;
}
return items_removed > 0;
@@ -1543,84 +1365,47 @@ tracker_monitor_remove_recursively (TrackerMonitor *monitor,
gboolean
tracker_monitor_is_watched (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file)
{
- GHashTable *monitors;
-
g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
- g_return_val_if_fail (module_name != NULL, FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
- monitors = g_hash_table_lookup (monitor->private->modules, module_name);
- if (!monitors) {
- g_warning ("No monitor hash table for module:'%s'",
- module_name);
+ if (!monitor->private->monitors) {
+ g_critical ("Could not find out if GFile is watched, no monitors are set up");
return FALSE;
}
- return g_hash_table_lookup (monitors, file) != NULL;
+ return g_hash_table_lookup (monitor->private->monitors, file) != NULL;
}
gboolean
tracker_monitor_is_watched_by_string (TrackerMonitor *monitor,
- const gchar *module_name,
const gchar *path)
{
GFile *file;
- GHashTable *monitors;
gboolean watched;
g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
- g_return_val_if_fail (module_name != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
- monitors = g_hash_table_lookup (monitor->private->modules, module_name);
- if (!monitors) {
- g_warning ("No monitor hash table for module:'%s'",
- module_name);
+ if (!monitor->private->monitors) {
+ g_critical ("Could not find out if path is monitored, no monitors are set up");
return FALSE;
}
file = g_file_new_for_path (path);
- watched = g_hash_table_lookup (monitors, file) != NULL;
+ watched = g_hash_table_lookup (monitor->private->monitors, file) != NULL;
g_object_unref (file);
return watched;
}
guint
-tracker_monitor_get_count (TrackerMonitor *monitor,
- const gchar *module_name)
+tracker_monitor_get_count (TrackerMonitor *monitor)
{
- guint count;
-
g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), 0);
- if (module_name) {
- GHashTable *monitors;
-
- monitors = g_hash_table_lookup (monitor->private->modules, module_name);
- if (!monitors) {
- g_warning ("No monitor hash table for module:'%s'",
- module_name);
- return 0;
- }
-
- count = g_hash_table_size (monitors);
- } else {
- GList *all_modules, *l;
-
- all_modules = g_hash_table_get_values (monitor->private->modules);
-
- for (l = all_modules, count = 0; l; l = l->next) {
- count += g_hash_table_size (l->data);
- }
-
- g_list_free (all_modules);
- }
-
- return count;
+ return g_hash_table_size (monitor->private->monitors);
}
guint
diff --git a/src/libtracker-miner/tracker-monitor.h b/src/libtracker-miner/tracker-monitor.h
index c456988..135389f 100644
--- a/src/libtracker-miner/tracker-monitor.h
+++ b/src/libtracker-miner/tracker-monitor.h
@@ -55,21 +55,16 @@ gboolean tracker_monitor_get_enabled (TrackerMonitor *monitor);
void tracker_monitor_set_enabled (TrackerMonitor *monitor,
gboolean enabled);
gboolean tracker_monitor_add (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file);
gboolean tracker_monitor_remove (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file);
gboolean tracker_monitor_remove_recursively (TrackerMonitor *monitor,
GFile *file);
gboolean tracker_monitor_is_watched (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file);
gboolean tracker_monitor_is_watched_by_string (TrackerMonitor *monitor,
- const gchar *module_name,
const gchar *path);
-guint tracker_monitor_get_count (TrackerMonitor *monitor,
- const gchar *module_name);
+guint tracker_monitor_get_count (TrackerMonitor *monitor);
guint tracker_monitor_get_ignored (TrackerMonitor *monitor);
G_END_DECLS
diff --git a/src/libtracker-miner/tracker-processor.c b/src/libtracker-miner/tracker-processor.c
index 663d14b..14466bb 100644
--- a/src/libtracker-miner/tracker-processor.c
+++ b/src/libtracker-miner/tracker-processor.c
@@ -52,24 +52,20 @@ struct TrackerProcessorPrivate {
TrackerMonitor *monitor;
/* Crawlers */
- GHashTable *crawlers;
+ TrackerCrawler *crawler;
/* File queues for indexer */
guint item_queues_handler_id;
- GHashTable *items_created_queues;
- GHashTable *items_updated_queues;
- GHashTable *items_deleted_queues;
- GHashTable *items_moved_queues;
+ GQueue *items_created_queue;
+ GQueue *items_updated_queue;
+ GQueue *items_deleted_queue;
+ GQueue *items_moved_queue;
SentType sent_type;
GStrv sent_items;
- const gchar *sent_module_name;
/* Status */
- GList *modules;
- GList *current_module;
-
GList *devices;
GList *current_device;
@@ -78,7 +74,7 @@ struct TrackerProcessorPrivate {
gboolean been_started;
gboolean interrupted;
- gboolean finished_modules;
+ gboolean finished_files;
gboolean finished_devices;
gboolean finished_sending;
gboolean finished_indexer;
@@ -101,10 +97,6 @@ enum {
};
static void tracker_processor_finalize (GObject *object);
-static void crawler_destroy_notify (gpointer data);
-static void item_queue_destroy_notify (gpointer data);
-static void process_module_next (TrackerProcessor *processor);
-static void process_modules_stop (TrackerProcessor *processor);
static void process_device_next (TrackerProcessor *processor);
static void process_devices_stop (TrackerProcessor *processor);
static void process_check_completely_finished (TrackerProcessor *processor);
@@ -120,37 +112,30 @@ static void indexer_finished_cb (TrackerIndexer *indexer,
gpointer user_data);
#endif
static void monitor_item_created_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
gboolean is_directory,
gpointer user_data);
static void monitor_item_updated_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
gboolean is_directory,
gpointer user_data);
static void monitor_item_deleted_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
gboolean is_directory,
gpointer user_data);
static void monitor_item_moved_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
GFile *other_file,
gboolean is_directory,
gboolean is_source_monitored,
gpointer user_data);
static void crawler_processing_file_cb (TrackerCrawler *crawler,
- const gchar *module_name,
GFile *file,
gpointer user_data);
static void crawler_processing_directory_cb (TrackerCrawler *crawler,
- const gchar *module_name,
GFile *file,
gpointer user_data);
static void crawler_finished_cb (TrackerCrawler *crawler,
- const gchar *module_name,
guint directories_found,
guint directories_ignored,
guint files_found,
@@ -194,64 +179,19 @@ static void
tracker_processor_init (TrackerProcessor *object)
{
TrackerProcessorPrivate *priv;
- GList *l;
object->private = TRACKER_PROCESSOR_GET_PRIVATE (object);
priv = object->private;
- priv->modules = tracker_module_config_get_modules ();
-
/* For each module we create a TrackerCrawler and keep them in
* a hash table to look up.
*/
- priv->crawlers =
- g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- crawler_destroy_notify);
-
- /* For each module we create a hash table for queues for items
- * to update/create/delete in the indexer. This is sent on
- * when the queue is processed.
- */
- priv->items_created_queues =
- g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- item_queue_destroy_notify);
- priv->items_updated_queues =
- g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- item_queue_destroy_notify);
- priv->items_deleted_queues =
- g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- item_queue_destroy_notify);
- priv->items_moved_queues =
- g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- item_queue_destroy_notify);
-
- for (l = priv->modules; l; l = l->next) {
- /* Create queues for this module */
- g_hash_table_insert (priv->items_created_queues,
- g_strdup (l->data),
- g_queue_new ());
- g_hash_table_insert (priv->items_updated_queues,
- g_strdup (l->data),
- g_queue_new ());
- g_hash_table_insert (priv->items_deleted_queues,
- g_strdup (l->data),
- g_queue_new ());
- g_hash_table_insert (priv->items_moved_queues,
- g_strdup (l->data),
- g_queue_new ());
- }
+ priv->items_created_queue = g_queue_new ();
+ priv->items_updated_queue = g_queue_new ();
+ priv->items_deleted_queue = g_queue_new ();
+ priv->items_moved_queue = g_queue_new ();
}
static void
@@ -270,27 +210,45 @@ tracker_processor_finalize (GObject *object)
priv->item_queues_handler_id = 0;
}
- if (priv->items_moved_queues) {
- g_hash_table_unref (priv->items_moved_queues);
- }
+ g_queue_foreach (priv->items_moved_queue, (GFunc) g_object_unref, NULL);
+ g_queue_free (priv->items_moved_queue);
- if (priv->items_deleted_queues) {
- g_hash_table_unref (priv->items_deleted_queues);
- }
+ g_queue_foreach (priv->items_deleted_queue, (GFunc) g_object_unref, NULL);
+ g_queue_free (priv->items_deleted_queue);
- if (priv->items_updated_queues) {
- g_hash_table_unref (priv->items_updated_queues);
- }
+ g_queue_foreach (priv->items_updated_queue, (GFunc) g_object_unref, NULL);
+ g_queue_free (priv->items_updated_queue);
- if (priv->items_created_queues) {
- g_hash_table_unref (priv->items_created_queues);
- }
+ g_queue_foreach (priv->items_created_queue, (GFunc) g_object_unref, NULL);
+ g_queue_free (priv->items_created_queue);
- if (priv->crawlers) {
- g_hash_table_unref (priv->crawlers);
- }
+ if (priv->crawler) {
+ guint lsignals;
- g_list_free (priv->modules);
+ lsignals = g_signal_handlers_disconnect_matched (priv->crawler,
+ G_SIGNAL_MATCH_FUNC,
+ 0,
+ 0,
+ NULL,
+ G_CALLBACK (crawler_processing_file_cb),
+ NULL);
+ lsignals = g_signal_handlers_disconnect_matched (priv->crawler,
+ G_SIGNAL_MATCH_FUNC,
+ 0,
+ 0,
+ NULL,
+ G_CALLBACK (crawler_processing_directory_cb),
+ NULL);
+ lsignals = g_signal_handlers_disconnect_matched (priv->crawler,
+ G_SIGNAL_MATCH_FUNC,
+ 0,
+ 0,
+ NULL,
+ G_CALLBACK (crawler_finished_cb),
+ NULL);
+
+ g_object_unref (priv->crawler);
+ }
#if 0
g_signal_handlers_disconnect_by_func (priv->indexer,
@@ -435,80 +393,6 @@ path_should_be_ignored_for_media (TrackerProcessor *processor,
return ignore;
}
-static GQueue *
-get_next_queue_with_data (GList *modules,
- GHashTable *hash_table,
- gchar **module_name)
-{
- GQueue *found_queue;
- GQueue *queue;
- GList *l;
-
- if (module_name) {
- *module_name = NULL;
- }
-
- for (l = modules, found_queue = NULL; l && !found_queue; l = l->next) {
- queue = g_hash_table_lookup (hash_table, l->data);
-
- if (g_queue_get_length (queue) > 0) {
- if (module_name) {
- *module_name = l->data;
- found_queue = queue;
- }
- }
- }
-
- return found_queue;
-}
-
-static void
-crawler_destroy_notify (gpointer data)
-{
- TrackerCrawler *crawler;
-
- crawler = TRACKER_CRAWLER (data);
-
- if (crawler) {
- guint lsignals;
-
- lsignals = g_signal_handlers_disconnect_matched (crawler,
- G_SIGNAL_MATCH_FUNC,
- 0,
- 0,
- NULL,
- G_CALLBACK (crawler_processing_file_cb),
- NULL);
- lsignals = g_signal_handlers_disconnect_matched (crawler,
- G_SIGNAL_MATCH_FUNC,
- 0,
- 0,
- NULL,
- G_CALLBACK (crawler_processing_directory_cb),
- NULL);
- lsignals = g_signal_handlers_disconnect_matched (crawler,
- G_SIGNAL_MATCH_FUNC,
- 0,
- 0,
- NULL,
- G_CALLBACK (crawler_finished_cb),
- NULL);
-
- g_object_unref (crawler);
- }
-}
-
-static void
-item_queue_destroy_notify (gpointer data)
-{
- GQueue *queue;
-
- queue = (GQueue *) data;
-
- g_queue_foreach (queue, (GFunc) g_object_unref, NULL);
- g_queue_free (queue);
-}
-
static void
item_queue_processed_cb (TrackerProcessor *processor)
{
@@ -516,7 +400,6 @@ item_queue_processed_cb (TrackerProcessor *processor)
/* Reset for next batch to be sent */
processor->private->sent_items = NULL;
- processor->private->sent_module_name = NULL;
processor->private->sent_type = SENT_TYPE_NONE;
}
@@ -527,7 +410,6 @@ item_queue_handlers_cb (gpointer user_data)
TrackerStatus status;
GQueue *queue;
GStrv files;
- gchar *module_name;
gboolean should_repeat = FALSE;
GTimeVal time_now;
static GTimeVal time_last = { 0, 0 };
@@ -579,37 +461,26 @@ item_queue_handlers_cb (gpointer user_data)
}
/* Process the deleted items first */
- queue = get_next_queue_with_data (processor->private->modules,
- processor->private->items_deleted_queues,
- &module_name);
+ queue = processor->private->items_deleted_queue;
if (queue) {
files = tracker_dbus_queue_gfile_to_strv (queue, -1);
- g_message ("Queue for module:'%s' deleted items processed, sending %d to the indexer",
- module_name,
+ g_message ("Queue for deleted items processed, sending %d to the indexer",
g_strv_length (files));
processor->private->finished_indexer = FALSE;
processor->private->sent_type = SENT_TYPE_DELETED;
- processor->private->sent_module_name = module_name;
processor->private->sent_items = files;
-#if 0
- tracker_indexer_files_check (processor->private->indexer,
- module_name,
- files);
-#endif
item_queue_processed_cb (processor);
return TRUE;
}
/* Process the created items next */
- queue = get_next_queue_with_data (processor->private->modules,
- processor->private->items_created_queues,
- &module_name);
+ queue = processor->private->items_created_queue;
if (queue) {
/* Now we try to send items to the indexer */
@@ -617,30 +488,21 @@ item_queue_handlers_cb (gpointer user_data)
files = tracker_dbus_queue_gfile_to_strv (queue, -1);
- g_message ("Queue for module:'%s' created items processed, sending %d to the indexer",
- module_name,
+ g_message ("Queue for created items processed, sending %d to the indexer",
g_strv_length (files));
processor->private->finished_indexer = FALSE;
processor->private->sent_type = SENT_TYPE_CREATED;
- processor->private->sent_module_name = module_name;
processor->private->sent_items = files;
-#if 0
- tracker_indexer_files_check (processor->private->indexer,
- module_name,
- files);
-#endif
item_queue_processed_cb (processor);
return TRUE;
}
/* Process the updated items next */
- queue = get_next_queue_with_data (processor->private->modules,
- processor->private->items_updated_queues,
- &module_name);
+ queue = processor->private->items_updated_queue;
if (queue) {
/* Now we try to send items to the indexer */
@@ -648,30 +510,21 @@ item_queue_handlers_cb (gpointer user_data)
files = tracker_dbus_queue_gfile_to_strv (queue, -1);
- g_message ("Queue for module:'%s' updated items processed, sending %d to the indexer",
- module_name,
+ g_message ("Queue for updated items processed, sending %d to the indexer",
g_strv_length (files));
processor->private->finished_indexer = FALSE;
processor->private->sent_type = SENT_TYPE_UPDATED;
- processor->private->sent_module_name = module_name;
processor->private->sent_items = files;
-#if 0
- tracker_indexer_files_check (processor->private->indexer,
- module_name,
- files);
-#endif
item_queue_processed_cb (processor);
return TRUE;
}
/* Process the moved items last */
- queue = get_next_queue_with_data (processor->private->modules,
- processor->private->items_moved_queues,
- &module_name);
+ queue = processor->private->items_moved_queue;
if (queue) {
const gchar *source;
@@ -690,22 +543,14 @@ item_queue_handlers_cb (gpointer user_data)
target = NULL;
}
- g_message ("Queue for module:'%s' moved items processed, sending %d to the indexer",
- module_name,
+ g_message ("Queue for moved items processed, sending %d to the indexer",
g_strv_length (files));
processor->private->finished_indexer = FALSE;
processor->private->sent_type = SENT_TYPE_MOVED;
- processor->private->sent_module_name = module_name;
processor->private->sent_items = files;
-#if 0
- tracker_indexer_file_move (processor->private->indexer,
- module_name,
- source,
- target);
-#endif
item_queue_processed_cb (processor);
return TRUE;
@@ -753,7 +598,7 @@ is_path_on_ignore_list (GSList *ignore_list,
}
static void
-process_module_files_add_legacy_options (TrackerProcessor *processor)
+process_files_add_legacy_options (TrackerProcessor *processor)
{
TrackerCrawler *crawler;
GSList *no_watch_roots;
@@ -762,12 +607,9 @@ process_module_files_add_legacy_options (TrackerProcessor *processor)
GSList *l;
guint watch_root_count;
guint crawl_root_count;
- const gchar *module_name = "files";
-
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
- tracker_crawler_use_module_paths (crawler, TRUE);
- tracker_crawler_special_paths_clear (crawler);
+ tracker_crawler_use_module_paths (processor->private->crawler, TRUE);
+ tracker_crawler_special_paths_clear (processor->private->crawler);
no_watch_roots = tracker_config_get_no_watch_directory_roots (processor->private->config);
watch_roots = tracker_config_get_watch_directory_roots (processor->private->config);
@@ -802,7 +644,7 @@ process_module_files_add_legacy_options (TrackerProcessor *processor)
g_message (" %s", (gchar*) l->data);
file = g_file_new_for_path (l->data);
- tracker_monitor_add (processor->private->monitor, module_name, file);
+ tracker_monitor_add (processor->private->monitor, file);
g_object_unref (file);
watch_root_count++;
@@ -843,111 +685,23 @@ process_module_files_add_legacy_options (TrackerProcessor *processor)
}
}
-static gboolean
-process_module_is_disabled (TrackerProcessor *processor,
- const gchar *module_name)
-{
- GSList *disabled_modules;
-
- if (!tracker_module_config_get_enabled (module_name)) {
- g_message (" Module disabled by module config");
- return TRUE;
- }
-
- disabled_modules = tracker_config_get_disabled_modules (processor->private->config);
-
- if (g_slist_find_custom (disabled_modules, module_name, (GCompareFunc) g_strcmp0)) {
- g_message (" Module disabled by user");
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-process_module (TrackerProcessor *processor,
- const gchar *module_name)
-{
- TrackerCrawler *crawler;
-
- g_message ("Processing module:'%s'", module_name);
-
- if (process_module_is_disabled (processor, module_name)) {
- process_module_next (processor);
- return;
- }
-
- /* Here we set up legacy .cfg options like watch roots */
- tracker_status_set_and_signal (TRACKER_STATUS_WATCHING);
-
- if (strcmp (module_name, "files") == 0) {
- process_module_files_add_legacy_options (processor);
- }
-
- /* Gets all files and directories */
- tracker_status_set_and_signal (TRACKER_STATUS_PENDING);
-
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
-
- if (!tracker_crawler_start (crawler)) {
- process_module_next (processor);
- }
-}
-
-static void
-process_module_next (TrackerProcessor *processor)
-{
- if (tracker_status_get_is_readonly ()) {
- /* Block any request to process
- * modules if indexing is not enabled
- */
- return;
- }
-
- /* Don't recursively iterate the modules */
- if (!processor->private->current_module) {
- if (!processor->private->finished_modules) {
- processor->private->current_module = processor->private->modules;
- }
- } else {
- processor->private->current_module = processor->private->current_module->next;
- }
-
- /* If we have no further modules to iterate */
- if (!processor->private->current_module) {
- process_modules_stop (processor);
- process_next (processor);
- return;
- }
-
- process_module (processor, processor->private->current_module->data);
-}
-
static void
process_device (TrackerProcessor *processor,
const gchar *device_root)
{
TrackerCrawler *crawler;
GFile *file;
- const gchar *module_name = "files";
g_message ("Processing device with root:'%s'", device_root);
- if (process_module_is_disabled (processor, module_name)) {
- process_device_next (processor);
- return;
- }
-
/* Here we set up legacy .cfg options like watch roots */
tracker_status_set_and_signal (TRACKER_STATUS_WATCHING);
/* Gets all files and directories */
tracker_status_set_and_signal (TRACKER_STATUS_PENDING);
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
-
- tracker_crawler_use_module_paths (crawler, FALSE);
- tracker_crawler_special_paths_clear (crawler);
+ tracker_crawler_use_module_paths (processor->private->crawler, FALSE);
+ tracker_crawler_special_paths_clear (processor->private->crawler);
if (path_should_be_ignored_for_media (processor, device_root)) {
g_message (" Ignored due to config");
@@ -956,7 +710,7 @@ process_device (TrackerProcessor *processor,
}
file = g_file_new_for_path (device_root);
- tracker_monitor_add (processor->private->monitor, module_name, file);
+ tracker_monitor_add (processor->private->monitor, file);
g_object_unref (file);
tracker_crawler_special_paths_add (crawler, device_root);
@@ -971,7 +725,7 @@ process_device_next (TrackerProcessor *processor)
{
if (tracker_status_get_is_readonly ()) {
/* Block any request to process
- * modules if indexing is not enabled
+ * files if indexing is not enabled
*/
return;
}
@@ -1007,10 +761,9 @@ process_device_next (TrackerProcessor *processor)
}
static void
-process_modules_start (TrackerProcessor *processor)
+process_files_start (TrackerProcessor *processor)
{
- g_message ("Processor has started iterating %d modules",
- g_list_length (processor->private->modules));
+ g_message ("Processor has started iterating files");
if (processor->private->timer) {
g_timer_destroy (processor->private->timer);
@@ -1018,36 +771,42 @@ process_modules_start (TrackerProcessor *processor)
processor->private->timer = g_timer_new ();
- processor->private->finished_modules = FALSE;
+ processor->private->finished_files = FALSE;
processor->private->directories_found = 0;
processor->private->directories_ignored = 0;
processor->private->files_found = 0;
processor->private->files_ignored = 0;
- process_module_next (processor);
+ g_message ("Processing files");
+
+ /* Here we set up legacy .cfg options like watch roots */
+ tracker_status_set_and_signal (TRACKER_STATUS_WATCHING);
+
+ process_files_add_legacy_options (processor);
+
+ /* Gets all files and directories */
+ tracker_status_set_and_signal (TRACKER_STATUS_PENDING);
+
+ tracker_crawler_start (processor->private->crawler);
}
static void
-process_modules_stop (TrackerProcessor *processor)
+process_files_stop (TrackerProcessor *processor)
{
- if (processor->private->finished_modules) {
+ if (processor->private->finished_files) {
return;
}
g_message ("--------------------------------------------------");
- g_message ("Processor has %s iterating modules",
+ g_message ("Processor has %s iterating files",
processor->private->interrupted ? "been stopped while" : "finished");
- processor->private->finished_modules = TRUE;
+ processor->private->finished_files = TRUE;
if (processor->private->interrupted) {
- TrackerCrawler *crawler;
-
- crawler = g_hash_table_lookup (processor->private->crawlers,
- processor->private->current_module->data);
- if (crawler) {
- tracker_crawler_stop (crawler);
+ if (processor->private->crawler) {
+ tracker_crawler_stop (processor->private->crawler);
}
if (processor->private->timer) {
@@ -1064,12 +823,12 @@ process_modules_stop (TrackerProcessor *processor)
elapsed = 0;
}
- g_message ("Module time taken : %4.4f seconds",
+ g_message ("FS time taken : %4.4f seconds",
elapsed);
- g_message ("Module directories: %d (%d ignored)",
+ g_message ("FS directories: %d (%d ignored)",
processor->private->directories_found,
processor->private->directories_ignored);
- g_message ("Module files : %d (%d ignored)",
+ g_message ("FS files : %d (%d ignored)",
processor->private->files_found,
processor->private->files_ignored);
}
@@ -1113,11 +872,8 @@ process_devices_stop (TrackerProcessor *processor)
processor->private->finished_devices = TRUE;
if (processor->private->interrupted) {
- TrackerCrawler *crawler;
-
- crawler = g_hash_table_lookup (processor->private->crawlers, "files");
- if (crawler) {
- tracker_crawler_stop (crawler);
+ if (processor->private->crawler) {
+ tracker_crawler_stop (processor->private->crawler);
}
if (processor->private->timer) {
@@ -1150,8 +906,7 @@ process_devices_stop (TrackerProcessor *processor)
static void
process_continue (TrackerProcessor *processor)
{
- if (!processor->private->finished_modules) {
- process_module_next (processor);
+ if (!processor->private->finished_files) {
return;
}
@@ -1166,8 +921,8 @@ process_continue (TrackerProcessor *processor)
static void
process_next (TrackerProcessor *processor)
{
- if (!processor->private->finished_modules) {
- process_modules_start (processor);
+ if (!processor->private->finished_files) {
+ process_files_start (processor);
return;
}
@@ -1189,7 +944,7 @@ process_next (TrackerProcessor *processor)
processor->private->total_files_found,
processor->private->total_files_ignored);
g_message ("Total monitors : %d",
- tracker_monitor_get_count (processor->private->monitor, NULL));
+ tracker_monitor_get_count (processor->private->monitor));
g_message ("--------------------------------------------------\n");
}
@@ -1266,18 +1021,15 @@ indexer_finished_cb (TrackerIndexer *indexer,
static void
processor_files_check (TrackerProcessor *processor,
- const gchar *module_name,
GFile *file,
gboolean is_directory)
{
TrackerCrawler *crawler;
- GQueue *queue;
gboolean ignored;
gchar *path;
path = g_file_get_path (file);
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
- ignored = tracker_crawler_is_path_ignored (crawler, path, is_directory);
+ ignored = tracker_crawler_is_path_ignored (processor->private->crawler, path, is_directory);
g_debug ("%s:'%s' (%s) (create monitor event or user request)",
ignored ? "Ignored" : "Found ",
@@ -1289,9 +1041,9 @@ processor_files_check (TrackerProcessor *processor,
tracker_crawler_add_unexpected_path (crawler, path);
}
- queue = g_hash_table_lookup (processor->private->items_created_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (file));
-
+ g_queue_push_tail (processor->private->items_created_queue,
+ g_object_ref (file));
+
item_queue_handlers_set_up (processor);
}
@@ -1300,18 +1052,14 @@ processor_files_check (TrackerProcessor *processor,
static void
processor_files_update (TrackerProcessor *processor,
- const gchar *module_name,
GFile *file,
gboolean is_directory)
{
- TrackerCrawler *crawler;
- GQueue *queue;
gchar *path;
gboolean ignored;
path = g_file_get_path (file);
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
- ignored = tracker_crawler_is_path_ignored (crawler, path, is_directory);
+ ignored = tracker_crawler_is_path_ignored (processor->private->crawler, path, is_directory);
g_debug ("%s:'%s' (%s) (update monitor event or user request)",
ignored ? "Ignored" : "Found ",
@@ -1319,8 +1067,8 @@ processor_files_update (TrackerProcessor *processor,
is_directory ? "DIR" : "FILE");
if (!ignored) {
- queue = g_hash_table_lookup (processor->private->items_updated_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (file));
+ g_queue_push_tail (processor->private->items_updated_queue,
+ g_object_ref (file));
item_queue_handlers_set_up (processor);
}
@@ -1330,18 +1078,14 @@ processor_files_update (TrackerProcessor *processor,
static void
processor_files_delete (TrackerProcessor *processor,
- const gchar *module_name,
GFile *file,
gboolean is_directory)
{
- TrackerCrawler *crawler;
- GQueue *queue;
gchar *path;
gboolean ignored;
path = g_file_get_path (file);
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
- ignored = tracker_crawler_is_path_ignored (crawler, path, is_directory);
+ ignored = tracker_crawler_is_path_ignored (processor->private->crawler, path, is_directory);
g_debug ("%s:'%s' (%s) (delete monitor event or user request)",
ignored ? "Ignored" : "Found ",
@@ -1349,8 +1093,8 @@ processor_files_delete (TrackerProcessor *processor,
is_directory ? "DIR" : "FILE");
if (!ignored) {
- queue = g_hash_table_lookup (processor->private->items_deleted_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (file));
+ g_queue_push_tail (processor->private->items_deleted_queue,
+ g_object_ref (file));
item_queue_handlers_set_up (processor);
}
@@ -1360,13 +1104,11 @@ processor_files_delete (TrackerProcessor *processor,
static void
processor_files_move (TrackerProcessor *processor,
- const gchar *module_name,
GFile *file,
GFile *other_file,
gboolean is_directory)
{
TrackerCrawler *crawler;
- GQueue *queue;
gchar *path;
gchar *other_path;
gboolean path_ignored;
@@ -1374,10 +1116,9 @@ processor_files_move (TrackerProcessor *processor,
path = g_file_get_path (file);
other_path = g_file_get_path (other_file);
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
- path_ignored = tracker_crawler_is_path_ignored (crawler, path, is_directory);
- other_path_ignored = tracker_crawler_is_path_ignored (crawler, other_path, is_directory);
+ path_ignored = tracker_crawler_is_path_ignored (processor->private->crawler, path, is_directory);
+ other_path_ignored = tracker_crawler_is_path_ignored (processor->private->crawler, other_path, is_directory);
g_debug ("%s:'%s'->'%s':%s (%s) (move monitor event or user request)",
path_ignored ? "Ignored" : "Found ",
@@ -1391,8 +1132,8 @@ processor_files_move (TrackerProcessor *processor,
} else if (path_ignored) {
/* Check new file */
if (!is_directory) {
- queue = g_hash_table_lookup (processor->private->items_created_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (other_file));
+ g_queue_push_tail (processor->private->items_created_queue,
+ g_object_ref (other_file));
item_queue_handlers_set_up (processor);
}
@@ -1401,15 +1142,13 @@ processor_files_move (TrackerProcessor *processor,
tracker_crawler_add_unexpected_path (crawler, other_path);
} else if (other_path_ignored) {
/* Delete old file */
- queue = g_hash_table_lookup (processor->private->items_deleted_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (file));
+ g_queue_push_tail (processor->private->items_deleted_queue, g_object_ref (file));
item_queue_handlers_set_up (processor);
} else {
/* Move old file to new file */
- queue = g_hash_table_lookup (processor->private->items_moved_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (file));
- g_queue_push_tail (queue, g_object_ref (other_file));
+ g_queue_push_tail (processor->private->items_moved_queue, g_object_ref (file));
+ g_queue_push_tail (processor->private->items_moved_queue, g_object_ref (other_file));
item_queue_handlers_set_up (processor);
}
@@ -1420,37 +1159,33 @@ processor_files_move (TrackerProcessor *processor,
static void
monitor_item_created_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
gboolean is_directory,
gpointer user_data)
{
- processor_files_check (user_data, module_name, file, is_directory);
+ processor_files_check (user_data, file, is_directory);
}
static void
monitor_item_updated_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
gboolean is_directory,
gpointer user_data)
{
- processor_files_update (user_data, module_name, file, is_directory);
+ processor_files_update (user_data, file, is_directory);
}
static void
monitor_item_deleted_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
gboolean is_directory,
gpointer user_data)
{
- processor_files_delete (user_data, module_name, file, is_directory);
+ processor_files_delete (user_data, file, is_directory);
}
static void
monitor_item_moved_cb (TrackerMonitor *monitor,
- const gchar *module_name,
GFile *file,
GFile *other_file,
gboolean is_directory,
@@ -1459,47 +1194,41 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
{
if (!is_source_monitored) {
TrackerProcessor *processor;
- TrackerCrawler *crawler;
gchar *path;
processor = user_data;
/* If the source is not monitored, we need to crawl it. */
path = g_file_get_path (other_file);
- crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
- tracker_crawler_add_unexpected_path (crawler, path);
+ tracker_crawler_add_unexpected_path (processor->private->crawler, path);
g_free (path);
} else {
- processor_files_move (user_data, module_name, file, other_file, is_directory);
+ processor_files_move (user_data, file, other_file, is_directory);
}
}
static void
crawler_processing_file_cb (TrackerCrawler *crawler,
- const gchar *module_name,
GFile *file,
gpointer user_data)
{
TrackerProcessor *processor;
- GQueue *queue;
processor = user_data;
/* Add files in queue to our queues to send to the indexer */
- queue = g_hash_table_lookup (processor->private->items_created_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (file));
+ g_queue_push_tail (processor->private->items_created_queue,
+ g_object_ref (file));
item_queue_handlers_set_up (processor);
}
static void
crawler_processing_directory_cb (TrackerCrawler *crawler,
- const gchar *module_name,
GFile *file,
gpointer user_data)
{
TrackerProcessor *processor;
- GQueue *queue;
gboolean add_monitor;
processor = user_data;
@@ -1512,19 +1241,18 @@ crawler_processing_directory_cb (TrackerCrawler *crawler,
/* Should we add? */
if (add_monitor) {
- tracker_monitor_add (processor->private->monitor, module_name, file);
+ tracker_monitor_add (processor->private->monitor, file);
}
/* Add files in queue to our queues to send to the indexer */
- queue = g_hash_table_lookup (processor->private->items_created_queues, module_name);
- g_queue_push_tail (queue, g_object_ref (file));
+ g_queue_push_tail (processor->private->items_created_queue,
+ g_object_ref (file));
item_queue_handlers_set_up (processor);
}
static void
crawler_finished_cb (TrackerCrawler *crawler,
- const gchar *module_name,
guint directories_found,
guint directories_ignored,
guint files_found,
@@ -1651,8 +1379,6 @@ tracker_processor_new (TrackerConfig *config,
{
TrackerProcessor *processor;
TrackerProcessorPrivate *priv;
- TrackerCrawler *crawler;
- GList *l;
g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
@@ -1683,23 +1409,17 @@ tracker_processor_new (TrackerConfig *config,
#endif /* HAVE_HAL */
/* Set up the crawlers now we have config and hal */
- for (l = priv->modules; l; l = l->next) {
- crawler = tracker_crawler_new (priv->config, l->data);
-
- g_signal_connect (crawler, "processing-file",
- G_CALLBACK (crawler_processing_file_cb),
- processor);
- g_signal_connect (crawler, "processing-directory",
- G_CALLBACK (crawler_processing_directory_cb),
- processor);
- g_signal_connect (crawler, "finished",
- G_CALLBACK (crawler_finished_cb),
- processor);
-
- g_hash_table_insert (priv->crawlers,
- g_strdup (l->data),
- crawler);
- }
+ priv->crawler = tracker_crawler_new (priv->config);
+
+ g_signal_connect (priv->crawler, "processing-file",
+ G_CALLBACK (crawler_processing_file_cb),
+ processor);
+ g_signal_connect (priv->crawler, "processing-directory",
+ G_CALLBACK (crawler_processing_directory_cb),
+ processor);
+ g_signal_connect (priv->crawler, "finished",
+ G_CALLBACK (crawler_finished_cb),
+ processor);
/* Set up the monitor */
priv->monitor = tracker_monitor_new (config);
@@ -1745,7 +1465,7 @@ tracker_processor_start (TrackerProcessor *processor)
processor->private->interrupted = FALSE;
- processor->private->finished_modules = FALSE;
+ processor->private->finished_files = FALSE;
processor->private->finished_devices = FALSE;
processor->private->finished_sending = FALSE;
processor->private->finished_indexer = FALSE;
@@ -1764,7 +1484,7 @@ tracker_processor_stop (TrackerProcessor *processor)
processor->private->interrupted = TRUE;
- process_modules_stop (processor);
+ process_files_stop (processor);
process_devices_stop (processor);
/* Queues? */
diff --git a/src/tracker-miner-fs/tracker-indexer.c b/src/tracker-miner-fs/tracker-indexer.c
index 6906591..d689812 100644
--- a/src/tracker-miner-fs/tracker-indexer.c
+++ b/src/tracker-miner-fs/tracker-indexer.c
@@ -976,7 +976,6 @@ static void
indexer_load_modules (TrackerIndexer *indexer)
{
TrackerIndexerPrivate *priv;
- GSList *disabled_modules;
GList *modules, *l;
priv = indexer->private;
@@ -991,10 +990,6 @@ indexer_load_modules (TrackerIndexer *indexer)
continue;
}
- if (tracker_string_in_gslist (l->data, disabled_modules)) {
- continue;
- }
-
module = tracker_indexer_module_get (l->data);
if (module) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]