tracker r1790 - in branches/indexer-split: . src/libtracker-common src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1790 - in branches/indexer-split: . src/libtracker-common src/trackerd
- Date: Fri, 27 Jun 2008 10:56:49 +0000 (UTC)
Author: mr
Date: Fri Jun 27 10:56:49 2008
New Revision: 1790
URL: http://svn.gnome.org/viewvc/tracker?rev=1790&view=rev
Log:
* src/trackerd/tracker-main.c:
* src/trackerd/tracker-process.[ch]: Start by setting up monitors
and recursive monitors. The recursive monitors are still not
finished, this requires some work.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-common/tracker-module-config.c
branches/indexer-split/src/libtracker-common/tracker-module-config.h
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/src/trackerd/tracker-process.c
branches/indexer-split/src/trackerd/tracker-process.h
Modified: branches/indexer-split/src/libtracker-common/tracker-module-config.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-module-config.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-module-config.c Fri Jun 27 10:56:49 2008
@@ -300,6 +300,8 @@
gchar *path;
gchar *filename;
const gchar *name;
+ const gchar *extension;
+ glong extension_len;
path = module_config_get_directory ();
file = g_file_new_for_path (path);
@@ -323,6 +325,9 @@
return FALSE;
}
+ extension = ".module";
+ extension_len = g_utf8_strlen (extension, -1);
+
/* We should probably do this async */
for (info = g_file_enumerator_next_file (enumerator, NULL, &error);
info && !error;
@@ -332,7 +337,7 @@
name = g_file_info_get_name (info);
- if (!g_str_has_suffix (name, ".module")) {
+ if (!g_str_has_suffix (name, extension)) {
g_object_unref (info);
continue;
}
@@ -344,7 +349,7 @@
if (mc) {
gchar *name_stripped;
- name_stripped = g_strndup (name, g_utf8_strlen (name, -1) - 4);
+ name_stripped = g_strndup (name, g_utf8_strlen (name, -1) - extension_len);
g_hash_table_insert (modules,
name_stripped,
@@ -467,6 +472,12 @@
initiated = FALSE;
}
+GList *
+tracker_module_config_get_modules (void)
+{
+ return g_hash_table_get_keys (modules);
+}
+
const gchar *
tracker_module_config_get_description (const gchar *name)
{
Modified: branches/indexer-split/src/libtracker-common/tracker-module-config.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-module-config.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-module-config.h Fri Jun 27 10:56:49 2008
@@ -27,6 +27,9 @@
gboolean tracker_module_config_init (void);
void tracker_module_config_shutdown (void);
+
+GList * tracker_module_config_get_modules (void);
+
const gchar *tracker_module_config_get_description (const gchar *name);
gboolean tracker_module_config_get_enabled (const gchar *name);
GSList * tracker_module_config_get_monitor_directories (const gchar *name);
Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c (original)
+++ branches/indexer-split/src/trackerd/tracker-main.c Fri Jun 27 10:56:49 2008
@@ -638,7 +638,7 @@
}
/* Get files first */
- tracker_process_start ();
+ tracker_process_start (user_data);
proxy = tracker_dbus_indexer_get_proxy ();
tracker_xesam_subscribe_index_updated (proxy);
@@ -838,7 +838,7 @@
seconds);
g_timeout_add (seconds * 1000,
start_cb,
- NULL);
+ tracker->crawler);
} else {
g_idle_add (start_cb, tracker);
}
@@ -903,7 +903,7 @@
tracker->is_running = FALSE;
/* Stop any tight loop operations */
- tracker_crawler_stop (tracker->crawler);
+ tracker_process_stop ();
g_main_loop_quit (main_loop);
}
Modified: branches/indexer-split/src/trackerd/tracker-process.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-process.c (original)
+++ branches/indexer-split/src/trackerd/tracker-process.c Fri Jun 27 10:56:49 2008
@@ -22,13 +22,103 @@
#include "config.h"
#include <glib.h>
+#include <gio/gio.h>
#include <libtracker-common/tracker-module-config.h>
+#include "tracker-process.h"
+#include "tracker-monitor.h"
+
+static TrackerCrawler *crawler;
+
+static void
+add_monitors (const gchar *name)
+{
+ GSList *monitors;
+ GSList *l;
+
+ monitors = tracker_module_config_get_monitor_directories (name);
+
+ for (l = monitors; l; l = l->next) {
+ GFile *file;
+ const gchar *path;
+
+ path = l->data;
+
+ g_message (" Adding specific directory monitor:'%s'", path);
+
+ file = g_file_new_for_path (path);
+ tracker_monitor_add (file);
+ g_object_unref (file);
+ }
+
+ if (!monitors) {
+ g_message (" No specific monitors to set up");
+ }
+}
+
+static void
+add_recurse_monitors (const gchar *name)
+{
+ GSList *monitors;
+ GSList *l;
+
+ monitors = tracker_module_config_get_monitor_recurse_directories (name);
+
+ for (l = monitors; l; l = l->next) {
+ GFile *file;
+ const gchar *path;
+
+ path = l->data;
+
+ g_message (" Adding recurse directory monitor:'%s' (FIXME: Not finished)", path);
+
+ file = g_file_new_for_path (path);
+ tracker_monitor_add (file);
+ g_object_unref (file);
+ }
+
+ if (!monitors) {
+ g_message (" No recurse monitors to set up");
+ }
+}
+
+void
+tracker_process_start (TrackerCrawler *crawler_to_start)
+{
+ GList *modules;
+ GList *l;
+
+ g_return_if_fail (TRACKER_IS_CRAWLER (crawler_to_start));
+
+ crawler = g_object_ref (crawler_to_start);
+ modules = tracker_module_config_get_modules ();
+
+ g_message ("Starting to process %d modules...",
+ g_list_length (modules));
+
+ for (l = modules; l; l = l->next) {
+ gchar *name;
+
+ name = l->data;
+ g_message ("Processing module:'%s'", name);
+
+ add_monitors (name);
+ add_recurse_monitors (name);
+
+ /* FIXME: Finish, start crawling? */
+ }
+
+
+ g_list_free (modules);
+}
+
void
-tracker_process_start (void)
+tracker_process_stop (void)
{
- g_message ("Starting to process modules...");
+ if (crawler) {
+ tracker_crawler_stop (crawler);
+ }
}
void
Modified: branches/indexer-split/src/trackerd/tracker-process.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-process.h (original)
+++ branches/indexer-split/src/trackerd/tracker-process.h Fri Jun 27 10:56:49 2008
@@ -22,11 +22,16 @@
#ifndef __TRACKERD_PROCESS_H__
#define __TRACKERD_PROCESS_H__
+#include "tracker-crawler.h"
+
G_BEGIN_DECLS
void tracker_process_init (void);
void tracker_process_shutdown (void);
+void tracker_process_start (TrackerCrawler *crawler);
+void tracker_process_stop (void);
+
G_END_DECLS
#endif /* __TRACKERD_PROCESS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]