tracker r1782 - in branches/indexer-split: . data data/modules src/libtracker-common src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1782 - in branches/indexer-split: . data data/modules src/libtracker-common src/trackerd
- Date: Thu, 26 Jun 2008 16:24:25 +0000 (UTC)
Author: mr
Date: Thu Jun 26 16:24:25 2008
New Revision: 1782
URL: http://svn.gnome.org/viewvc/tracker?rev=1782&view=rev
Log:
* configure.ac:
* data/Makefile.am:
* data/modules/Makefile.am:
* data/modules/applications.xml:
* data/modules/files.xml:
* data/modules/gaim-conversations.xml: Added these module files
which should get read on startup.
* src/libtracker-common/Makefile.am:
* src/libtracker-common/tracker-module-config.[ch]: Added this
module to load the .xml files which get installed into
$prefix/share/tracker.
* src/trackerd/tracker-crawler.[ch]:
* src/trackerd/tracker-main.c:
* src/trackerd/tracker-process.[ch]: Use the new module config
code when initialising the process module.
Added:
branches/indexer-split/data/modules/
branches/indexer-split/data/modules/Makefile.am
branches/indexer-split/data/modules/applications.xml
branches/indexer-split/data/modules/files.xml
branches/indexer-split/data/modules/gaim-conversations.xml
branches/indexer-split/src/libtracker-common/tracker-module-config.c
branches/indexer-split/src/libtracker-common/tracker-module-config.h
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/configure.ac
branches/indexer-split/data/Makefile.am
branches/indexer-split/src/libtracker-common/Makefile.am
branches/indexer-split/src/libtracker-common/tracker-type-utils.c
branches/indexer-split/src/libtracker-common/tracker-type-utils.h
branches/indexer-split/src/trackerd/tracker-crawler.c
branches/indexer-split/src/trackerd/tracker-crawler.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/configure.ac
==============================================================================
--- branches/indexer-split/configure.ac (original)
+++ branches/indexer-split/configure.ac Thu Jun 26 16:24:25 2008
@@ -705,6 +705,7 @@
docs/Makefile
data/Makefile
data/dbus/Makefile
+ data/modules/Makefile
data/languages/Makefile
data/icons/Makefile
data/icons/16x16/Makefile
Modified: branches/indexer-split/data/Makefile.am
==============================================================================
--- branches/indexer-split/data/Makefile.am (original)
+++ branches/indexer-split/data/Makefile.am Thu Jun 26 16:24:25 2008
@@ -1,4 +1,4 @@
-SUBDIRS = dbus languages icons services
+SUBDIRS = dbus modules languages icons services
configdir = $(datadir)/tracker
Added: branches/indexer-split/data/modules/Makefile.am
==============================================================================
--- (empty file)
+++ branches/indexer-split/data/modules/Makefile.am Thu Jun 26 16:24:25 2008
@@ -0,0 +1,8 @@
+configdir = $(datadir)/tracker/modules
+
+config_DATA = \
+ applications.xml \
+ files.xml \
+ gaim-conversations.xml
+
+EXTRA_DIST = $(config_DATA)
Added: branches/indexer-split/data/modules/applications.xml
==============================================================================
--- (empty file)
+++ branches/indexer-split/data/modules/applications.xml Thu Jun 26 16:24:25 2008
@@ -0,0 +1,19 @@
+[General]
+Description=Applications
+Enabled=True
+
+[Monitors]
+Directories=
+RecurseDirectories=/usr/share;
+
+[Ignored]
+Directories=
+Files=
+
+[Index]
+Service=Applications
+MimeTypes=
+Files=*.desktop
+
+[Specific]
+# Options specific to this module
Added: branches/indexer-split/data/modules/files.xml
==============================================================================
--- (empty file)
+++ branches/indexer-split/data/modules/files.xml Thu Jun 26 16:24:25 2008
@@ -0,0 +1,19 @@
+[General]
+Description=Files
+Enabled=True
+
+[Monitors]
+Directories=
+RecurseDirectories=
+
+[Ignored]
+Directories=po;CVS;.svn;.git
+Files=*~*;*.o;*.la;*.lo;*.loT;*.in;*.csproj;*.m4;*.rej;*.gmo;*.orig;*.pc;*.omf;*.aux;*.tmp;*.po;*.vmdk;*.vm*;*.nvram;*.part;autom4te;conftest;confstat;Makefile;SCCS;litmain.sh;libtool;config.status;confdefs.h;
+
+[Index]
+Service=Files
+MimeTypes=
+Files=
+
+[Specific]
+# Options specific to this module
Added: branches/indexer-split/data/modules/gaim-conversations.xml
==============================================================================
--- (empty file)
+++ branches/indexer-split/data/modules/gaim-conversations.xml Thu Jun 26 16:24:25 2008
@@ -0,0 +1,19 @@
+[General]
+Description=GAIM Conversations
+Enabled=True
+
+[Monitors]
+Directories=
+RecurseDirectories=$HOME/.gaim/logs;$HOME/.purple/logs;
+
+[Ignored]
+Directories=
+Files=
+
+[Index]
+Service=Files
+MimeTypes=
+Files=
+
+[Specific]
+# Options specific to this module
Modified: branches/indexer-split/src/libtracker-common/Makefile.am
==============================================================================
--- branches/indexer-split/src/libtracker-common/Makefile.am (original)
+++ branches/indexer-split/src/libtracker-common/Makefile.am Thu Jun 26 16:24:25 2008
@@ -42,6 +42,8 @@
tracker-language.h \
tracker-log.c \
tracker-log.h \
+ tracker-module-config.c \
+ tracker-module-config.h \
tracker-nfs-lock.c \
tracker-nfs-lock.h \
tracker-ontology.c \
Added: branches/indexer-split/src/libtracker-common/tracker-module-config.c
==============================================================================
--- (empty file)
+++ branches/indexer-split/src/libtracker-common/tracker-module-config.c Thu Jun 26 16:24:25 2008
@@ -0,0 +1,549 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia (urho konttori nokia com)
+ *
+ * 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 "config.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "tracker-module-config.h"
+#include "tracker-type-utils.h"
+
+#define GROUP_GENERAL "General"
+#define GROUP_MONITORS "Monitors"
+#define GROUP_IGNORED "Ignored"
+#define GROUP_INDEX "Index"
+#define GROUP_SPECIFIC "Specific"
+
+typedef struct {
+ /* General */
+ gchar *description;
+ gboolean enabled;
+
+ /* Monitors */
+ GSList *monitor_directories;
+ GSList *monitor_recurse_directories;
+
+ /* Ignored */
+ GSList *ignored_directories;
+ GSList *ignored_files;
+
+ /* Index */
+ gchar *service;
+ GSList *mime_types;
+ GSList *files;
+
+ /* Specific Options, FIXME: Finish */
+
+} ModuleConfig;
+
+static gboolean initiated;
+static GHashTable *modules;
+static GFileMonitor *monitor;
+
+static void
+module_config_free (ModuleConfig *mc)
+{
+ g_free (mc->description);
+
+ g_slist_foreach (mc->monitor_directories, (GFunc) g_free, NULL);
+ g_slist_free (mc->monitor_directories);
+
+ g_slist_foreach (mc->monitor_recurse_directories, (GFunc) g_free, NULL);
+ g_slist_free (mc->monitor_recurse_directories);
+
+ g_slist_foreach (mc->ignored_directories, (GFunc) g_free, NULL);
+ g_slist_free (mc->ignored_directories);
+
+ g_slist_foreach (mc->ignored_files, (GFunc) g_free, NULL);
+ g_slist_free (mc->ignored_files);
+
+ g_free (mc->service);
+
+ g_slist_foreach (mc->mime_types, (GFunc) g_free, NULL);
+ g_slist_free (mc->mime_types);
+
+ g_slist_foreach (mc->files, (GFunc) g_free, NULL);
+ g_slist_free (mc->files);
+
+ g_slice_free (ModuleConfig, mc);
+}
+
+static gchar *
+module_config_get_directory (void)
+{
+ return g_build_path (SHAREDIR, "tracker", "modules", NULL);
+}
+
+gboolean
+module_config_load_boolean (GKeyFile *key_file,
+ const gchar *group,
+ const gchar *key)
+{
+ GError *error = NULL;
+ gboolean boolean;
+
+ boolean = g_key_file_get_boolean (key_file, group, key, &error);
+
+ if (error) {
+ g_message ("Couldn't load module config boolean in "
+ "group:'%s' with key:'%s', %s",
+ group,
+ key,
+ error->message);
+
+ g_error_free (error);
+ g_key_file_free (key_file);
+
+ return FALSE;
+ }
+
+ return boolean;
+}
+
+gchar *
+module_config_load_string (GKeyFile *key_file,
+ const gchar *group,
+ const gchar *key)
+{
+ GError *error = NULL;
+ gchar *str;
+
+ str = g_key_file_get_string (key_file, group, key, &error);
+
+ if (error) {
+ g_message ("Couldn't load module config string in "
+ "group:'%s' with key:'%s', %s",
+ group,
+ key,
+ error->message);
+
+ g_error_free (error);
+ g_key_file_free (key_file);
+
+ return NULL;
+ }
+
+ return str;
+}
+
+GSList *
+module_config_load_string_list (GKeyFile *key_file,
+ const gchar *group,
+ const gchar *key)
+{
+ GError *error = NULL;
+ gchar **str;
+ gsize size;
+
+ str = g_key_file_get_string_list (key_file, group, key, &size, &error);
+
+ if (error) {
+ g_message ("Couldn't load module config string list in "
+ "group:'%s' with key:'%s', %s",
+ group,
+ key,
+ error->message);
+
+ g_error_free (error);
+ g_key_file_free (key_file);
+
+ return NULL;
+ }
+
+ return tracker_string_list_to_gslist (str, size);
+}
+
+static ModuleConfig *
+module_config_load_file (const gchar *filename)
+{
+ GKeyFile *key_file;
+ GError *error;
+ ModuleConfig *mc;
+
+ key_file = g_key_file_new ();
+
+ /* Load options */
+ g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, &error);
+
+ if (error) {
+ g_message ("Couldn't load module config for '%s', %s",
+ filename,
+ error->message);
+
+ g_error_free (error);
+ g_key_file_free (key_file);
+
+ return NULL;
+ }
+
+ mc = g_slice_new0 (ModuleConfig);
+
+ /* General */
+ mc->description =
+ module_config_load_string (key_file,
+ GROUP_GENERAL,
+ "Description");
+ mc->enabled =
+ module_config_load_boolean (key_file,
+ GROUP_GENERAL,
+ "Enabled");
+
+ /* Monitors */
+ mc->monitor_directories =
+ module_config_load_string_list (key_file,
+ GROUP_MONITORS,
+ "Directories");
+ mc->monitor_recurse_directories =
+ module_config_load_string_list (key_file,
+ GROUP_MONITORS,
+ "RecurseDirectories");
+
+ /* Ignored */
+ mc->ignored_directories =
+ module_config_load_string_list (key_file,
+ GROUP_IGNORED,
+ "Directories");
+ mc->ignored_files =
+ module_config_load_string_list (key_file,
+ GROUP_IGNORED,
+ "Files");
+
+ /* Index */
+ mc->service =
+ module_config_load_string (key_file,
+ GROUP_INDEX,
+ "Service");
+ mc->mime_types =
+ module_config_load_string_list (key_file,
+ GROUP_INDEX,
+ "MimeTypes");
+ mc->files =
+ module_config_load_string_list (key_file,
+ GROUP_INDEX,
+ "Files");
+
+ /* FIXME: Specific options */
+
+ g_message ("Loaded module config:'%s'", filename);
+
+ return mc;
+}
+
+static gboolean
+module_config_load (void)
+{
+ GFile *file;
+ GFileEnumerator *enumerator;
+ GFileInfo *info;
+ GError *error = NULL;
+ gchar *path;
+ gchar *filename;
+ const gchar *name;
+
+ g_message ("Loading module config...");
+
+ path = module_config_get_directory ();
+ file = g_file_new_for_path (path);
+
+ enumerator = g_file_enumerate_children (file,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_PRIORITY_DEFAULT,
+ NULL,
+ &error);
+
+ if (error) {
+ g_warning ("Could not get module config from directory:'%s', %s",
+ path,
+ error->message);
+
+ g_free (path);
+ g_error_free (error);
+ g_object_unref (file);
+
+ return FALSE;
+ }
+
+ modules = NULL;
+
+ /* We should probably do this async */
+ for (info = g_file_enumerator_next_file (enumerator, NULL, &error);
+ info && !error;
+ info = g_file_enumerator_next_file (enumerator, NULL, &error)) {
+ GFile *child;
+ ModuleConfig *mc;
+
+ name = g_file_info_get_name (info);
+
+ if (!g_str_has_suffix (name, ".xml")) {
+ g_object_unref (info);
+ continue;
+ }
+
+ child = g_file_get_child (file, g_file_info_get_name (info));
+ filename = g_file_get_path (child);
+ mc = module_config_load_file (filename);
+
+ if (mc) {
+ gchar *name_stripped;
+
+ name_stripped = g_strndup (name, g_utf8_strlen (name, -1) - 4);
+
+ g_hash_table_insert (modules,
+ name_stripped,
+ mc);
+ }
+
+ g_object_unref (child);
+ g_object_unref (info);
+ }
+
+ if (error) {
+ g_warning ("Could not get module config information from directory:'%s', %s",
+ path,
+ error->message);
+ g_error_free (error);
+ }
+
+ g_message ("Loaded module config, %d found",
+ g_hash_table_size (modules));
+
+ g_object_unref (enumerator);
+ g_object_unref (file);
+ g_free (path);
+
+ return TRUE;
+}
+
+static void
+module_config_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ gpointer user_data)
+{
+ gchar *filename;
+
+ /* Do we recreate if the file is deleted? */
+
+ switch (event_type) {
+ case G_FILE_MONITOR_EVENT_CHANGED:
+ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
+ filename = g_file_get_path (file);
+ g_message ("Config file changed:'%s', reloading settings...",
+ filename);
+ g_free (filename);
+
+ module_config_load ();
+ break;
+
+ default:
+ break;
+ }
+}
+
+gboolean
+tracker_module_config_init (void)
+{
+ GFile *file;
+ gchar *path;
+
+ if (initiated) {
+ return TRUE;
+ }
+
+ path = module_config_get_directory ();
+ if (!g_file_test (path, G_FILE_TEST_IS_DIR | G_FILE_TEST_EXISTS)) {
+ g_critical ("Module config directory:'%s' doesn't exist",
+ path);
+ g_free (path);
+ return FALSE;
+ }
+
+ modules = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) module_config_free);
+
+ /* Get modules */
+ if (!module_config_load ()) {
+ g_hash_table_unref (modules);
+ return FALSE;
+ }
+
+ /* Add file monitoring for changes */
+ g_message ("Setting up monitor for changes to modules directory:'%s'",
+ path);
+
+ file = g_file_new_for_path (path);
+ monitor = g_file_monitor_directory (file,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ NULL);
+
+ g_signal_connect (monitor, "changed",
+ G_CALLBACK (module_config_changed_cb),
+ NULL);
+
+ g_object_unref (file);
+
+ initiated = TRUE;
+
+ return TRUE;
+}
+
+void
+tracker_module_config_shutdown (void)
+{
+ if (!initiated) {
+ return;
+ }
+
+ g_signal_handlers_disconnect_by_func (monitor,
+ module_config_changed_cb,
+ NULL);
+
+ g_object_unref (monitor);
+
+ g_hash_table_unref (modules);
+
+ initiated = FALSE;
+}
+
+const gchar *
+tracker_module_config_get_description (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->description;
+}
+
+gboolean
+tracker_module_config_get_enabled (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, FALSE);
+
+ return mc->enabled;
+}
+
+GSList *
+tracker_module_config_get_monitor_directories (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->monitor_directories;
+}
+
+GSList *
+tracker_module_config_get_monitor_recurse_directories (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->monitor_recurse_directories;
+}
+
+GSList *
+tracker_module_config_get_ignored_directories (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->ignored_directories;
+}
+
+GSList *
+tracker_module_config_get_ignored_files (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->ignored_files;
+}
+
+const gchar *
+tracker_module_config_get_service (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->service;
+}
+
+GSList *
+tracker_module_config_get_mime_types (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->mime_types;
+}
+
+GSList *
+tracker_module_config_get_files (const gchar *name)
+{
+ ModuleConfig *mc;
+
+ g_return_val_if_fail (name != NULL, FALSE);
+
+ mc = g_hash_table_lookup (modules, name);
+ g_return_val_if_fail (mc, NULL);
+
+ return mc->files;
+}
Added: branches/indexer-split/src/libtracker-common/tracker-module-config.h
==============================================================================
--- (empty file)
+++ branches/indexer-split/src/libtracker-common/tracker-module-config.h Thu Jun 26 16:24:25 2008
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia (urho konttori nokia com)
+ *
+ * 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 __LIBTRACKER_COMMON_MODULE_CONFIG_H__
+#define __LIBTRACKER_COMMON_MODULE_CONFIG_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+gboolean tracker_module_config_init (void);
+void tracker_module_config_shutdown (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);
+GSList * tracker_module_config_get_monitor_recurse_directories (const gchar *name);
+GSList * tracker_module_config_get_ignored_directories (const gchar *name);
+GSList * tracker_module_config_get_ignored_files (const gchar *name);
+const gchar *tracker_module_config_get_service (const gchar *name);
+const gchar *tracker_module_config_get_service (const gchar *name);
+GSList * tracker_module_config_get_mime_types (const gchar *name);
+GSList * tracker_module_config_get_files (const gchar *name);
+
+G_END_DECLS
+
+#endif /* __LIBTRACKER_COMMON_MODULE_CONFIG_H__ */
+
Modified: branches/indexer-split/src/libtracker-common/tracker-type-utils.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-type-utils.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-type-utils.c Thu Jun 26 16:24:25 2008
@@ -615,23 +615,55 @@
return strv;
}
+GSList *
+tracker_string_list_to_gslist (gchar **strv,
+ gsize size)
+{
+ GSList *list;
+ gint i;
+ gint size_used;
+
+ g_return_val_if_fail (strv != NULL, NULL);
+
+ if (size == -1) {
+ size_used = g_strv_length (strv);
+ } else {
+ size_used = size;
+ }
+
+ list = NULL;
+
+ for (i = 0; i < size; i++) {
+ if (strv[i]) {
+ list = g_slist_prepend (list, g_strdup (strv[i]));
+ } else {
+ break;
+ }
+ }
+
+ return g_slist_reverse (list);
+}
+
gchar *
tracker_string_list_to_string (gchar **strv,
- gint length,
+ gsize size,
gchar sep)
{
GString *string;
gint i;
+ gint size_used;
g_return_val_if_fail (strv != NULL, NULL);
- if (length == -1) {
- length = g_strv_length (strv);
+ if (size == -1) {
+ size_used = g_strv_length (strv);
+ } else {
+ size_used = size;
}
string = g_string_new ("");
- for (i = 0; i < length; i++) {
+ for (i = 0; i < size; i++) {
if (strv[i]) {
if (i > 0) {
g_string_append_c (string, sep);
Modified: branches/indexer-split/src/libtracker-common/tracker-type-utils.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-type-utils.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-type-utils.h Thu Jun 26 16:24:25 2008
@@ -36,9 +36,11 @@
guint *ret);
gint tracker_string_in_string_list (const gchar *str,
gchar **strv);
-gchar ** tracker_gslist_to_string_list (GSList *list);
+gchar ** tracker_gslist_to_string_list (GSList *list);
+GSList * tracker_string_list_to_gslist (gchar **strv,
+ gsize length);
gchar * tracker_string_list_to_string (gchar **strv,
- gint length,
+ gsize length,
gchar sep);
/* "true" -> "1"; "false" -> "0" */
Modified: branches/indexer-split/src/trackerd/tracker-crawler.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.c (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.c Thu Jun 26 16:24:25 2008
@@ -302,9 +302,13 @@
}
TrackerCrawler *
-tracker_crawler_new (void)
+tracker_crawler_new (TrackerConfig *config)
{
- return g_object_new (TRACKER_TYPE_CRAWLER, NULL);
+ g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
+
+ return g_object_new (TRACKER_TYPE_CRAWLER,
+ "config", config,
+ NULL);
}
void
Modified: branches/indexer-split/src/trackerd/tracker-crawler.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.h (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.h Thu Jun 26 16:24:25 2008
@@ -52,7 +52,7 @@
};
GType tracker_crawler_get_type (void);
-TrackerCrawler *tracker_crawler_new (void);
+TrackerCrawler *tracker_crawler_new (TrackerConfig *config);
void tracker_crawler_set_config (TrackerCrawler *object,
TrackerConfig *config);
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 Thu Jun 26 16:24:25 2008
@@ -638,7 +638,7 @@
}
/* Get files first */
- tracker_crawler_start (tracker->crawler);
+ tracker_process_start ();
proxy = tracker_dbus_indexer_get_proxy ();
tracker_xesam_subscribe_index_updated (proxy);
@@ -794,15 +794,14 @@
tracker_db_manager_init (flags, &tracker->first_time_index);
tracker_db_init ();
tracker_xesam_manager_init ();
+ tracker_process_init ();
- tracker->crawler = tracker_crawler_new ();
+ tracker->crawler = tracker_crawler_new (tracker->config);
#ifdef HAVE_HAL
tracker->hal = tracker_hal_new ();
tracker_crawler_set_hal (tracker->crawler, tracker->hal);
#endif /* HAVE_HAL */
-
- tracker_crawler_set_config (tracker->crawler, tracker->config);
umask (077);
@@ -860,7 +859,7 @@
tracker_status_set (TRACKER_STATUS_SHUTDOWN);
/* Set kill timeout */
- g_timeout_add_full (G_PRIORITY_LOW, 10000, shutdown_timeout_cb, NULL, NULL);
+ g_timeout_add_full (G_PRIORITY_LOW, 5000, shutdown_timeout_cb, NULL, NULL);
shutdown_indexer ();
shutdown_databases ();
@@ -868,6 +867,7 @@
/* Shutdown major subsystems */
tracker_dbus_shutdown ();
+ tracker_process_shutdown ();
tracker_xesam_manager_shutdown ();
tracker_db_manager_shutdown (TRUE);
tracker_db_shutdown ();
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 Thu Jun 26 16:24:25 2008
@@ -1,5 +1,7 @@
-/* Tracker - indexer and metadata database engine
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
* Copyright (C) 2008, Mr Jamie McCracken (jamiemcc gnome org)
+ * 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
@@ -19,3 +21,24 @@
#include "config.h"
+#include <glib.h>
+
+#include <libtracker-common/tracker-module-config.h>
+
+void
+tracker_process_start (void)
+{
+ g_message ("Starting to process modules...");
+}
+
+void
+tracker_process_init (void)
+{
+ tracker_module_config_init ();
+}
+
+void
+tracker_process_shutdown (void)
+{
+ tracker_module_config_shutdown ();
+}
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 Thu Jun 26 16:24:25 2008
@@ -22,9 +22,10 @@
#ifndef __TRACKERD_PROCESS_H__
#define __TRACKERD_PROCESS_H__
-
G_BEGIN_DECLS
+void tracker_process_init (void);
+void tracker_process_shutdown (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]