tracker r1446 - in branches/indexer-split: . src/libtracker-db src/tracker-indexer src/tracker-indexer/modules
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1446 - in branches/indexer-split: . src/libtracker-db src/tracker-indexer src/tracker-indexer/modules
- Date: Mon, 19 May 2008 12:58:42 +0000 (UTC)
Author: carlosg
Date: Mon May 19 12:58:42 2008
New Revision: 1446
URL: http://svn.gnome.org/viewvc/tracker?rev=1446&view=rev
Log:
2008-05-19 Carlos Garnacho <carlos imendio com>
* src/tracker-indexer/tracker-indexer-module.[ch]: add
tracker_indexer_module_get_ignore_directories().
* src/tracker-indexer/modules/files.c: implement it to ignore the
directories specified in the config file.
* src/tracker-indexer/tracker-indexer.c
(tracker_indexer_add_directory): Ignore files specified by the module.
* src/libtracker-db/Makefile.am: do not link libtracker-db with
libtracker-common, it's not necessary.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-db/Makefile.am
branches/indexer-split/src/tracker-indexer/modules/files.c
branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c
branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h
branches/indexer-split/src/tracker-indexer/tracker-indexer.c
Modified: branches/indexer-split/src/libtracker-db/Makefile.am
==============================================================================
--- branches/indexer-split/src/libtracker-db/Makefile.am (original)
+++ branches/indexer-split/src/libtracker-db/Makefile.am Mon May 19 12:58:42 2008
@@ -23,6 +23,4 @@
$(GLIB2_LIBS) \
$(GMIME_LIBS) \
$(SQLITE3_LIBS) \
- $(QDBM_LIBS) \
- $(top_builddir)/src/libtracker-common/libtracker-common.la
-
+ $(QDBM_LIBS)
Modified: branches/indexer-split/src/tracker-indexer/modules/files.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/modules/files.c (original)
+++ branches/indexer-split/src/tracker-indexer/modules/files.c Mon May 19 12:58:42 2008
@@ -65,6 +65,28 @@
return (gchar **) g_ptr_array_free (dirs, FALSE);
}
+gchar **
+tracker_module_get_ignore_directories (void)
+{
+ GSList *ignore_roots;
+ GPtrArray *dirs;
+
+ if (!config) {
+ config = tracker_config_new ();
+ }
+
+ ignore_roots = tracker_config_get_no_watch_directory_roots (config);
+ dirs = g_ptr_array_new ();
+
+ for (; ignore_roots; ignore_roots = ignore_roots->next) {
+ g_ptr_array_add (dirs, g_strdup (ignore_roots->data));
+ }
+
+ g_ptr_array_add (dirs, NULL);
+
+ return (gchar **) g_ptr_array_free (dirs, FALSE);
+}
+
GHashTable *
tracker_module_get_file_metadata (const gchar *file)
{
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer-module.c Mon May 19 12:58:42 2008
@@ -23,9 +23,9 @@
#include "tracker-indexer-module.h"
-typedef const gchar * (* Foo) (void);
-typedef gchar ** (* Bar) (void);
-typedef GHashTable * (* Baz) (const gchar *path);
+typedef const gchar * (* TrackerIndexerModuleGetName) (void);
+typedef gchar ** (* TrackerIndexerModuleGetDirectories) (void);
+typedef GHashTable * (* TrackerIndexerModuleGetData) (const gchar *path);
GModule *
tracker_indexer_module_load (const gchar *module_name)
@@ -55,7 +55,7 @@
G_CONST_RETURN gchar *
tracker_indexer_module_get_name (GModule *module)
{
- Foo func;
+ TrackerIndexerModuleGetName func;
if (g_module_symbol (module, "tracker_module_get_name", (gpointer *) &func)) {
return (func) ();
@@ -67,7 +67,7 @@
gchar **
tracker_indexer_module_get_directories (GModule *module)
{
- Bar func;
+ TrackerIndexerModuleGetDirectories func;
if (g_module_symbol (module, "tracker_module_get_directories", (gpointer *) &func)) {
return (func) ();
@@ -76,11 +76,23 @@
return NULL;
}
+gchar **
+tracker_indexer_module_get_ignore_directories (GModule *module)
+{
+ TrackerIndexerModuleGetDirectories func;
+
+ if (g_module_symbol (module, "tracker_module_get_ignore_directories", (gpointer *) &func)) {
+ return (func) ();
+ }
+
+ return NULL;
+}
+
GHashTable *
tracker_indexer_module_get_file_metadata (GModule *module,
const gchar *file)
{
- Baz func;
+ TrackerIndexerModuleGetData func;
if (g_module_symbol (module, "tracker_module_get_file_metadata", (gpointer *) &func)) {
return (func) (file);
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer-module.h Mon May 19 12:58:42 2008
@@ -22,14 +22,18 @@
#ifndef __TRACKER_INDEXER_MODULE_H__
#define __TRACKER_INDEXER_MODULE_H__
+#include <glib.h>
+
G_BEGIN_DECLS
-GModule * tracker_indexer_module_load (const gchar *module_name);
+GModule * tracker_indexer_module_load (const gchar *module_name);
+
+G_CONST_RETURN gchar * tracker_indexer_module_get_name (GModule *module);
+gchar ** tracker_indexer_module_get_directories (GModule *module);
+gchar ** tracker_indexer_module_get_ignore_directories (GModule *module);
-G_CONST_RETURN gchar * tracker_indexer_module_get_name (GModule *module);
-gchar ** tracker_indexer_module_get_directories (GModule *module);
-GHashTable * tracker_indexer_module_get_file_metadata (GModule *module,
- const gchar *file);
+GHashTable * tracker_indexer_module_get_file_metadata (GModule *module,
+ const gchar *file);
G_END_DECLS
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.c Mon May 19 12:58:42 2008
@@ -42,7 +42,7 @@
*/
#include <stdlib.h>
-
+#include <string.h>
#include <gmodule.h>
#include <libtracker-common/tracker-config.h>
@@ -281,12 +281,33 @@
PathInfo *info)
{
TrackerIndexerPrivate *priv;
+ gboolean ignore = FALSE;
+ gchar **ignore_dirs;
+ gint i;
g_return_if_fail (info != NULL);
priv = TRACKER_INDEXER_GET_PRIVATE (indexer);
- g_queue_push_tail (priv->dir_queue, info);
+ ignore_dirs = tracker_indexer_module_get_ignore_directories (info->module);
+
+ if (ignore_dirs) {
+ for (i = 0; ignore_dirs[i]; i++) {
+ if (strcmp (info->path, ignore_dirs[i]) == 0) {
+ ignore = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (!ignore) {
+ g_queue_push_tail (priv->dir_queue, info);
+ } else {
+ g_message ("Ignoring directory: %s\n", info->path);
+ path_info_free (info);
+ }
+
+ g_strfreev (ignore_dirs);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]