tracker r1449 - in branches/xesam-support: . src/libtracker-common src/libtracker-db src/tracker-indexer src/tracker-indexer/modules src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1449 - in branches/xesam-support: . src/libtracker-common src/libtracker-db src/tracker-indexer src/tracker-indexer/modules src/trackerd
- Date: Tue, 20 May 2008 08:18:15 +0000 (UTC)
Author: pvanhoof
Date: Tue May 20 08:18:14 2008
New Revision: 1449
URL: http://svn.gnome.org/viewvc/tracker?rev=1449&view=rev
Log:
2008-05-20 Philip Van Hoof <pvanhoof gnome org>
* Merged xesam-support with indexer-split
svn merge -r 1444:1448 ../indexer-split
Added:
branches/xesam-support/src/trackerd/tracker-field.c
- copied unchanged from r1448, /branches/indexer-split/src/trackerd/tracker-field.c
branches/xesam-support/src/trackerd/tracker-field.h
- copied unchanged from r1448, /branches/indexer-split/src/trackerd/tracker-field.h
branches/xesam-support/src/trackerd/tracker-ontology.c
- copied unchanged from r1448, /branches/indexer-split/src/trackerd/tracker-ontology.c
branches/xesam-support/src/trackerd/tracker-ontology.h
- copied unchanged from r1448, /branches/indexer-split/src/trackerd/tracker-ontology.h
Removed:
branches/xesam-support/src/trackerd/tracker-service-manager.c
branches/xesam-support/src/trackerd/tracker-service-manager.h
Modified:
branches/xesam-support/ChangeLog
branches/xesam-support/src/libtracker-common/Makefile.am
branches/xesam-support/src/libtracker-common/tracker-file-utils.c
branches/xesam-support/src/libtracker-common/tracker-language.c
branches/xesam-support/src/libtracker-common/tracker-log.c
branches/xesam-support/src/libtracker-common/tracker-log.h
branches/xesam-support/src/libtracker-common/tracker-nfs-lock.c
branches/xesam-support/src/libtracker-common/tracker-os-dependant-unix.c
branches/xesam-support/src/libtracker-common/tracker-type-utils.c
branches/xesam-support/src/libtracker-db/Makefile.am
branches/xesam-support/src/libtracker-db/tracker-db-file-info.c
branches/xesam-support/src/tracker-indexer/modules/files.c
branches/xesam-support/src/tracker-indexer/tracker-indexer-module.c
branches/xesam-support/src/tracker-indexer/tracker-indexer-module.h
branches/xesam-support/src/tracker-indexer/tracker-indexer.c
branches/xesam-support/src/trackerd/Makefile.am
branches/xesam-support/src/trackerd/tracker-apps.c
branches/xesam-support/src/trackerd/tracker-cache.c
branches/xesam-support/src/trackerd/tracker-db-email.c
branches/xesam-support/src/trackerd/tracker-db-sqlite.c
branches/xesam-support/src/trackerd/tracker-db-sqlite.h
branches/xesam-support/src/trackerd/tracker-db.c
branches/xesam-support/src/trackerd/tracker-db.h
branches/xesam-support/src/trackerd/tracker-dbus-daemon.c
branches/xesam-support/src/trackerd/tracker-dbus-files.c
branches/xesam-support/src/trackerd/tracker-dbus-keywords.c
branches/xesam-support/src/trackerd/tracker-dbus-metadata.c
branches/xesam-support/src/trackerd/tracker-dbus-search.c
branches/xesam-support/src/trackerd/tracker-dbus-xesam.c
branches/xesam-support/src/trackerd/tracker-dbus.c
branches/xesam-support/src/trackerd/tracker-email-evolution.c
branches/xesam-support/src/trackerd/tracker-email-modest.c
branches/xesam-support/src/trackerd/tracker-email-utils.c
branches/xesam-support/src/trackerd/tracker-hal.c
branches/xesam-support/src/trackerd/tracker-index-stage.c
branches/xesam-support/src/trackerd/tracker-indexer.c
branches/xesam-support/src/trackerd/tracker-inotify.c
branches/xesam-support/src/trackerd/tracker-ioprio.c
branches/xesam-support/src/trackerd/tracker-main.c
branches/xesam-support/src/trackerd/tracker-main.h
branches/xesam-support/src/trackerd/tracker-metadata.c
branches/xesam-support/src/trackerd/tracker-process-files.c
branches/xesam-support/src/trackerd/tracker-query-tree.c
branches/xesam-support/src/trackerd/tracker-rdf-query.c
branches/xesam-support/src/trackerd/tracker-utils.c
branches/xesam-support/src/trackerd/tracker-xesam-query.c
Modified: branches/xesam-support/src/libtracker-common/Makefile.am
==============================================================================
--- branches/xesam-support/src/libtracker-common/Makefile.am (original)
+++ branches/xesam-support/src/libtracker-common/Makefile.am Tue May 20 08:18:14 2008
@@ -1,6 +1,7 @@
-INCLUDES = \
- $(GLIB2_CFLAGS) \
- -DSHAREDIR=\""$(datadir)"\" \
+INCLUDES = \
+ $(GLIB2_CFLAGS) \
+ -DSHAREDIR=\""$(datadir)"\" \
+ -DG_LOG_DOMAIN=\"Tracker\" \
-I$(top_srcdir)/src
noinst_LTLIBRARIES = libtracker-common.la
Modified: branches/xesam-support/src/libtracker-common/tracker-file-utils.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-file-utils.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-file-utils.c Tue May 20 08:18:14 2008
@@ -199,8 +199,8 @@
str = g_filename_from_utf8 (uri, -1, NULL, NULL, NULL);
if (!str) {
- tracker_error ("URI:'%s' could not be converted to locale format",
- uri);
+ g_warning ("URI:'%s' could not be converted to locale format",
+ uri);
return FALSE;
}
@@ -227,8 +227,8 @@
str = g_filename_from_utf8 (uri, -1, NULL, NULL, NULL);
if (!str) {
- tracker_error ("URI:'%s' could not be converted to locale format",
- str);
+ g_warning ("URI:'%s' could not be converted to locale format",
+ str);
return FALSE;
}
@@ -245,11 +245,13 @@
struct stat finfo;
gboolean is_indexable;
+ g_return_val_if_fail (uri != NULL, FALSE);
+
str = g_filename_from_utf8 (uri, -1, NULL, NULL, NULL);
if (!str) {
- tracker_error ("URI:'%s' could not be converted to locale format",
- str);
+ g_warning ("URI:'%s' could not be converted to locale format",
+ str);
return FALSE;
}
@@ -260,9 +262,9 @@
is_indexable &= !S_ISDIR (finfo.st_mode);
is_indexable &= S_ISREG (finfo.st_mode);
- tracker_debug ("URI:'%s' %s indexable",
- uri,
- is_indexable ? "is" : "is not");
+ g_debug ("URI:'%s' %s indexable",
+ uri,
+ is_indexable ? "is" : "is not");
return is_indexable;
}
@@ -281,8 +283,8 @@
return 0;
}
} else {
- tracker_error ("URI:'%s' could not be converted to locale format",
- uri);
+ g_warning ("URI:'%s' could not be converted to locale format",
+ uri);
return 0;
}
@@ -300,16 +302,16 @@
gchar *mime_type;
if (!tracker_file_is_valid (uri)) {
- tracker_log ("URI:'%s' is no longer valid",
- uri);
+ g_message ("URI:'%s' is no longer valid",
+ uri);
return g_strdup ("unknown");
}
str = g_filename_from_utf8 (uri, -1, NULL, NULL, NULL);
if (!str) {
- tracker_error ("URI:'%s' could not be converted to locale format",
- uri);
+ g_warning ("URI:'%s' could not be converted to locale format",
+ uri);
return g_strdup ("unknown");
}
Modified: branches/xesam-support/src/libtracker-common/tracker-language.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-language.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-language.c Tue May 20 08:18:14 2008
@@ -261,7 +261,7 @@
mapped_file = g_mapped_file_new (filename, FALSE, &error);
if (error) {
- tracker_log ("Tracker couldn't read stopword file:'%s', %s",
+ g_message ("Tracker couldn't read stopword file:'%s', %s",
filename, error->message);
g_clear_error (&error);
return;
@@ -295,7 +295,7 @@
priv = GET_PRIV (language);
/* Set up stopwords list */
- tracker_log ("Setting up stopword list for language code:'%s'", language_code);
+ g_message ("Setting up stopword list for language code:'%s'", language_code);
stopword_filename = language_get_stopword_filename (language_code);
language_add_stopwords (language, stopword_filename);
@@ -307,7 +307,7 @@
g_free (stopword_filename);
}
- tracker_log ("Setting up stemmer for language code:'%s'", language_code);
+ g_message ("Setting up stemmer for language code:'%s'", language_code);
stem_language = language_get_name_for_code (language_code);
@@ -319,8 +319,8 @@
priv->stemmer = sb_stemmer_new (stem_language, NULL);
if (!priv->stemmer) {
- tracker_log ("No stemmer could be found for language:'%s'",
- stem_language);
+ g_message ("No stemmer could be found for language:'%s'",
+ stem_language);
}
g_mutex_unlock (priv->stemmer_mutex);
Modified: branches/xesam-support/src/libtracker-common/tracker-log.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-log.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-log.c Tue May 20 08:18:14 2008
@@ -29,25 +29,21 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <glib/gstdio.h>
-#ifdef OS_WIN32
-#include <conio.h>
-#include "mingw-compat.h"
-#else
-#include <sys/resource.h>
-#endif
+#include <glib/gstdio.h>
#include "tracker-log.h"
typedef struct {
GMutex *mutex;
+ gchar *domain;
gchar *filename;
gint verbosity;
gboolean abort_on_error;
} TrackerLog;
static TrackerLog *log = NULL;
+static guint log_handler_id;
static inline void
log_output (const char *message)
@@ -64,8 +60,6 @@
g_return_if_fail (log != NULL);
g_return_if_fail (message != NULL && message[0] != '\0');
- g_print ("%s\n", message);
-
/* Ensure file logging is thread safe */
g_mutex_lock (log->mutex);
@@ -103,26 +97,45 @@
g_mutex_unlock (log->mutex);
}
+static void
+tracker_log_handler (const gchar *domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ if (((log_level & G_LOG_LEVEL_DEBUG) && log->verbosity < 3) ||
+ ((log_level & G_LOG_LEVEL_INFO) && log->verbosity < 2) ||
+ ((log_level & G_LOG_LEVEL_MESSAGE) && log->verbosity < 1)) {
+ return;
+ }
+
+ log_output (message);
+
+ /* now show the message through stdout/stderr as usual */
+ g_log_default_handler (domain, log_level, message, user_data);
+}
+
void
-tracker_log_init (const gchar *filename,
- gint verbosity,
- gboolean abort_on_error)
+tracker_log_init (const gchar *domain,
+ const gchar *filename,
+ gint verbosity)
{
+ g_return_if_fail (domain != NULL);
g_return_if_fail (filename != NULL);
-
+
if (log != NULL) {
- tracker_error ("Logger already initialized (%s)", log->filename);
+ g_warning ("Logger already initialized (%s)", log->filename);
return;
}
log = g_new0 (TrackerLog, 1);
-
- log->verbosity = verbosity;
-
+ log->domain = g_strdup (domain);
log->filename = g_strdup (filename);
-
log->mutex = g_mutex_new ();
- log->abort_on_error = abort_on_error;
+ log->verbosity = verbosity;
+
+ log_handler_id = g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL,
+ tracker_log_handler, log);
}
void
@@ -130,91 +143,14 @@
{
g_return_if_fail (log != NULL);
+ g_log_remove_handler (NULL, log_handler_id);
+ log_handler_id = 0;
+
g_mutex_free (log->mutex);
+ g_free (log->domain);
g_free (log->filename);
-
g_free (log);
/* Reset the log pointer so we can re-initialise if we want */
log = NULL;
}
-
-void
-tracker_log (const char *message, ...)
-{
- va_list args;
- gchar *str;
-
- g_return_if_fail (log != NULL);
-
- if (log->verbosity < 1) {
- return;
- }
-
- va_start (args, message);
- str = g_strdup_vprintf (message, args);
- va_end (args);
-
- log_output (str);
- g_free (str);
-}
-
-void
-tracker_info (const char *message, ...)
-{
- va_list args;
- gchar *str;
-
- g_return_if_fail (log != NULL);
-
- if (log->verbosity < 2) {
- return;
- }
-
- va_start (args, message);
- str = g_strdup_vprintf (message, args);
- va_end (args);
-
- log_output (str);
- g_free (str);
-}
-
-void
-tracker_debug (const char *message, ...)
-{
- va_list args;
- gchar *str;
-
- g_return_if_fail (log != NULL);
-
- if (log->verbosity < 3) {
- return;
- }
-
- va_start (args, message);
- str = g_strdup_vprintf (message, args);
- va_end (args);
-
- log_output (str);
- g_free (str);
-}
-
-void
-tracker_error (const char *message, ...)
-{
- va_list args;
- gchar *str;
-
- g_return_if_fail (log != NULL);
-
- va_start (args, message);
- str = g_strdup_vprintf (message, args);
- va_end (args);
-
- log_output (str);
- g_free (str);
-
- if (log->abort_on_error) {
- g_assert (FALSE);
- }
-}
Modified: branches/xesam-support/src/libtracker-common/tracker-log.h
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-log.h (original)
+++ branches/xesam-support/src/libtracker-common/tracker-log.h Tue May 20 08:18:14 2008
@@ -26,18 +26,10 @@
G_BEGIN_DECLS
-void tracker_log_init (const char *filename,
- gint verbosity,
- gboolean abort_on_error);
+void tracker_log_init (const gchar *domain,
+ const char *filename,
+ gint verbosity);
void tracker_log_term (void);
-void tracker_log (const char *message,
- ...);
-void tracker_info (const char *message,
- ...);
-void tracker_debug (const char *message,
- ...);
-void tracker_error (const char *message,
- ...);
G_END_DECLS
Modified: branches/xesam-support/src/libtracker-common/tracker-nfs-lock.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-nfs-lock.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-nfs-lock.c Tue May 20 08:18:14 2008
@@ -79,7 +79,7 @@
}
if (!is_initialized()) {
- tracker_error ("Could not initialise NFS lock");
+ g_critical ("Could not initialise NFS lock");
return FALSE;
}
@@ -119,7 +119,7 @@
}
error:
- tracker_error ("Could not get NFS lock state");
+ g_critical ("Could not get NFS lock state");
g_free (tmp_file);
return FALSE;
@@ -134,8 +134,8 @@
return;
}
- if (!is_initialized()) {
- tracker_error ("Could not initialise NFS lock");
+ if (!is_initialized ()) {
+ g_critical ("Could not initialise NFS lock");
return;
}
@@ -164,8 +164,8 @@
tmp_filepath = g_build_filename (root_dir, g_get_host_name (), NULL);
}
- tracker_log ("NFS lock initialised %s",
- use_nfs_safe_locking ? "" : "(safe locking not in use)");
+ g_message ("NFS lock initialised %s",
+ use_nfs_safe_locking ? "" : "(safe locking not in use)");
}
void
@@ -183,5 +183,5 @@
g_free (tmp_filepath);
}
- tracker_log ("NFS lock finalised");
+ g_message ("NFS lock finalised");
}
Modified: branches/xesam-support/src/libtracker-common/tracker-os-dependant-unix.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-os-dependant-unix.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-os-dependant-unix.c Tue May 20 08:18:14 2008
@@ -135,7 +135,7 @@
#endif
if (fail) {
- tracker_error ("Error trying to set memory limit");
+ g_critical ("Error trying to set memory limit");
}
return !fail;
@@ -153,7 +153,7 @@
cpu_limit.rlim_max = timeout + 1;
if (setrlimit (RLIMIT_CPU, &cpu_limit) != 0) {
- tracker_error ("Failed to set resource limit for CPU");
+ g_critical ("Failed to set resource limit for CPU");
}
set_memory_rlimits ();
@@ -167,7 +167,7 @@
* so we have to check value of errno too. Stupid...
*/
if (nice (19) == -1 && errno) {
- tracker_error ("Failed to set nice value");
+ g_warning ("Failed to set nice value");
}
/* Have this as a precaution in cases where cpu limit has not
Modified: branches/xesam-support/src/libtracker-common/tracker-type-utils.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-type-utils.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-type-utils.c Tue May 20 08:18:14 2008
@@ -423,9 +423,9 @@
}
if (*timestamp++ != 'T') {
- tracker_error ("ERROR: date validation failed for %s st %c",
- timestamp,
- *timestamp);
+ g_critical ("Date validation failed for '%s' st '%c'",
+ timestamp,
+ *timestamp);
return -1;
}
Modified: branches/xesam-support/src/libtracker-db/Makefile.am
==============================================================================
--- branches/xesam-support/src/libtracker-db/Makefile.am (original)
+++ branches/xesam-support/src/libtracker-db/Makefile.am Tue May 20 08:18:14 2008
@@ -4,6 +4,7 @@
$(GMIME_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(QDBM_CFLAGS) \
+ -DG_LOG_DOMAIN=\"Ttracker\" \
-I$(top_srcdir)/src
noinst_LTLIBRARIES = libtracker-db.la
@@ -23,6 +24,4 @@
$(GLIB2_LIBS) \
$(GMIME_LIBS) \
$(SQLITE3_LIBS) \
- $(QDBM_LIBS) \
- $(top_builddir)/src/libtracker-common/libtracker-common.la
-
+ $(QDBM_LIBS)
Modified: branches/xesam-support/src/libtracker-db/tracker-db-file-info.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-file-info.c (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-file-info.c Tue May 20 08:18:14 2008
@@ -285,7 +285,8 @@
}
} else {
- tracker_error ("ERROR: info->uri could not be converted to locale format");
+ g_warning ("URI:'%s' could not be converted to locale format",
+ info->uri);
return NULL;
}
Modified: branches/xesam-support/src/tracker-indexer/modules/files.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/modules/files.c (original)
+++ branches/xesam-support/src/tracker-indexer/modules/files.c Tue May 20 08:18:14 2008
@@ -17,13 +17,16 @@
* Boston, MA 02110-1301, USA.
*/
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <libtracker-common/tracker-config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include <libtracker-common/tracker-config.h>
+#include <libtracker-common/tracker-file-utils.h>
+
#define METADATA_FILE_NAME_DELIMITED "File:NameDelimited"
#define METADATA_FILE_EXT "File:Ext"
#define METADATA_FILE_PATH "File:Path"
@@ -65,6 +68,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/xesam-support/src/tracker-indexer/tracker-indexer-module.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer-module.c (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer-module.c Tue May 20 08:18:14 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/xesam-support/src/tracker-indexer/tracker-indexer-module.h
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer-module.h (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer-module.h Tue May 20 08:18:14 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/xesam-support/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer.c Tue May 20 08:18:14 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
Modified: branches/xesam-support/src/trackerd/Makefile.am
==============================================================================
--- branches/xesam-support/src/trackerd/Makefile.am (original)
+++ branches/xesam-support/src/trackerd/Makefile.am Tue May 20 08:18:14 2008
@@ -101,6 +101,8 @@
tracker-email.h \
tracker-email-utils.c \
tracker-email-utils.h \
+ tracker-field.c \
+ tracker-field.h \
tracker-indexer.c \
tracker-indexer.h \
tracker-index-stage.c \
@@ -110,6 +112,8 @@
tracker-marshal-main.c \
tracker-metadata.c \
tracker-metadata.h \
+ tracker-ontology.c \
+ tracker-ontology.h \
tracker-parser.c \
tracker-parser.h \
tracker-process-files.c \
@@ -122,8 +126,6 @@
tracker-utils.h \
tracker-service.c \
tracker-service.h \
- tracker-service-manager.c \
- tracker-service-manager.h \
tracker-ioprio.c \
tracker-ioprio.h \
tracker-os-dependant.h \
Modified: branches/xesam-support/src/trackerd/tracker-apps.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-apps.c (original)
+++ branches/xesam-support/src/trackerd/tracker-apps.c Tue May 20 08:18:14 2008
@@ -44,8 +44,7 @@
/* Add user defined applications path to service directory list */
if (dir) {
- tracker_log ("Registering path %s as belonging to service Applications", dir);
- tracker_service_directories_add ("Applications", dir);
+ tracker_ontology_add_dir_to_service_type ("Applications", dir);
g_free (dir);
}
@@ -58,17 +57,14 @@
gint i;
for (i = 0; dir_array[i] != NULL; ++i) {
dir = g_strdup_printf ("%s/applications", dir_array[i]);
- tracker_info ("Registering path %s as belonging to service Applications", dir);
- tracker_service_directories_add ("Applications", dir);
+ tracker_ontology_add_dir_to_service_type ("Applications", dir);
g_free (dir);
}
g_strfreev (dir_array);
} else {
- tracker_log ("Registering path %s as belonging to service Applications", "/usr/local/share/applications");
- tracker_log ("Registering path %s as belonging to service Applications", "/usr/share/applications");
- tracker_service_directories_add ("Applications", "/usr/local/share/applications");
- tracker_service_directories_add ("Applications", "/usr/share/applications");
+ tracker_ontology_add_dir_to_service_type ("Applications", "/usr/local/share/applications");
+ tracker_ontology_add_dir_to_service_type ("Applications", "/usr/share/applications");
}
}
}
Modified: branches/xesam-support/src/trackerd/tracker-cache.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-cache.c (original)
+++ branches/xesam-support/src/trackerd/tracker-cache.c Tue May 20 08:18:14 2008
@@ -258,9 +258,9 @@
return;
}
- tracker_log ("Flushing all words - total hits in cache is %d, total words %d",
- tracker->word_detail_count,
- tracker->word_count);
+ g_message ("Flushing all words - total hits in cache is %d, total words %d",
+ tracker->word_detail_count,
+ tracker->word_count);
/* If word count is small then flush to main index rather than
* a new temp index.
@@ -274,7 +274,7 @@
*/
if (tracker_indexer_size (tracker->file_index) > 4000000) {
index_con.file_index = create_merge_index ("file-index.tmp.");
- tracker_log ("flushing to %s", tracker_indexer_get_name (index_con.file_index));
+ g_message ("flushing to %s", tracker_indexer_get_name (index_con.file_index));
using_file_tmp = TRUE;
} else {
index_con.file_index = tracker->file_index;
@@ -282,7 +282,7 @@
if (tracker_indexer_size (tracker->email_index) > 4000000) {
index_con.email_index = create_merge_index ("email-index.tmp.");
- tracker_log ("flushing to %s", tracker_indexer_get_name (index_con.email_index));
+ g_message ("flushing to %s", tracker_indexer_get_name (index_con.email_index));
using_email_tmp = TRUE;
} else {
index_con.email_index = tracker->email_index;
@@ -448,7 +448,7 @@
}
if (tracker->grace_period > 1) {
- tracker_log ("Pausing indexer while client requests/disk I/O take place");
+ g_message ("Pausing indexer while client requests/disk I/O take place");
tracker->request_waiting = FALSE;
Modified: branches/xesam-support/src/trackerd/tracker-db-email.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db-email.c (original)
+++ branches/xesam-support/src/trackerd/tracker-db-email.c Tue May 20 08:18:14 2008
@@ -66,7 +66,7 @@
tracker_exec_proc (db_con, "InsertMboxDetails", str_mail_app, str_mail_type, filename, path, uri_prefix, NULL);
- tracker_log ("Registered email store %s of type %s", filename, types[mail_type]);
+ g_message ("Registered email store %s of type %s", filename, types[mail_type]);
g_free (str_mail_app);
g_free (str_mail_type);
@@ -267,7 +267,7 @@
g_free (str_delete_count);
} else {
- tracker_error ("ERROR: invalid dir_path \"%s\"", dir_path);
+ g_critical ("invalid dir_path \"%s\"", dir_path);
}
}
@@ -284,7 +284,7 @@
if (offset == -1) {
/* we need to add this mbox */
- tracker_error ("ERROR: mbox/dir for emails for %s is not registered", mbox_file_path);
+ g_critical ("mbox/dir for emails for %s is not registered", mbox_file_path);
}
return offset;
@@ -298,7 +298,7 @@
g_return_if_fail (mf);
if (!mf->path) {
- tracker_error ("ERROR: invalid mbox (empty path!)");
+ g_critical ("invalid mbox (empty path!)");
return;
}
@@ -312,7 +312,7 @@
g_free (str_offset);
} else {
- tracker_error ("ERROR: invalid mbox \"%s\"", mf->path);
+ g_critical ("invalid mbox \"%s\"", mf->path);
}
}
@@ -428,24 +428,24 @@
g_return_val_if_fail (mm, FALSE);
if (!mm->uri) {
- tracker_error ("ERROR: email has no uri");
+ g_critical ("email has no uri");
return FALSE;
}
if (!mm->subject) {
- tracker_log ("WARNING: email with uri: %s has no subject",mm->uri);
+ g_message ("WARNING: email with uri: %s has no subject",mm->uri);
mm->subject = g_strdup("");
}
if (mm->parent_mail_file && !mm->parent_mail_file->path) {
- tracker_error ("ERROR: badly formatted email - abandoning index");
+ g_critical ("badly formatted email - abandoning index");
return FALSE;
}
if (mm->store) {
mm->store->mail_count++;
} else {
- tracker_error ("WARNING: no mail store found for email");
+ g_critical ("no mail store found for email");
}
if (mm->deleted || mm->junk) {
@@ -460,7 +460,7 @@
mm->store->junk_count++;
}
} else {
- tracker_error ("WARNING: no mail store found for email");
+ g_critical ("no mail store found for email");
}
return TRUE;
@@ -472,7 +472,7 @@
if (mm->is_mbox) {
mbox_id = tracker_db_email_get_mbox_id (db_con, mm->parent_mail_file->path);
if (mbox_id == -1) {
- tracker_error ("ERROR: no mbox is registered for email %s", mm->uri);
+ g_critical ("no mbox is registered for email %s", mm->uri);
return TRUE;
}
}
@@ -488,9 +488,9 @@
attachment_service = get_attachment_service_name (mail_app);
}
- type_id = tracker_service_manager_get_id_for_service (service);
+ type_id = tracker_ontology_get_id_for_service_type (service);
if (type_id == -1) {
- tracker_error ("ERROR: service %s not found", service);
+ g_critical ("service %s not found", service);
g_free (attachment_service);
g_free (service);
g_free (mime);
@@ -513,8 +513,8 @@
gchar *str_id, *str_date;
GSList *tmp;
-
- tracker_info ("saving email service %d with uri \"%s\" and subject \"%s\" from \"%s\"", type_id, mm->uri, mm->subject, mm->from);
+ g_message ("Saving email service:%d with uri:'%s' and subject:'%s' from:'%s'",
+ type_id, mm->uri, mm->subject, mm->from);
index_table = g_hash_table_new (g_str_hash, g_str_equal);
str_id = tracker_int_to_string (id);
@@ -691,7 +691,8 @@
attachment_info->mime = g_strdup (ma->mime);
uri = g_strconcat (mm->uri, "/", ma->attachment_name, NULL);
- tracker_info ("indexing attachment with uri %s and mime %s", uri, attachment_info->mime);
+ g_message ("Indexing attachment with uri:'%s' and mime:'%s'",
+ uri, attachment_info->mime);
tracker_db_index_file (db_con, attachment_info, uri, attachment_service);
g_free (uri);
@@ -709,7 +710,7 @@
}
} else {
- tracker_error ("ERROR: failed to save email %s", mm->uri);
+ g_critical ("failed to save email %s", mm->uri);
}
g_free (attachment_service);
@@ -735,7 +736,7 @@
g_return_if_fail (db_con);
g_return_if_fail (mm);
- tracker_log ("update email with uri \"%s\" and subject \"%s\" from \"%s\"", mm->uri, mm->subject, mm->from);
+ g_message ("update email with uri \"%s\" and subject \"%s\" from \"%s\"", mm->uri, mm->subject, mm->from);
/* FIXME: add code... */
}
@@ -764,7 +765,7 @@
return FALSE;
}
- tracker_info ("deleting email %s", uri);
+ g_message ("Deleting email:'%s'", uri);
tracker_db_delete_directory (db_con, atoi (id), uri);
Modified: branches/xesam-support/src/trackerd/tracker-db-sqlite.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db-sqlite.c (original)
+++ branches/xesam-support/src/trackerd/tracker-db-sqlite.c Tue May 20 08:18:14 2008
@@ -44,7 +44,7 @@
#include "tracker-metadata.h"
#include "tracker-utils.h"
#include "tracker-watch.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-query-tree.h"
#include "tracker-xesam.h"
#include "tracker-main.h"
@@ -354,7 +354,7 @@
GValue result = { 0, };
gchar *str;
- str = tracker_service_manager_get_service_by_id (g_value_get_int (&values[0]));
+ str = tracker_ontology_get_service_type_by_id (g_value_get_int (&values[0]));
g_value_init (&result, G_TYPE_STRING);
g_value_take_string (&result, str);
@@ -369,7 +369,7 @@
GValue result = { 0, };
gint id;
- id = tracker_service_manager_get_id_for_service (g_value_get_string (&values[0]));
+ id = tracker_ontology_get_id_for_service_type (g_value_get_string (&values[0]));
g_value_init (&result, G_TYPE_INT);
g_value_set_int (&result, id);
@@ -384,7 +384,7 @@
GValue result = { 0, };
gint id;
- id = tracker_service_manager_get_id_for_service (g_value_get_string (&values[0]));
+ id = tracker_ontology_get_id_for_service_type (g_value_get_string (&values[0]));
g_value_init (&result, G_TYPE_INT);
g_value_set_int (&result, id);
@@ -399,7 +399,7 @@
filename = tracker_db_manager_get_sql_file (sql_file);
if (!g_file_get_contents (filename, &query, NULL, NULL)) {
- tracker_error ("ERROR: Tracker cannot read required file %s - Please reinstall tracker or check read permissions on the file if it exists", sql_file);
+ g_critical ("Can not read SQL file:'%s', please reinstall tracker or check read permissions on the file if it exists", sql_file);
g_assert (FALSE);
} else {
char **queries, **queries_p ;
@@ -411,7 +411,7 @@
}
g_strfreev (queries);
g_free (query);
- tracker_log ("loaded sql file %s", sql_file);
+ g_message ("Loaded SQL file:'%s'", sql_file);
}
g_free (filename);
@@ -455,10 +455,8 @@
groups = g_key_file_get_groups (key_file, NULL);
for (group = groups; *group; group++) {
-
-
- tracker_log ("Trying to obtain service %s in cache", *group);
- service = tracker_service_manager_get_service (*group);
+ g_message ("Trying to obtain service:'%s' in cache", *group);
+ service = tracker_ontology_get_service_type_by_name (*group);
if (!service) {
tracker_db_exec_proc (iface, "InsertServiceType", *group, NULL);
@@ -568,7 +566,7 @@
gchar *service_file, *str_id;
gchar **groups, **keys;
gchar **group, **key;
- FieldDef *def;
+ const TrackerField *def;
gint id;
gchar *DataTypeArray[11] = {"Keyword", "Indexable", "CLOB",
"String", "Integer", "Double",
@@ -591,13 +589,14 @@
for (group = groups; *group; group++) {
- def = tracker_db_get_field_def (*group);
+ def = tracker_ontology_get_field_def (*group);
if (!def) {
tracker_db_exec_proc (iface, "InsertMetadataType", *group, NULL);
id = tracker_db_interface_sqlite_get_last_insert_id (TRACKER_DB_INTERFACE_SQLITE (iface));
} else {
- id = atoi (def->id);
+ id = atoi (tracker_field_get_id (def));
+ g_error ("Duplicated metadata description %s", *group);
}
str_id = tracker_uint_to_string (id);
@@ -723,27 +722,6 @@
}
-
-FieldDef *
-tracker_db_get_field_def (const char *field_name)
-{
- FieldDef *def;
- char *name;
-
- name = g_utf8_strdown (field_name, -1);
- def = g_hash_table_lookup (tracker->metadata_table, name);
- g_free (name);
-
- return def;
-}
-
-
-void
-tracker_db_free_field_def (FieldDef *def)
-{
-}
-
-
gboolean
tracker_db_load_prepared_queries (void)
{
@@ -754,7 +732,7 @@
gchar *sql_filename;
gdouble secs;
- tracker_log ("Loading prepared queries...");
+ g_message ("Loading prepared queries...");
prepared_queries = g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -768,9 +746,9 @@
mapped_file = g_mapped_file_new (sql_filename, FALSE, &error);
if (error || !mapped_file) {
- tracker_debug ("Could not get contents of SQL file:'%s', %s",
- sql_filename,
- error ? error->message : "no error given");
+ g_warning ("Could not get contents of SQL file:'%s', %s",
+ sql_filename,
+ error ? error->message : "no error given");
if (mapped_file) {
g_mapped_file_free (mapped_file);
@@ -782,9 +760,9 @@
return FALSE;
}
- tracker_debug ("Opened prepared queries file:'%s' size:%" G_GSIZE_FORMAT " bytes",
- sql_filename,
- g_mapped_file_get_length (mapped_file));
+ g_message ("Loaded prepared queries file:'%s' size:%" G_GSIZE_FORMAT " bytes",
+ sql_filename,
+ g_mapped_file_get_length (mapped_file));
queries = g_strsplit (g_mapped_file_get_contents (mapped_file), "\n", -1);
g_free (sql_filename);
@@ -805,7 +783,7 @@
continue;
}
- tracker_debug (" Adding query:'%s'", details[0]);
+ g_message (" Adding query:'%s'", details[0]);
g_hash_table_insert (prepared_queries,
g_strdup (details[0]),
@@ -820,9 +798,9 @@
g_timer_destroy (t);
g_mapped_file_free (mapped_file);
- tracker_log ("Found %d prepared queries in %4.4f seconds",
- g_hash_table_size (prepared_queries),
- secs);
+ g_message ("Found %d prepared queries in %4.4f seconds",
+ g_hash_table_size (prepared_queries),
+ secs);
return TRUE;
}
@@ -833,7 +811,8 @@
if (iface) {
g_object_unref (iface);
}
- tracker_debug ("Database closed");
+
+ g_message ("Closed database");
}
@@ -861,7 +840,7 @@
if (!tracker_db_interface_sqlite_set_collation_function (TRACKER_DB_INTERFACE_SQLITE (iface),
"UTF8", utf8_collation_func)) {
- tracker_error ("ERROR: collation sequence failed");
+ g_critical ("Collation sequence failed");
}
/* create user defined functions that can be used in sql */
@@ -923,7 +902,7 @@
tracker_db_attach_db (DBConnection *db_con, TrackerDatabase database)
{
if (database != TRACKER_DB_COMMON && database != TRACKER_DB_CACHE) {
- tracker_error ("Attaching invalid db");
+ g_critical ("Attaching invalid database, expected common or cache database");
return;
}
@@ -1142,7 +1121,7 @@
db_con->data = db_con;
if (create_table) {
- tracker_log ("Creating file database... %s",
+ g_message ("Creating database for file metadata:'%s'",
tracker_db_manager_get_file (TRACKER_DB_FILE_META));
load_sql_file (db_con->db, "sqlite-service.sql");
load_sql_trigger (db_con->db, "sqlite-service-triggers.sql");
@@ -1241,8 +1220,8 @@
if (create) {
load_sql_file (db_con->db, "sqlite-contents.sql");
- tracker_log ("Creating db: %s",
- tracker_db_manager_get_file (TRACKER_DB_FILE_CONTENTS));
+ g_message ("Creating database for file content:'%s'",
+ tracker_db_manager_get_file (TRACKER_DB_FILE_CONTENTS));
}
tracker_db_interface_sqlite_create_function (db_con->db, "uncompress", function_uncompress, 1);
@@ -1274,8 +1253,8 @@
if (create_table) {
load_sql_file (db_con->db, "sqlite-contents.sql");
- tracker_log ("Creating db: %s",
- tracker_db_manager_get_file (TRACKER_DB_EMAIL_CONTENTS));
+ g_message ("Creating database for email content:'%s'",
+ tracker_db_manager_get_file (TRACKER_DB_EMAIL_CONTENTS));
}
tracker_db_interface_sqlite_create_function (db_con->db, "uncompress", function_uncompress, 1);
@@ -1381,8 +1360,8 @@
if (create_table) {
load_sql_file (db_con->db, "sqlite-cache.sql");
tracker_db_exec_no_reply (db_con->db, "ANALYZE");
- tracker_log ("Creating db: %s",
- tracker_db_manager_get_file (TRACKER_DB_CACHE));
+ g_message ("Creating database for cache:'%s'",
+ tracker_db_manager_get_file (TRACKER_DB_CACHE));
}
return db_con;
@@ -1407,9 +1386,11 @@
db_con->emails = db_con;
if (create_table) {
- tracker_log ("Creating email database...");
+ g_message ("Creating database for services:'sqlite-service.sql'");
load_sql_file (db_con->db, "sqlite-service.sql");
load_sql_trigger (db_con->db, "sqlite-service-triggers.sql");
+
+ g_message ("Creating database for email:'sqlite-email.sql'");
load_sql_file (db_con->db, "sqlite-email.sql");
tracker_db_exec_no_reply (db_con->db, "ANALYZE");
@@ -1507,8 +1488,7 @@
{
DBConnection *db_con;
- tracker_log ("Creating tracker database...");
-
+ g_message ("Creating all databases...");
/* create common db first */
@@ -1585,7 +1565,7 @@
static gint
tracker_metadata_is_key (const gchar *service, const gchar *meta_name)
{
- return tracker_service_manager_metadata_in_service (service, meta_name);
+ return tracker_ontology_metadata_key_in_service (service, meta_name);
}
@@ -1595,6 +1575,7 @@
return (strcasecmp (s1, s2) == 0);
}
+/* Replace with tracker_ontology_get_field_column_in_services */
char *
tracker_db_get_field_name (const char *service, const char *meta_name)
{
@@ -1616,21 +1597,6 @@
}
-
-char *
-tracker_db_get_display_field (FieldDef *def)
-{
- if (def->type == DATA_INDEX || def->type == DATA_STRING || def->type == DATA_DOUBLE) {
- return g_strdup ("MetaDataDisplay");
- }
-
- return g_strdup ("MetaDataValue");
-
-}
-
-
-
-
GHashTable *
tracker_db_get_file_contents_words (DBConnection *db_con, guint32 id, GHashTable *old_table)
{
@@ -1743,12 +1709,12 @@
static void
save_full_text_bytes (DBConnection *blob_db_con, const char *str_file_id, GByteArray *byte_array)
{
- FieldDef *def;
+ const gchar *id;
- def = tracker_db_get_field_def ("File:Contents");
+ id = tracker_ontology_get_field_id ("File:Contents");
- if (!def) {
- tracker_error ("WARNING: metadata not found for type %s", "File:Contents");
+ if (!id) {
+ g_warning ("Metadata not found for type:'File:Contents'");
return;
}
@@ -1756,7 +1722,7 @@
NULL,
"SaveServiceContents",
str_file_id, -1,
- def->id, -1,
+ id, -1,
byte_array->data, byte_array->len,
NULL);
}
@@ -1767,24 +1733,24 @@
{
gchar *compressed, *value = NULL;
gint bytes_compressed;
- FieldDef *def;
+ const gchar *field_id;
compressed = function_compress_string (text, length, &bytes_compressed);
if (compressed) {
- tracker_debug ("compressed full text size of %d to %d", length, bytes_compressed);
+ g_debug ("Compressed full text size of %d to %d", length, bytes_compressed);
value = compressed;
} else {
- tracker_error ("WARNING: compression has failed");
+ g_warning ("Could not compress text'%*s...', length:%d", 16, text, length);
value = g_strdup (text);
bytes_compressed = length;
}
- def = tracker_db_get_field_def ("File:Contents");
+ field_id = tracker_ontology_get_field_id ("File:Contents");
- if (!def) {
- tracker_error ("WARNING: metadata not found for type %s", "File:Contents");
+ if (!field_id) {
+ g_warning ("Metadata not found for type:'File:Contents'");
g_free (value);
return;
}
@@ -1793,7 +1759,7 @@
NULL,
"SaveServiceContents",
str_file_id, -1,
- def->id, -1,
+ field_id, -1,
value, bytes_compressed,
NULL);
g_free (value);
@@ -1817,7 +1783,7 @@
fd = tracker_file_open (file_name, TRUE);
if (fd ==-1) {
- tracker_error ("ERROR: could not open file %s", file_name);
+ g_critical ("Could not open file:'%s'", file_name);
return;
}
@@ -1826,7 +1792,7 @@
strm.opaque = Z_NULL;
if (deflateInit (&strm, Z_DEFAULT_COMPRESSION) != Z_OK) {
- tracker_error ("ERROR: could not initialise zlib");
+ g_critical ("Could not initialise zlib");
close (fd);
return;
}
@@ -1865,7 +1831,7 @@
char *end = strrchr (buffer, '\n');
if (!end) {
- tracker_log ("Could not find line break in text chunk..exiting");
+ g_warning ("Could not find line break in text chunk");
break;
}
@@ -1876,7 +1842,7 @@
buffer[buffer_length] = '\0';
if (lseek (fd, bytes_backtracked, SEEK_CUR) == -1) {
- tracker_error ("Could not seek to line break in text chunk");
+ g_warning ("Could not seek to line break in text chunk");
break;
}
@@ -1892,7 +1858,7 @@
if (!value) {
finished = FALSE;
- tracker_info ("could not convert text to valid utf8");
+ g_warning ("Could not convert text to valid UTF-8");
break;
}
@@ -1942,7 +1908,7 @@
if (ret == Z_STREAM_ERROR) {
finished = FALSE;
- tracker_error ("compression failed");
+ g_critical ("Could not compress text");
if (!use_buffer) g_free (value);
break;
}
@@ -1979,7 +1945,7 @@
save_full_text_bytes (blob_db_con, str_file_id, byte_array);
}
} else {
- tracker_info ("An error prevented full text extraction");
+ g_warning ("An error prevented full text extraction");
}
g_byte_array_free (byte_array, TRUE);
@@ -2122,7 +2088,7 @@
g_free (path);
g_object_unref (result_set);
} else {
- tracker_log ("dud hit for search detected");
+ g_warning ("Dud hit for search detected");
/* add to dud list */
duds = g_slist_prepend (duds, &hit);
}
@@ -2175,32 +2141,41 @@
TrackerDBResultSet *
tracker_db_search_metadata (DBConnection *db_con, const char *service, const char *field, const char *text, int offset, int limit)
{
- FieldDef *def;
+ const TrackerField *def;
TrackerDBResultSet *result_set;
g_return_val_if_fail ((service && field && text), NULL);
- def = tracker_db_get_field_def (field);
+ def = tracker_ontology_get_field_def (field);
if (!def) {
- tracker_error ("ERROR: metadata not found for type %s", field);
+ g_warning ("Metadata not found for type:'%s'", field);
return NULL;
}
- switch (def->type) {
+ /* FIXME This method was broken: Using wrong tables!?!?!?!?!? */
+ switch (tracker_field_get_data_type (def)) {
- case 0:
- case 1: result_set = tracker_exec_proc (db_con, "SearchMetadata", def->id, text, NULL); break;
+ case TRACKER_FIELD_TYPE_KEYWORD:
+ case TRACKER_FIELD_TYPE_INDEX:
+ result_set = tracker_exec_proc (db_con, "SearchMetadata", tracker_field_get_id (def), text, NULL);
+ break;
- case 2:
- case 3: result_set = tracker_exec_proc (db_con, "SearchMetadataNumeric", def->id, text, NULL); break;
+ case TRACKER_FIELD_TYPE_FULLTEXT:
+ case TRACKER_FIELD_TYPE_STRING:
+ result_set = tracker_exec_proc (db_con, "SearchMetadataNumeric", tracker_field_get_id (def), text, NULL);
+ break;
- case 5: result_set = tracker_exec_proc (db_con, "SearchMetadataKeywords", def->id, text, NULL); break;
+ case TRACKER_FIELD_TYPE_INTEGER:
+ result_set = tracker_exec_proc (db_con, "SearchMetadataKeywords", tracker_field_get_id (def), text, NULL);
+ break;
- default: tracker_error ("ERROR: metadata could not be retrieved as type %d is not supported", def->type); result_set = NULL;
+ default:
+ g_warning ("Metadata could not be retrieved as type:%d is not supported",
+ tracker_field_get_data_type (def));
+ result_set = NULL;
}
-
return result_set;
}
@@ -2217,36 +2192,38 @@
tracker_db_get_metadata (DBConnection *db_con, const char *service, const char *id, const char *key)
{
TrackerDBResultSet *result_set;
- FieldDef *def;
+ const TrackerField *def;
g_return_val_if_fail (id, NULL);
- def = tracker_db_get_field_def (key);
+ def = tracker_ontology_get_field_def (key);
if (!def) {
- tracker_error ("ERROR: metadata not found for id %s and type %s", id, key);
+ g_warning ("Metadata not found for id:'%s' and type:'%s'", id, key);
return NULL;
}
- switch (def->type) {
- case DATA_INDEX:
- case DATA_STRING:
- case DATA_DOUBLE:
- result_set = tracker_exec_proc (db_con, "GetMetadata", id, def->id, NULL);
+ switch (tracker_field_get_data_type (def)) {
+ case TRACKER_FIELD_TYPE_INDEX:
+ case TRACKER_FIELD_TYPE_STRING:
+ case TRACKER_FIELD_TYPE_DOUBLE:
+ result_set = tracker_exec_proc (db_con, "GetMetadata", id, tracker_field_get_id (def), NULL);
break;
- case DATA_INTEGER:
- case DATA_DATE:
- result_set = tracker_exec_proc (db_con, "GetMetadataNumeric", id, def->id, NULL);
+ case TRACKER_FIELD_TYPE_INTEGER:
+ case TRACKER_FIELD_TYPE_DATE:
+ result_set = tracker_exec_proc (db_con, "GetMetadataNumeric", id, tracker_field_get_id (def), NULL);
break;
- case DATA_FULLTEXT:
- result_set = tracker_exec_proc (db_con, "GetContents", id, def->id, NULL);
+ case TRACKER_FIELD_TYPE_FULLTEXT:
+ result_set = tracker_exec_proc (db_con, "GetContents", id, tracker_field_get_id (def), NULL);
break;
- case DATA_KEYWORD:
- result_set = tracker_exec_proc (db_con, "GetMetadataKeyword", id, def->id, NULL);
+ case TRACKER_FIELD_TYPE_KEYWORD:
+ result_set = tracker_exec_proc (db_con, "GetMetadataKeyword", id, tracker_field_get_id (def), NULL);
break;
default:
- tracker_error ("ERROR: metadata could not be retrieved as type %d is not supported", def->type); result_set = NULL;
+ g_warning ("Metadata could not be retrieved as type:%d is not supported",
+ tracker_field_get_data_type (def));
+ result_set = NULL;
}
return result_set;
@@ -2291,13 +2268,13 @@
static void
-update_metadata_index (const char *id, const char *service, FieldDef *def, const char *old_value, const char *new_value)
+update_metadata_index (const char *id, const char *service, const TrackerField *def, const char *old_value, const char *new_value)
{
GHashTable *old_table, *new_table;
gint sid;
if (!def) {
- tracker_error ("ERROR: cannot find details for metadata type");
+ g_warning ("Can not find details for metadata type");
return;
}
@@ -2308,30 +2285,30 @@
if (old_value) {
old_table = tracker_parser_text (old_table,
old_value,
- def->weight,
+ tracker_field_get_weight (def),
tracker->language,
tracker_config_get_max_words_to_index (tracker->config),
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->delimited);
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
}
/* parse new metadata value */
if (new_value) {
new_table = tracker_parser_text (new_table,
new_value,
- def->weight,
+ tracker_field_get_weight (def),
tracker->language,
tracker_config_get_max_words_to_index (tracker->config),
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->delimited);
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
}
/* we only do differential updates so only changed words scores are updated */
- sid = tracker_service_manager_get_id_for_service (service);
+ sid = tracker_ontology_get_id_for_service_type (service);
tracker_db_update_differential_index (old_table, new_table, id, sid);
tracker_parser_text_free (old_table);
@@ -2396,24 +2373,27 @@
char *
-tracker_get_metadata_table (DataTypes type)
+tracker_get_metadata_table (TrackerFieldType type)
{
switch (type) {
- case DATA_INDEX:
- case DATA_STRING:
- case DATA_DOUBLE:
+ case TRACKER_FIELD_TYPE_INDEX:
+ case TRACKER_FIELD_TYPE_STRING:
+ case TRACKER_FIELD_TYPE_DOUBLE:
return g_strdup ("ServiceMetaData");
- case DATA_INTEGER:
- case DATA_DATE:
+ case TRACKER_FIELD_TYPE_INTEGER:
+ case TRACKER_FIELD_TYPE_DATE:
return g_strdup ("ServiceNumericMetaData");
- case DATA_BLOB: return g_strdup("ServiceBlobMetaData");
+ case TRACKER_FIELD_TYPE_BLOB:
+ return g_strdup("ServiceBlobMetaData");
- case DATA_KEYWORD: return g_strdup("ServiceKeywordMetaData");
+ case TRACKER_FIELD_TYPE_KEYWORD:
+ return g_strdup("ServiceKeywordMetaData");
- default: return NULL;
+ default:
+ return NULL;
}
return NULL;
@@ -2460,19 +2440,20 @@
tracker_db_insert_embedded_metadata (DBConnection *db_con, const gchar *service, const gchar *id, const gchar *key, gchar **values, gint length, GHashTable *table)
{
gint key_field = 0;
+ const TrackerField *def;
if (!service || !id || !key || !values || !values[0]) {
return;
}
- FieldDef *def = tracker_db_get_field_def (key);
+ def = tracker_ontology_get_field_def (key);
if (!def) {
- tracker_error ("ERROR: metadata %s not found", key);
+ g_warning ("Metadata with key:'%s' not found", key);
return;
}
- g_return_if_fail (def->embedded);
+ g_return_if_fail (tracker_field_get_embedded (def));
if (length == -1) {
length = 0;
@@ -2481,11 +2462,11 @@
}
}
- key_field = tracker_metadata_is_key (service, key);
+ key_field = tracker_ontology_metadata_key_in_service (service, key);
- switch (def->type) {
+ switch (tracker_field_get_data_type (def)) {
- case DATA_KEYWORD: {
+ case TRACKER_FIELD_TYPE_KEYWORD: {
gint i;
for (i = 0; i < length; i++) {
if (!values[i] || !values[i][0]) {
@@ -2502,17 +2483,17 @@
FALSE,
FALSE,
FALSE);
- table = tracker_parser_text_fast (table, mvalue, def->weight);
+ table = tracker_parser_text_fast (table, mvalue, tracker_field_get_weight (def));
g_free (mvalue);
}
- tracker_exec_proc (db_con, "SetMetadataKeyword", id, def->id, values[i], NULL);
+ tracker_exec_proc (db_con, "SetMetadataKeyword", id, tracker_field_get_id (def), values[i], NULL);
}
break;
}
- case DATA_INDEX: {
+ case TRACKER_FIELD_TYPE_INDEX: {
gint i;
for (i = 0; i < length; i++) {
gchar *mvalue;
@@ -2525,22 +2506,22 @@
tracker->language,
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->filtered,
- def->delimited);
+ tracker_field_get_filtered (def),
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
if (table) {
- table = tracker_parser_text_fast (table, mvalue, def->weight);
+ table = tracker_parser_text_fast (table, mvalue, tracker_field_get_weight (def));
}
- tracker_exec_proc (db_con, "SetMetadata", id, def->id, mvalue, values[i], NULL);
+ tracker_exec_proc (db_con, "SetMetadata", id, tracker_field_get_id (def), mvalue, values[i], NULL);
g_free (mvalue);
}
break;
}
- case DATA_FULLTEXT: {
+ case TRACKER_FIELD_TYPE_FULLTEXT: {
gint i;
for (i = 0; i < length; i++) {
if (!values[i] || !values[i][0]) {
@@ -2550,13 +2531,13 @@
if (table) {
table = tracker_parser_text (table,
values[i],
- def->weight,
+ tracker_field_get_weight (def),
tracker->language,
tracker_config_get_max_words_to_index (tracker->config),
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->delimited);
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
}
save_full_text (db_con->blob, id, values[i], strlen (values[i]));
@@ -2564,19 +2545,19 @@
break;
}
- case DATA_DOUBLE: {
+ case TRACKER_FIELD_TYPE_DOUBLE: {
gint i;
for (i = 0; i < length; i++) {
if (!values[i]) {
continue;
}
- tracker_exec_proc (db_con, "SetMetadata", id, def->id, " ", values[i], NULL);
+ tracker_exec_proc (db_con, "SetMetadata", id, tracker_field_get_id (def), " ", values[i], NULL);
}
break;
}
- case DATA_STRING: {
+ case TRACKER_FIELD_TYPE_STRING: {
gint i;
for (i = 0; i < length; i++) {
gchar *mvalue;
@@ -2589,29 +2570,29 @@
tracker->language,
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->filtered,
- def->delimited);
- tracker_exec_proc (db_con, "SetMetadata", id, def->id, mvalue, values[i], NULL);
+ tracker_field_get_filtered (def),
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
+ tracker_exec_proc (db_con, "SetMetadata", id, tracker_field_get_id (def), mvalue, values[i], NULL);
g_free (mvalue);
}
break;
}
- case DATA_INTEGER: {
+ case TRACKER_FIELD_TYPE_INTEGER: {
gint i;
for (i = 0; i < length; i++) {
if (!values[i]) {
continue;
}
- tracker_exec_proc (db_con, "SetMetadataNumeric", id, def->id, values[i], NULL);
+ tracker_exec_proc (db_con, "SetMetadataNumeric", id, tracker_field_get_id (def), values[i], NULL);
}
break;
}
- case DATA_DATE: {
+ case TRACKER_FIELD_TYPE_DATE: {
gint i;
for (i = 0; i < length; i++) {
if (!values[i]) {
@@ -2621,11 +2602,11 @@
gchar *mvalue = format_date (values[i]);
if (!mvalue) {
- tracker_debug ("Could not format date %s", values[i]);
+ g_warning ("Could not format date:'%s'", values[i]);
continue;
}
- tracker_exec_proc (db_con, "SetMetadataNumeric", id, def->id, mvalue, NULL);
+ tracker_exec_proc (db_con, "SetMetadataNumeric", id, tracker_field_get_id (def), mvalue, NULL);
g_free (mvalue);
}
@@ -2633,8 +2614,9 @@
break;
}
default: {
- tracker_error ("ERROR: metadata could not be set as type %d for metadata %s is not supported",
- def->type, key);
+ g_warning ("Metadata could not be set as type:%d for "
+ "metadata:'%s' is not supported",
+ tracker_field_get_data_type (def), key);
break;
}
}
@@ -2644,7 +2626,7 @@
if (values[0]) {
gchar *esc_value = NULL;
- if (def->type == DATA_DATE) {
+ if (tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_DATE) {
esc_value = format_date (values[0]);
if (!esc_value) {
@@ -2748,16 +2730,16 @@
}
-char *
-tracker_db_set_metadata (DBConnection *db_con, const char *service, const char *id, const char *key, char **values, int length, gboolean do_backup)
+gchar *
+tracker_db_set_metadata (DBConnection *db_con, const char *service, const gchar *id, const gchar *key, gchar **values, gint length, gboolean do_backup)
{
- FieldDef *def;
- char *old_value = NULL, *new_value = NULL;
- gboolean update_index;
- int key_field = 0;
- int i;
- GString *str = NULL;
- char *res_service;
+ const TrackerField *def;
+ gchar *old_value = NULL, *new_value = NULL;
+ gboolean update_index;
+ gint key_field = 0;
+ gint i;
+ GString *str = NULL;
+ gchar *res_service;
g_return_val_if_fail (id && values && key && service, NULL);
@@ -2766,10 +2748,10 @@
return NULL;
}
- def = tracker_db_get_field_def (key);
+ def = tracker_ontology_get_field_def (key);
if (!def) {
- tracker_error ("metadata type %s not found", key);
+ g_warning ("Metadata type:'%s' not found", key);
return NULL;
}
@@ -2777,18 +2759,20 @@
res_service = tracker_db_get_service_for_entity (db_con, id);
if (!res_service) {
- tracker_error ("ERROR: service not found for id %s", id);
+ g_warning ("Service not found for id:'%s'", id);
return NULL;
}
- if (def->multiple_values && length > 1) {
+ if (tracker_field_get_multiple_values (def) && length > 1) {
str = g_string_new ("");
}
- key_field = tracker_metadata_is_key (res_service, key);
- update_index = (def->type == DATA_INDEX || def->type == DATA_KEYWORD || def->type == DATA_FULLTEXT);
+ key_field = tracker_ontology_metadata_key_in_service (res_service, key);
+ update_index = (tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_INDEX
+ || tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_KEYWORD
+ || tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_FULLTEXT);
if (update_index) {
@@ -2796,26 +2780,26 @@
}
/* delete old value if metadata does not support multiple values */
- if (!def->multiple_values) {
+ if (!tracker_field_get_multiple_values (def)) {
tracker_db_delete_metadata (db_con, service, id, key, FALSE);
}
- switch (def->type) {
+ switch (tracker_field_get_data_type (def)) {
- case DATA_KEYWORD:
+ case TRACKER_FIELD_TYPE_KEYWORD:
for (i=0; i<length; i++) {
if (!values[i] || !values[i][0]) continue;
- tracker_exec_proc (db_con, "SetMetadataKeyword", id, def->id, values[i], NULL);
+ tracker_exec_proc (db_con, "SetMetadataKeyword", id, tracker_field_get_id (def), values[i], NULL);
/* backup non-embedded data for embedded services */
if (do_backup &&
- !def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_non_embedded_metadata (db_con, id, def->id, values[i]);
+ !tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_non_embedded_metadata (db_con, id, tracker_field_get_id (def), values[i]);
}
if (str) {
@@ -2824,12 +2808,12 @@
new_value = values[i];
}
- tracker_log ("saving keyword %s", values[i]);
+ g_message ("Saving keyword:'%s'", values[i]);
}
break;
- case DATA_INDEX:
+ case TRACKER_FIELD_TYPE_INDEX:
for (i = 0; i < length; i++) {
gchar *mvalue;
@@ -2846,19 +2830,19 @@
/* backup non-embedded data for embedded services */
if (do_backup &&
- !def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_non_embedded_metadata (db_con, id, def->id, values[i]);
+ !tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_non_embedded_metadata (db_con, id, tracker_field_get_id (def), values[i]);
}
mvalue = tracker_parser_text_to_string (values[i],
tracker->language,
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->filtered,
- def->delimited);
- tracker_exec_proc (db_con, "SetMetadata", id, def->id, mvalue, values[i], NULL);
+ tracker_field_get_filtered (def),
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
+ tracker_exec_proc (db_con, "SetMetadata", id, tracker_field_get_id (def), mvalue, values[i], NULL);
g_free (mvalue);
@@ -2866,7 +2850,7 @@
break;
- case DATA_FULLTEXT:
+ case TRACKER_FIELD_TYPE_FULLTEXT:
/* we do not support multiple values for fulltext clobs */
@@ -2878,7 +2862,7 @@
break;
- case DATA_STRING:
+ case TRACKER_FIELD_TYPE_STRING:
for (i = 0; i < length; i++) {
gchar *mvalue;
@@ -2889,25 +2873,25 @@
/* backup non-embedded data for embedded services */
if (do_backup &&
- !def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_non_embedded_metadata (db_con, id, def->id, values[i]);
+ !tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_non_embedded_metadata (db_con, id, tracker_field_get_id (def), values[i]);
}
mvalue = tracker_parser_text_to_string (values[i],
tracker->language,
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->filtered,
- def->delimited);
- tracker_exec_proc (db_con, "SetMetadata", id, def->id, mvalue, values[i], NULL);
+ tracker_field_get_filtered (def),
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
+ tracker_exec_proc (db_con, "SetMetadata", id, tracker_field_get_id (def), mvalue, values[i], NULL);
g_free (mvalue);
}
break;
- case DATA_DOUBLE:
+ case TRACKER_FIELD_TYPE_DOUBLE:
for (i=0; i<length; i++) {
@@ -2916,38 +2900,38 @@
/* backup non-embedded data for embedded services */
if (do_backup &&
- !def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_non_embedded_metadata (db_con, id, def->id, values[i]);
+ !tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_non_embedded_metadata (db_con, id, tracker_field_get_id (def), values[i]);
}
- tracker_exec_proc (db_con, "SetMetadata", id, def->id, " ", values[i], NULL);
+ tracker_exec_proc (db_con, "SetMetadata", id, tracker_field_get_id (def), " ", values[i], NULL);
}
break;
- case DATA_INTEGER:
+ case TRACKER_FIELD_TYPE_INTEGER:
for (i=0; i<length; i++) {
if (!values[i] || !values[i][0]) continue;
/* backup non-embedded data for embedded services */
if (do_backup &&
- !def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_non_embedded_metadata (db_con, id, def->id, values[i]);
+ !tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_non_embedded_metadata (db_con, id, tracker_field_get_id (def), values[i]);
}
- tracker_exec_proc (db_con, "SetMetadataNumeric", id, def->id, values[i], NULL);
+ tracker_exec_proc (db_con, "SetMetadataNumeric", id, tracker_field_get_id (def), values[i], NULL);
}
break;
- case DATA_DATE:
+ case TRACKER_FIELD_TYPE_DATE:
for (i=0; i<length; i++) {
@@ -2956,18 +2940,18 @@
char *mvalue = format_date (values[i]);
if (!mvalue) {
- tracker_debug ("Could not format date %s", values[i]);
+ g_warning ("Could not format date:'%s'", values[i]);
continue;
}
- tracker_exec_proc (db_con, "SetMetadataNumeric", id, def->id, mvalue, NULL);
+ tracker_exec_proc (db_con, "SetMetadataNumeric", id, tracker_field_get_id (def), mvalue, NULL);
/* backup non-embedded data for embedded services */
if (do_backup &&
- !def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_non_embedded_metadata (db_con, id, def->id, mvalue);
+ !tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_non_embedded_metadata (db_con, id, tracker_field_get_id (def), mvalue);
}
@@ -2977,8 +2961,10 @@
break;
default :
-
- tracker_error ("ERROR: metadata could not be set as type %d for metadata %s is not supported", def->type, key);
+ g_warning ("Metadata could not be set as type:%d for "
+ "metadata:'%s' is not supported",
+ tracker_field_get_data_type (def),
+ key);
break;
@@ -2993,7 +2979,7 @@
if (values[0]) {
char *esc_value = NULL;
- if (def->type == DATA_DATE) {
+ if (tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_DATE) {
esc_value = format_date (values[0]);
if (!esc_value) return NULL;
@@ -3074,36 +3060,37 @@
tracker_db_delete_metadata_value (DBConnection *db_con, const char *service, const char *id, const char *key, const char *value)
{
- char *old_value = NULL, *new_value = NULL, *mvalue;
- FieldDef *def;
- gboolean update_index;
+ char *old_value = NULL, *new_value = NULL, *mvalue;
+ const TrackerField *def;
+ gboolean update_index;
g_return_if_fail (id && key && service && db_con);
/* get type details */
- def = tracker_db_get_field_def (key);
+ def = tracker_ontology_get_field_def (key);
if (!def) {
return;
}
- if (!def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_delete_non_embedded_metadata_value (db_con, id, def->id, value);
+ if (!tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_delete_non_embedded_metadata_value (db_con, id, tracker_field_get_id (def), value);
}
char *res_service = tracker_db_get_service_for_entity (db_con, id);
if (!res_service) {
- tracker_error ("ERROR: entity not found");
+ g_warning ("Entity not found");
return;
}
int key_field = tracker_metadata_is_key (res_service, key);
- update_index = (def->type == DATA_INDEX || def->type == DATA_KEYWORD);
+ update_index = (tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_INDEX
+ || tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_KEYWORD);
if (update_index) {
@@ -3122,41 +3109,44 @@
/* perform deletion */
- switch (def->type) {
+ switch (tracker_field_get_data_type (def)) {
- case DATA_INDEX:
- case DATA_STRING:
+ case TRACKER_FIELD_TYPE_INDEX:
+ case TRACKER_FIELD_TYPE_STRING:
mvalue = tracker_parser_text_to_string (value,
tracker->language,
tracker_config_get_max_word_length (tracker->config),
tracker_config_get_min_word_length (tracker->config),
- def->filtered,
- def->filtered,
- def->delimited);
- tracker_exec_proc (db_con, "DeleteMetadataValue", id, def->id, mvalue, NULL);
+ tracker_field_get_filtered (def),
+ tracker_field_get_filtered (def),
+ tracker_field_get_delimited (def));
+ tracker_exec_proc (db_con, "DeleteMetadataValue", id, tracker_field_get_id (def), mvalue, NULL);
g_free (mvalue);
break;
- case DATA_DOUBLE:
- tracker_exec_proc (db_con, "DeleteMetadataValue", id, def->id, value, NULL);
+ case TRACKER_FIELD_TYPE_DOUBLE:
+ tracker_exec_proc (db_con, "DeleteMetadataValue", id, tracker_field_get_id (def), value, NULL);
break;
- case DATA_INTEGER:
- case DATA_DATE:
+ case TRACKER_FIELD_TYPE_INTEGER:
+ case TRACKER_FIELD_TYPE_DATE:
- tracker_exec_proc (db_con, "DeleteMetadataNumericValue", id, def->id, value, NULL);
+ tracker_exec_proc (db_con, "DeleteMetadataNumericValue", id, tracker_field_get_id (def), value, NULL);
break;
- case DATA_KEYWORD:
+ case TRACKER_FIELD_TYPE_KEYWORD:
- tracker_exec_proc (db_con, "DeleteMetadataKeywordValue", id, def->id, value, NULL);
+ tracker_exec_proc (db_con, "DeleteMetadataKeywordValue", id, tracker_field_get_id (def), value, NULL);
break;
default:
- tracker_error ("ERROR: metadata could not be deleted as type %d for metadata %s is not supported", def->type, key);
+ g_warning ("Metadata could not be deleted as type:%d for "
+ "metadata:'%s' is not supported",
+ tracker_field_get_data_type (def),
+ key);
break;
@@ -3212,43 +3202,41 @@
tracker_db_delete_metadata (DBConnection *db_con, const char *service, const char *id, const char *key, gboolean update_indexes)
{
char *old_value = NULL;
- FieldDef *def;
+ const TrackerField *def;
gboolean update_index;
g_return_if_fail (id && key && service && db_con);
/* get type details */
- def = tracker_db_get_field_def (key);
+ def = tracker_ontology_get_field_def(key);
if (!def) {
return;
}
- if (!def->embedded &&
- tracker_service_manager_is_service_embedded (service)) {
- backup_delete_non_embedded_metadata (db_con, id, def->id);
+ if (!tracker_field_get_embedded (def) &&
+ tracker_ontology_service_type_has_embedded (service)) {
+ backup_delete_non_embedded_metadata (db_con, id, tracker_field_get_id (def));
}
char *res_service = tracker_db_get_service_for_entity (db_con, id);
if (!res_service) {
- tracker_error ("ERROR: entity not found");
+ g_warning ("Entity not found");
return;
}
int key_field = tracker_metadata_is_key (res_service, key);
- update_index = update_indexes && (def->type == DATA_INDEX || def->type == DATA_KEYWORD);
+ update_index = update_indexes && (tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_INDEX || tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_KEYWORD);
if (update_index) {
/* get current value */
old_value = tracker_db_get_metadata_delimited (db_con, service, id, key);
- tracker_debug ("old value is %s", old_value);
-
}
@@ -3261,31 +3249,35 @@
/* perform deletion */
- switch (def->type) {
+ switch (tracker_field_get_data_type (def)) {
- case DATA_INDEX:
- case DATA_STRING:
- case DATA_DOUBLE:
- tracker_exec_proc (db_con, "DeleteMetadata", id, def->id, NULL);
+ case TRACKER_FIELD_TYPE_INDEX:
+ case TRACKER_FIELD_TYPE_STRING:
+ case TRACKER_FIELD_TYPE_DOUBLE:
+ tracker_exec_proc (db_con, "DeleteMetadata", id, tracker_field_get_id (def), NULL);
break;
- case DATA_INTEGER:
- case DATA_DATE:
- tracker_exec_proc (db_con, "DeleteMetadataNumeric", id, def->id, NULL);
+ case TRACKER_FIELD_TYPE_INTEGER:
+ case TRACKER_FIELD_TYPE_DATE:
+ tracker_exec_proc (db_con, "DeleteMetadataNumeric", id, tracker_field_get_id (def), NULL);
break;
- case DATA_KEYWORD:
- tracker_exec_proc (db_con, "DeleteMetadataKeyword", id, def->id, NULL);
+ case TRACKER_FIELD_TYPE_KEYWORD:
+ tracker_exec_proc (db_con, "DeleteMetadataKeyword", id, tracker_field_get_id (def), NULL);
break;
- case DATA_FULLTEXT:
+ case TRACKER_FIELD_TYPE_FULLTEXT:
- tracker_exec_proc (db_con, "DeleteContent", id, def->id, NULL);
+ tracker_exec_proc (db_con, "DeleteContent", id, tracker_field_get_id (def), NULL);
break;
default:
- tracker_error ("ERROR: metadata could not be deleted as this operation is not supported by type %d for metadata %s", def->type, key);
+ g_warning ("Metadata could not be deleted as this "
+ "operation is not supported by type:%d "
+ "for metadata:'%s'",
+ tracker_field_get_data_type (def),
+ key);
break;
}
@@ -3306,8 +3298,6 @@
TrackerDBResultSet*
tracker_db_get_live_search_hit_count (DBConnection *db_con, const gchar *search_id)
{
- tracker_debug ("GetLiveSearchHitCount");
-
/* SELECT count(*)
* FROM LiveSearches
* WHERE SearchID = ? */
@@ -3319,8 +3309,6 @@
TrackerDBResultSet*
tracker_db_get_live_search_deleted_ids (DBConnection *db_con, const gchar *search_id)
{
- tracker_debug ("GetLiveSearchDeletedIDs");
-
/* SELECT E.ServiceID
* FROM Events as E, LiveSearches as X
* WHERE E.ServiceID = X.ServiceID
@@ -3333,8 +3321,6 @@
void
tracker_db_stop_live_search (DBConnection *db_con, const gchar *search_id)
{
- tracker_debug ("LiveSearchStopSearch");
-
/* DELETE
* FROM LiveSearches as X
* WHERE E.SearchID = ? */
@@ -3374,8 +3360,6 @@
* OR X.EventType IS 'Update')
**/
- tracker_debug ("LiveSearchUpdateQuery");
-
return tracker_db_exec (db_con->db,
/* COLUMNS */ "SELECT E.ServiceID, E.EventType%s%s "
/* FROM_QUERY */ "%s%s LiveSearches as X, Events as E "
@@ -3397,8 +3381,6 @@
TrackerDBResultSet *
tracker_db_get_live_search_get_hit_data (DBConnection *db_con, const gchar *search_id)
{
- tracker_debug ("tracker_db_get_live_search_get_hit_data");
-
return tracker_db_exec (db_con->db,
"SELECT * FROM LiveSearches as X "
"WHERE X.SearchID = '%s'",
@@ -3408,9 +3390,7 @@
TrackerDBResultSet*
tracker_db_get_events (DBConnection *db_con)
{
- tracker_debug ("SetEventsBeingHandled");
tracker_exec_proc_no_reply (db_con->cache->db, "SetEventsBeingHandled", NULL);
- tracker_debug ("GetEvents");
return tracker_exec_proc (db_con->cache, "GetEvents", NULL);
}
@@ -3418,7 +3398,6 @@
void
tracker_db_delete_handled_events (DBConnection *db_con, TrackerDBResultSet *events)
{
- tracker_debug ("DeleteHandledEvents");
tracker_exec_proc_no_reply (db_con->cache->db, "DeleteHandledEvents", NULL);
}
@@ -3433,7 +3412,7 @@
result_set = tracker_exec_proc (db_con->common, "GetNewEventID", NULL);
if (!result_set) {
- tracker_error ("ERROR: could not create event - GetNewEventID failed");
+ g_critical ("Could not create event, GetNewEventID failed");
return 0;
}
@@ -3448,8 +3427,6 @@
g_object_unref (result_set);
/* Uses the Events table */
- tracker_debug ("CreateEvent %s", eid);
-
result_set = tracker_exec_proc (db_con->cache, "CreateEvent", eid, service_id_str, type, NULL);
id = tracker_db_interface_sqlite_get_last_insert_id (TRACKER_DB_INTERFACE_SQLITE (db_con->db));
if (result_set)
@@ -3475,11 +3452,11 @@
int service_type_id;
char *str_service_type_id, *path, *name;
- if (!info || !info->uri || !info->uri[0] || !service || !db_con) {
- tracker_error ("ERROR: cannot create service");
- return 0;
-
- }
+ g_return_val_if_fail (info, 0);
+ g_return_val_if_fail (info->uri, 0);
+ g_return_val_if_fail (info->uri[0], 0);
+ g_return_val_if_fail (service, 0);
+ g_return_val_if_fail (db_con, 0);
if (info->uri[0] == G_DIR_SEPARATOR) {
name = g_path_get_basename (info->uri);
@@ -3495,7 +3472,7 @@
result_set = tracker_exec_proc (db_con->common, "GetNewID", NULL);
if (!result_set) {
- tracker_error ("ERROR: could not create service - GetNewID failed");
+ g_critical ("Could not create service, GetNewID failed");
return 0;
}
@@ -3529,12 +3506,12 @@
str_mtime = tracker_gint32_to_string (info->mtime);
str_offset = tracker_gint32_to_string (info->offset);
- service_type_id = tracker_service_manager_get_id_for_service (service);
+ service_type_id = tracker_ontology_get_id_for_service_type (service);
if (info->mime) {
- tracker_debug ("service id for %s is %d and sid is %s with mime %s", service, service_type_id, sid, info->mime);
+ g_debug ("service id for %s is %d and sid is %s with mime %s", service, service_type_id, sid, info->mime);
} else {
- tracker_debug ("service id for %s is %d and sid is %s", service, service_type_id, sid);
+ g_debug ("service id for %s is %d and sid is %s", service, service_type_id, sid);
}
str_service_type_id = tracker_int_to_string (service_type_id);
@@ -3578,7 +3555,7 @@
if (b)
g_object_unref (b);
- parent = tracker_service_manager_get_parent_service (service);
+ parent = tracker_ontology_get_parent_service (service);
if (parent) {
b = tracker_exec_proc (db_con->common, "IncStat", parent, NULL);
@@ -3703,14 +3680,14 @@
{
gchar *service;
- service = tracker_service_manager_get_service_by_id (id);
+ service = tracker_ontology_get_service_type_by_id (id);
if (service) {
gchar *parent;
tracker_exec_proc (db_con->common, "DecStat", service, NULL);
- parent = tracker_service_manager_get_parent_service (service);
+ parent = tracker_ontology_get_parent_service (service);
if (parent) {
tracker_exec_proc (db_con->common, "DecStat", parent, NULL);
@@ -3721,7 +3698,7 @@
} else {
- tracker_debug ("could not dec stat for service ID %d", id);
+ g_debug ("could not dec stat for service ID %d", id);
}
}
@@ -3733,7 +3710,7 @@
gint service_id;
guint32 id;
- service_id = tracker_service_manager_get_id_for_service (service);
+ service_id = tracker_ontology_get_id_for_service_type (service);
if (service_id == -1) {
return NULL;
@@ -4047,7 +4024,7 @@
query = g_string_free (str, FALSE);
- tracker_debug ("getting files with mimes using sql %s", query);
+ g_debug ("getting files with mimes using sql %s", query);
result_set = tracker_db_interface_execute_query (db_con->db, NULL, query);
@@ -4071,14 +4048,14 @@
result = NULL;
result_list = NULL;
- service_array[0] = tracker_service_manager_get_id_for_service ("Files");
- service_array[1] = tracker_service_manager_get_id_for_service ("Folders");
- service_array[2] = tracker_service_manager_get_id_for_service ("Documents");
- service_array[3] = tracker_service_manager_get_id_for_service ("Images");
- service_array[4] = tracker_service_manager_get_id_for_service ("Music");
- service_array[5] = tracker_service_manager_get_id_for_service ("Videos");
- service_array[6] = tracker_service_manager_get_id_for_service ("Text");
- service_array[7] = tracker_service_manager_get_id_for_service ("Other");
+ service_array[0] = tracker_ontology_get_id_for_service_type ("Files");
+ service_array[1] = tracker_ontology_get_id_for_service_type ("Folders");
+ service_array[2] = tracker_ontology_get_id_for_service_type ("Documents");
+ service_array[3] = tracker_ontology_get_id_for_service_type ("Images");
+ service_array[4] = tracker_ontology_get_id_for_service_type ("Music");
+ service_array[5] = tracker_ontology_get_id_for_service_type ("Videos");
+ service_array[6] = tracker_ontology_get_id_for_service_type ("Text");
+ service_array[7] = tracker_ontology_get_id_for_service_type ("Other");
services = g_array_new (TRUE, TRUE, sizeof (gint));
g_array_append_vals (services, service_array, 8);
@@ -4169,14 +4146,14 @@
location_prefix = g_strconcat (location, G_DIR_SEPARATOR_S, NULL);
- service_array[0] = tracker_service_manager_get_id_for_service ("Files");
- service_array[1] = tracker_service_manager_get_id_for_service ("Folders");
- service_array[2] = tracker_service_manager_get_id_for_service ("Documents");
- service_array[3] = tracker_service_manager_get_id_for_service ("Images");
- service_array[4] = tracker_service_manager_get_id_for_service ("Music");
- service_array[5] = tracker_service_manager_get_id_for_service ("Videos");
- service_array[6] = tracker_service_manager_get_id_for_service ("Text");
- service_array[7] = tracker_service_manager_get_id_for_service ("Other");
+ service_array[0] = tracker_ontology_get_id_for_service_type ("Files");
+ service_array[1] = tracker_ontology_get_id_for_service_type ("Folders");
+ service_array[2] = tracker_ontology_get_id_for_service_type ("Documents");
+ service_array[3] = tracker_ontology_get_id_for_service_type ("Images");
+ service_array[4] = tracker_ontology_get_id_for_service_type ("Music");
+ service_array[5] = tracker_ontology_get_id_for_service_type ("Videos");
+ service_array[6] = tracker_ontology_get_id_for_service_type ("Text");
+ service_array[7] = tracker_ontology_get_id_for_service_type ("Other");
services = g_array_new (TRUE, TRUE, sizeof (gint));
g_array_append_vals (services, service_array, 8);
@@ -4268,14 +4245,14 @@
location_prefix = g_strconcat (location, G_DIR_SEPARATOR_S, NULL);
- service_array[0] = tracker_service_manager_get_id_for_service ("Files");
- service_array[1] = tracker_service_manager_get_id_for_service ("Folders");
- service_array[2] = tracker_service_manager_get_id_for_service ("Documents");
- service_array[3] = tracker_service_manager_get_id_for_service ("Images");
- service_array[4] = tracker_service_manager_get_id_for_service ("Music");
- service_array[5] = tracker_service_manager_get_id_for_service ("Videos");
- service_array[6] = tracker_service_manager_get_id_for_service ("Text");
- service_array[7] = tracker_service_manager_get_id_for_service ("Other");
+ service_array[0] = tracker_ontology_get_id_for_service_type ("Files");
+ service_array[1] = tracker_ontology_get_id_for_service_type ("Folders");
+ service_array[2] = tracker_ontology_get_id_for_service_type ("Documents");
+ service_array[3] = tracker_ontology_get_id_for_service_type ("Images");
+ service_array[4] = tracker_ontology_get_id_for_service_type ("Music");
+ service_array[5] = tracker_ontology_get_id_for_service_type ("Videos");
+ service_array[6] = tracker_ontology_get_id_for_service_type ("Text");
+ service_array[7] = tracker_ontology_get_id_for_service_type ("Other");
services = g_array_new (TRUE, TRUE, sizeof (gint));
g_array_append_vals (services, service_array, 8);
@@ -4414,12 +4391,12 @@
tracker_db_move_file (DBConnection *db_con, const char *moved_from_uri, const char *moved_to_uri)
{
- tracker_log ("Moving file %s to %s", moved_from_uri, moved_to_uri);
+ g_message ("Moving file:'%s' to:'%s'", moved_from_uri, moved_to_uri);
/* if orig file not in DB, treat it as a create action */
guint32 id = tracker_db_get_file_id (db_con, moved_from_uri);
if (id == 0) {
- tracker_debug ("WARNING: original file %s not found in DB", moved_from_uri);
+ g_warning ("Original file:'%s' not found in database", moved_from_uri);
tracker_db_insert_pending_file (db_con, id, moved_to_uri, NULL, "unknown", 0, TRACKER_DB_ACTION_WRITABLE_FILE_CLOSED, FALSE, TRUE, -1);
tracker_db_interface_end_transaction (db_con->db);
return;
@@ -4577,7 +4554,7 @@
new_path = g_build_filename (moved_to_uri, sep, NULL);
g_free (sep);
- tracker_info ("moving subfolder %s to %s", dir_name, new_path);
+ g_message ("Moving subfolder:'%s' to:'%s'", dir_name, new_path);
move_directory (db_con, dir_name, new_path);
@@ -4652,7 +4629,7 @@
if (score == 0) return;
- tracker_debug ("updating index for word %s with score %d", word, score);
+ g_debug ("Updating index for word %s with score %d", word, score);
tracker_cache_add (word, info->service_id, info->service_type_id, score, FALSE);
@@ -4734,7 +4711,6 @@
tracker_db_get_keyword_list (DBConnection *db_con, const char *service)
{
- tracker_debug (service);
return tracker_exec_proc (db_con, "GetKeywordList", service, service, NULL);
}
@@ -4868,6 +4844,47 @@
return service;
}
+static TrackerField *
+db_row_to_field_def (TrackerDBResultSet *result_set) {
+
+ TrackerField *field_def;
+ TrackerFieldType field_type;
+ gchar *field_name, *name;
+ gint weight, id;
+ gboolean embedded, multiple_values, delimited, filtered, store_metadata;
+
+ field_def = tracker_field_new ();
+
+ tracker_db_result_set_get (result_set,
+ 0, &id,
+ 1, &name,
+ 2, &field_type,
+ 3, &field_name,
+ 4, &weight,
+ 5, &embedded,
+ 6, &multiple_values,
+ 7, &delimited,
+ 8, &filtered,
+ 9, &store_metadata,
+ -1);
+
+ tracker_field_set_id (field_def, tracker_int_to_string (id));
+ tracker_field_set_name (field_def, name);
+ tracker_field_set_field_name (field_def, field_name);
+ tracker_field_set_weight (field_def, weight);
+ tracker_field_set_embedded (field_def, embedded);
+ tracker_field_set_multiple_values (field_def, multiple_values);
+ tracker_field_set_delimited (field_def, delimited);
+ tracker_field_set_filtered (field_def, filtered);
+ tracker_field_set_store_metadata (field_def, store_metadata);
+
+ g_free (field_name);
+ g_free (name);
+
+ return field_def;
+}
+
+
/* get static data like metadata field definitions and services definitions and load them into hashtables */
void
tracker_db_get_static_data (DBConnection *db_con)
@@ -4884,49 +4901,33 @@
while (valid) {
TrackerDBResultSet *result_set2;
- gboolean embedded, multiple_values, delimited, filtered, store_metadata;
- FieldDef *def;
-
- def = g_new0 (FieldDef, 1);
-
- tracker_db_result_set_get (result_set,
- 0, &id,
- 1, &name,
- 2, &def->type,
- 3, &def->field_name,
- 4, &def->weight,
- 5, &embedded,
- 6, &multiple_values,
- 7, &delimited,
- 8, &filtered,
- 9, &store_metadata,
- -1);
+ TrackerField *def;
+ GSList *child_ids = NULL;
- def->id = tracker_int_to_string (id);
- def->embedded = embedded;
- def->multiple_values = multiple_values;
- def->delimited = delimited;
- def->filtered = filtered;
- def->store_metadata = store_metadata;
+ def = db_row_to_field_def (result_set);
- result_set2 = tracker_exec_proc (db_con, "GetMetadataAliases", def->id, NULL);
+ result_set2 = tracker_exec_proc (db_con, "GetMetadataAliases", tracker_field_get_id (def), NULL);
if (result_set2) {
valid = TRUE;
while (valid) {
tracker_db_result_set_get (result_set2, 1, &id, -1);
- def->child_ids = g_slist_prepend (def->child_ids,
- tracker_int_to_string (id));
+ child_ids = g_slist_prepend (child_ids,
+ tracker_int_to_string (id));
valid = tracker_db_result_set_iter_next (result_set2);
}
+ tracker_field_set_child_ids (def, child_ids);
g_object_unref (result_set2);
}
- g_hash_table_insert (tracker->metadata_table, g_utf8_strdown (name, -1), def);
- tracker_debug ("loading metadata def %s with weight %d", def->field_name, def->weight);
+ g_message ("Loading metadata def:'%s' with weight:%d",
+ tracker_field_get_name (def),
+ tracker_field_get_weight (def));
+
+ tracker_ontology_add_field (def);
g_free (name);
@@ -4963,10 +4964,13 @@
mimes = tracker_db_get_mimes_for_service_id (db_con, id);
mime_prefixes = tracker_db_get_mime_prefixes_for_service_id (db_con, id);
- tracker_debug ("Adding service definition for %s with id %d", name, id);
- tracker_service_manager_add_service (service,
- mimes,
- mime_prefixes);
+ g_message ("Adding service:'%s' with id:%d and mimes:%d",
+ name,
+ id,
+ g_slist_length (mimes));
+ tracker_ontology_add_service_type (service,
+ mimes,
+ mime_prefixes);
g_slist_free (mimes);
g_slist_free (mime_prefixes);
@@ -4978,8 +4982,8 @@
g_object_unref (result_set);
/* check for web history */
- if (!tracker_service_manager_get_service ("Webhistory")) {
- tracker_log ("Adding missing Webhistory service");
+ if (!tracker_ontology_get_service_type_by_name ("Webhistory")) {
+ g_message ("Adding missing Webhistory service");
tracker_exec_proc (db_con, "InsertServiceType", "Webhistory", NULL);
}
}
@@ -4990,7 +4994,7 @@
{
TrackerDBType type;
- type = tracker_service_manager_get_db_for_service (service);
+ type = tracker_ontology_get_db_for_service_type (service);
if (type == TRACKER_DB_TYPE_EMAIL) {
return db_con->emails;
@@ -5016,44 +5020,10 @@
return result;
}
-
-gboolean
-tracker_db_metadata_is_child (DBConnection *db_con, const char *child, const char *parent)
-{
- FieldDef *def_child, *def_parent;
-
- def_child = tracker_db_get_field_def (child);
-
- if (!def_child) {
- return FALSE;
- }
-
-
- def_parent = tracker_db_get_field_def (parent);
-
- if (!def_parent) {
- return FALSE;
- }
-
- GSList *tmp;
-
- for (tmp = def_parent->child_ids; tmp; tmp = tmp->next) {
-
- if (!tmp->data) return FALSE;
-
- if (strcmp (def_child->id, tmp->data) == 0) {
- return TRUE;
- }
- }
-
- return FALSE;
-
-}
-
// FIXME Do this in a non-retarded way
gboolean
-get_service_mapping(DBConnection *db_con, const char *type, GList **list)
+get_service_mapping (DBConnection *db_con, const char *type, GList **list)
{
TrackerDBResultSet *result_set;
gboolean valid = TRUE;
@@ -5409,11 +5379,8 @@
FieldData *
tracker_db_get_metadata_field (DBConnection *db_con, const char *service, const char *field_name, int field_count, gboolean is_select, gboolean is_condition)
{
- FieldData *field_data;
-
- field_data = NULL;
-
- FieldDef *def;
+ FieldData *field_data = NULL;
+ const TrackerField *def;
field_data = g_new0 (FieldData, 1);
@@ -5421,15 +5388,15 @@
field_data->is_condition = is_condition;
field_data->field_name = g_strdup (field_name);
- def = tracker_db_get_field_def (field_name);
+ def = tracker_ontology_get_field_def (field_name);
if (def) {
- field_data->table_name = tracker_get_metadata_table (def->type);
+ field_data->table_name = tracker_get_metadata_table (tracker_field_get_data_type (def));
field_data->alias = g_strdup_printf ("M%d", field_count);
- field_data->data_type = def->type;
- field_data->id_field = g_strdup (def->id);
- field_data->multiple_values = def->multiple_values;
+ field_data->data_type = tracker_field_get_data_type (def);
+ field_data->id_field = g_strdup (tracker_field_get_id (def));
+ field_data->multiple_values = tracker_field_get_multiple_values (def);
char *my_field = tracker_db_get_field_name (service, field_name);
@@ -5438,21 +5405,18 @@
g_free (my_field);
field_data->needs_join = FALSE;
} else {
- char *disp_field = tracker_db_get_display_field (def);
+ char *disp_field = tracker_ontology_get_display_field (def);
field_data->select_field = g_strdup_printf ("M%d.%s", field_count, disp_field);
g_free (disp_field);
field_data->needs_join = TRUE;
}
- if (def->type == DATA_DOUBLE) {
+ if (tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_DOUBLE) {
field_data->where_field = g_strdup_printf ("M%d.MetaDataDisplay", field_count);
} else {
field_data->where_field = g_strdup_printf ("M%d.MetaDataValue", field_count);
}
-
- tracker_db_free_field_def (def);
-
} else {
g_free (field_data);
return NULL;
@@ -5574,10 +5538,10 @@
if (tracker->index_count > 1) {
tracker_db_end_index_transaction (db_con);
tracker_db_start_index_transaction (db_con);
- tracker_log ("Current memory usage is %d, word count %d and hits %d",
- get_memory_usage (),
- tracker->word_count,
- tracker->word_detail_count);
+ g_message ("Current memory usage is %d, word count %d and hits %d",
+ get_memory_usage (),
+ tracker->word_count,
+ tracker->word_detail_count);
}
return TRUE;
Modified: branches/xesam-support/src/trackerd/tracker-db-sqlite.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db-sqlite.h (original)
+++ branches/xesam-support/src/trackerd/tracker-db-sqlite.h Tue May 20 08:18:14 2008
@@ -26,7 +26,7 @@
#include <libtracker-db/tracker-db-interface.h>
#include <libtracker-db/tracker-db-file-info.h>
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-indexer.h"
#include "tracker-utils.h"
@@ -46,46 +46,18 @@
Indexer *word_index;
};
-typedef enum {
- DATA_KEYWORD,
- DATA_INDEX,
- DATA_FULLTEXT,
- DATA_STRING,
- DATA_INTEGER,
- DATA_DOUBLE,
- DATA_DATE,
- DATA_BLOB,
- DATA_STRUCT,
- DATA_LINK
-} DataTypes;
-
-typedef struct {
- char *id;
- DataTypes type;
- char *field_name;
- int weight;
- guint embedded : 1;
- guint multiple_values : 1;
- guint delimited : 1;
- guint filtered : 1;
- guint store_metadata : 1;
-
- GSList *child_ids; /* related child metadata ids */
-
-} FieldDef;
-
typedef struct {
- char *alias;
- char *field_name;
- char *select_field;
- char *where_field;
- char *table_name;
- char *id_field;
- DataTypes data_type;
- guint multiple_values : 1;
- guint is_select : 1;
- guint is_condition : 1;
- guint needs_join : 1;
+ char *alias;
+ char *field_name;
+ char *select_field;
+ char *where_field;
+ char *table_name;
+ char *id_field;
+ TrackerFieldType data_type;
+ guint multiple_values : 1;
+ guint is_select : 1;
+ guint is_condition : 1;
+ guint needs_join : 1;
} FieldData;
@@ -167,7 +139,7 @@
gint limit);
gchar * tracker_get_related_metadata_names (DBConnection *db_con,
const gchar *name);
-gchar * tracker_get_metadata_table (DataTypes type);
+gchar * tracker_get_metadata_table (TrackerFieldType type);
TrackerDBResultSet *tracker_db_search_text (DBConnection *db_con,
const gchar *service,
const gchar *search_string,
@@ -333,9 +305,6 @@
const gchar *service);
gchar * tracker_db_get_service_for_entity (DBConnection *db_con,
const gchar *id);
-gboolean tracker_db_metadata_is_child (DBConnection *db_con,
- const gchar *child,
- const gchar *parent);
GHashTable * tracker_db_get_file_contents_words (DBConnection *db_con,
guint32 id,
GHashTable *old_table);
@@ -346,7 +315,6 @@
gchar * tracker_db_get_field_name (const gchar *service,
const gchar *meta_name);
-gchar * tracker_db_get_display_field (FieldDef *def);
void tracker_free_metadata_field (FieldData *field_data);
void tracker_db_delete_service (DBConnection *db_con,
Modified: branches/xesam-support/src/trackerd/tracker-db.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db.c (original)
+++ branches/xesam-support/src/trackerd/tracker-db.c Tue May 20 08:18:14 2008
@@ -35,7 +35,7 @@
#include "tracker-db.h"
#include "tracker-email.h"
#include "tracker-metadata.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-process-files.h"
extern Tracker *tracker;
@@ -227,7 +227,7 @@
db_action = user_data;
/* auto-tag keyword related metadata */
- if (tracker_db_metadata_is_child (db_action->db_con, mtype, "DC:Keywords")) {
+ if (tracker_ontology_field_is_child_of (mtype, "DC:Keywords")) {
GSList *tmp;
for (tmp = value; tmp; tmp = tmp->next) {
@@ -360,23 +360,19 @@
gboolean
tracker_metadata_is_date (DBConnection *db_con, const char *meta)
{
- FieldDef *def;
- gboolean res;
+ const TrackerField *def;
- def = tracker_db_get_field_def (meta);
+ def = tracker_ontology_get_field_def (meta);
if (!def) {
- tracker_error ("ERROR: failed to get info for metadata type %s", meta);
+ g_critical ("failed to get info for metadata type %s", meta);
return FALSE;
}
-
+
+ /* FIXME: It is the same check again! */
g_return_val_if_fail (def, FALSE);
- res = (def->type == DATA_DATE);
-
- tracker_db_free_field_def (def);
-
- return res;
+ return tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_DATE;
}
@@ -468,7 +464,7 @@
g_thread_yield ();
g_usleep (10);
- tracker_debug ("In check phase");
+ g_debug ("In check phase");
}
}
@@ -489,7 +485,7 @@
if (!move_file && ((counter > 0) || (g_async_queue_length (tracker->file_process_queue) > tracker->max_process_queue_size))) {
- /* tracker_log ("************ counter for pending file %s is %d ***********", uri, counter); */
+ /* g_message ("************ counter for pending file %s is %d ***********", uri, counter); */
if (!mime) {
tracker_db_insert_pending (db_con, str_file_id, str_action, str_counter, uri, "unknown", is_directory, is_new, service_type_id);
} else {
@@ -529,7 +525,7 @@
return;
}
- /* tracker_log ("inserting pending file for %s with action %s", uri, tracker_actions[action]); */
+ /* g_message ("inserting pending file for %s with action %s", uri, tracker_actions[action]); */
/* signal respective thread that data is available and awake it if its asleep */
if (action == TRACKER_DB_ACTION_EXTRACT_METADATA) {
@@ -632,14 +628,15 @@
head = g_queue_peek_head_link (tracker->file_change_queue);
- tracker_log ("File Change queue is:");
+ g_message ("File Change queue is:");
count = 1;
for (l = g_list_first (head); l != NULL; l = g_list_next (l)) {
change = (TrackerDBFileChange*) l->data;
- tracker_info ("%d\t%s\t%d\t%d",
- count++, change->uri,
- change->first_change_time,
- change->num_of_change);
+ g_message ("%d\t%s\t%d\t%d",
+ count++,
+ change->uri,
+ (gint) change->first_change_time,
+ change->num_of_change);
}
}
@@ -732,7 +729,7 @@
/* add uri to blacklist */
- tracker_log ("blacklisting %s", change->uri);
+ g_message ("blacklisting %s", change->uri);
tracker_process_files_append_temp_black_list (change->uri);
@@ -843,7 +840,7 @@
db_action = user_data;
string_list = tracker_gslist_to_string_list (value);
- tracker_log ("restoring keyword list with %d items", g_slist_length (value));
+ g_message ("restoring keyword list with %d items", g_slist_length (value));
tracker_db_set_metadata (db_action->db_con, db_action->service, db_action->file_id, mtype, string_list, g_slist_length (value), FALSE);
@@ -862,9 +859,9 @@
if (!service) {
/* its an external service - TODO get external service name */
if (service) {
- tracker_log ("External service %s not supported yet", service);
+ g_message ("External service %s not supported yet", service);
} else {
- tracker_log ("External service not supported yet");
+ g_message ("External service not supported yet");
}
return;
}
@@ -875,10 +872,10 @@
uri = attachment_uri;
}
- info->service_type_id = tracker_service_manager_get_id_for_service (service);
+ info->service_type_id = tracker_ontology_get_id_for_service_type (service);
if (info->service_type_id == -1) {
- tracker_log ("Service %s not supported yet", service);
+ g_message ("Service %s not supported yet", service);
return;
}
@@ -888,14 +885,18 @@
if (info->is_new) {
if (info->mime)
- tracker_info ("Indexing %s with service %s and mime %s (new)", uri, service, info->mime);
+ g_message ("Indexing:'%s' with service:'%s' and mime:'%s' (new)",
+ uri, service, info->mime);
else
- tracker_info ("Indexing %s with service %s (new)", uri, service);
+ g_message ("Indexing:'%s' with service:'%s' (new)",
+ uri, service);
} else {
if (info->mime)
- tracker_info ("Indexing %s with service %s and mime %s (existing)", uri, service, info->mime);
+ g_message ("Indexing:'%s' with service:'%s' and mime:'%s' (existing)",
+ uri, service, info->mime);
else
- tracker_info ("Indexing %s with service %s (existing)", uri, service);
+ g_message ("Indexing:'%s' with service:'%s' (existing)",
+ uri, service);
}
@@ -927,12 +928,12 @@
info->uri = old_uri;
if (info->file_id == 0) {
- tracker_error ("ERROR: could not get file id for %s - unable to continue indexing this file", uri);
+ g_critical ("Could not get file id for:'%s', unable to continue indexing this file", uri);
return;
}
if (info->service_type_id == -1) {
- tracker_error ("ERROR: unknown service type for %s with service %s and mime %s", uri, service, info->mime);
+ g_critical ("Unknown service type for:'%s' with service:'%s' and mime %s", uri, service, info->mime);
}
}
@@ -977,7 +978,7 @@
}
if (attachment_service) {
- info->service_type_id = tracker_service_manager_get_id_for_service (attachment_service);
+ info->service_type_id = tracker_ontology_get_id_for_service_type (attachment_service);
}
/* save stuff to Db */
@@ -1041,7 +1042,7 @@
1, &value,
-1);
- tracker_log ("found backup metadata for %s\%s with key %s and value %s", path, name, key, value);
+ g_message ("found backup metadata for %s\%s with key %s and value %s", path, name, key, value);
tracker_add_metadata_to_table (meta_table, key, value);
valid = tracker_db_result_set_iter_next (result_set);
@@ -1097,7 +1098,7 @@
strcmp (curr_ext+1, "xmp") != 0 &&
!g_str_has_suffix (curr_ext+1, "~")) {
- tracker_debug ("master file, %s, about to be updated", curr_filename);
+ g_debug ("master file, %s, about to be updated", curr_filename);
master_uri = g_build_filename (dirname, curr_filename, NULL);
master_info = tracker_db_file_info_new (master_uri, TRACKER_DB_ACTION_FILE_CHANGED, 0, 0);
@@ -1146,9 +1147,10 @@
info->mime = g_strdup ("unknown");
}
- tracker_info ("mime is %s for %s", info->mime, info->uri);
+ g_message ("Mime is:'%s' for:'%s'",
+ info->mime, info->uri);
- service_name = tracker_service_manager_get_service_type_for_mime (info->mime);
+ service_name = tracker_ontology_get_service_type_for_mime (info->mime);
}
@@ -1169,7 +1171,7 @@
ext = strrchr (filename, '.');
if (ext) {
ext++;
- tracker_debug ("file extension is %s", ext);
+ g_debug ("file extension is %s", ext);
tracker_add_metadata_to_table (meta_table, g_strdup ("File:Ext"), g_strdup (ext));
is_sidecar = strcmp("xmp",ext) == 0;
} else {
@@ -1199,7 +1201,7 @@
char buf[512];
fgets(buf,512,fp); //get the first line, it is URL for this web history object
- tracker_debug("URL for this WebHistory is %s\n",buf);
+ g_debug("URL for this WebHistory is %s\n",buf);
tracker_add_metadata_to_table (meta_table, g_strdup ("Doc:URL"), g_strdup(buf));
fgets(buf,512,fp);
@@ -1216,7 +1218,7 @@
char *doc_keyword = g_strdup (keys[1]);
- tracker_debug("found keywords : %s\n",doc_keyword);
+ g_debug("found keywords : %s\n",doc_keyword);
tracker_add_metadata_to_table (meta_table, g_strdup ("Doc:Keywords"), doc_keyword);
}
@@ -1243,17 +1245,17 @@
service_has_metadata =
(is_external_service ||
(is_file_indexable &&
- tracker_service_manager_has_metadata (service_name))) &&
+ tracker_ontology_service_type_has_metadata (service_name))) &&
!is_sidecar;
service_has_fulltext =
(is_external_service ||
(is_file_indexable &&
- tracker_service_manager_has_text (service_name))) &&
+ tracker_ontology_service_type_has_text (service_name))) &&
!is_sidecar;
service_has_thumbs =
(is_external_service ||
(is_file_indexable &&
- tracker_service_manager_has_thumbnails (service_name)));
+ tracker_ontology_service_type_has_thumbnails (service_name)));
#ifdef HAVE_EXEMPI
if (!info->is_directory) {
@@ -1272,7 +1274,7 @@
gchar *sidecar_uri = g_build_filename (dirname, sidecar_filename, NULL);
if (g_file_test (sidecar_uri, G_FILE_TEST_EXISTS)) {
- tracker_debug ("xmp sidecar found for %s", uri);
+ g_debug ("xmp sidecar found for %s", uri);
tracker_metadata_get_embedded (sidecar_uri, XMP_MIME_TYPE, meta_table);
}
@@ -1283,7 +1285,7 @@
}
#endif
- tracker_debug ("file %s has fulltext %d with service %s", info->uri, service_has_fulltext, service_name);
+ g_debug ("file %s has fulltext %d with service %s", info->uri, service_has_fulltext, service_name);
tracker_db_index_service (db_con, info, service_name, meta_table, uri, attachment_service, service_has_metadata, service_has_fulltext, service_has_thumbs);
g_hash_table_destroy (meta_table);
Modified: branches/xesam-support/src/trackerd/tracker-db.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db.h (original)
+++ branches/xesam-support/src/trackerd/tracker-db.h Tue May 20 08:18:14 2008
@@ -60,8 +60,6 @@
guint32 file_id);
gchar ** tracker_db_get_files_in_folder (DBConnection *db_con,
const gchar *folder_uri);
-FieldDef * tracker_db_get_field_def (const gchar *field_name);
-void tracker_db_free_field_def (FieldDef *def);
gboolean tracker_metadata_is_date (DBConnection *db_con,
const gchar *meta);
TrackerDBFileInfo *tracker_db_get_pending_file (DBConnection *db_con,
Modified: branches/xesam-support/src/trackerd/tracker-dbus-daemon.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-daemon.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-daemon.c Tue May 20 08:18:14 2008
@@ -431,41 +431,41 @@
priv->tracker->pause_manual = value;
if (value) {
- tracker_log ("Tracker daemon has been paused by user");
+ g_message ("Tracker daemon has been paused by user");
} else {
- tracker_log ("Tracker daemon has been resumed by user");
+ g_message ("Tracker daemon has been resumed by user");
}
} else if (strcasecmp (option, "FastMerges") == 0) {
tracker_config_set_fast_merges (priv->config, value);
- tracker_log ("Fast merges set to %d", value);
+ g_message ("Fast merges set to %d", value);
} else if (strcasecmp (option, "EnableIndexing") == 0) {
signal_state_change = TRUE;
tracker_config_set_enable_indexing (priv->config, value);
- tracker_log ("Enable indexing set to %d", value);
+ g_message ("Enable indexing set to %d", value);
} else if (strcasecmp (option, "EnableWatching") == 0) {
tracker_config_set_enable_watches (priv->config, value);
- tracker_log ("Enable Watching set to %d", value);
+ g_message ("Enable Watching set to %d", value);
} else if (strcasecmp (option, "LowMemoryMode") == 0) {
tracker_config_set_low_memory_mode (priv->config, value);
- tracker_log ("Extra memory usage set to %d", !value);
+ g_message ("Extra memory usage set to %d", !value);
} else if (strcasecmp (option, "IndexFileContents") == 0) {
tracker_config_set_enable_content_indexing (priv->config, value);
- tracker_log ("Index file contents set to %d", value);
+ g_message ("Index file contents set to %d", value);
} else if (strcasecmp (option, "GenerateThumbs") == 0) {
tracker_config_set_enable_thumbnails (priv->config, value);
- tracker_log ("Generate thumbnails set to %d", value);
+ g_message ("Generate thumbnails set to %d", value);
} else if (strcasecmp (option, "IndexMountedDirectories") == 0) {
tracker_config_set_index_mounted_directories (priv->config, value);
- tracker_log ("Indexing mounted directories set to %d", value);
+ g_message ("Indexing mounted directories set to %d", value);
} else if (strcasecmp (option, "IndexRemovableDevices") == 0) {
tracker_config_set_index_removable_devices (priv->config, value);
- tracker_log ("Indexing removable devices set to %d", value);
+ g_message ("Indexing removable devices set to %d", value);
} else if (strcasecmp (option, "BatteryIndex") == 0) {
tracker_config_set_disable_indexing_on_battery (priv->config, !value);
- tracker_log ("Disable index on battery set to %d", !value);
+ g_message ("Disable index on battery set to %d", !value);
} else if (strcasecmp (option, "BatteryIndexInitial") == 0) {
tracker_config_set_disable_indexing_on_battery_init (priv->config, !value);
- tracker_log ("Disable initial index sweep on battery set to %d", !value);
+ g_message ("Disable initial index sweep on battery set to %d", !value);
}
if (signal_state_change) {
@@ -516,13 +516,13 @@
if (strcasecmp (option, "Throttle") == 0) {
tracker_config_set_throttle (priv->config, value);
- tracker_log ("throttle set to %d", value);
+ g_message ("throttle set to %d", value);
} else if (strcasecmp (option, "MaxText") == 0) {
tracker_config_set_max_text_to_index (priv->config, value);
- tracker_log ("Maxinum amount of text set to %d", value);
+ g_message ("Maxinum amount of text set to %d", value);
} else if (strcasecmp (option, "MaxWords") == 0) {
tracker_config_set_max_words_to_index (priv->config, value);
- tracker_log ("Maxinum number of unique words set to %d", value);
+ g_message ("Maxinum number of unique words set to %d", value);
}
tracker_notify_file_data_available ();
@@ -549,7 +549,7 @@
priv = GET_PRIV (object);
- tracker_log ("Tracker daemon attempting to restart");
+ g_message ("Tracker daemon attempting to restart");
priv->tracker->reindex = reindex;
Modified: branches/xesam-support/src/trackerd/tracker-dbus-files.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-files.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-files.c Tue May 20 08:18:14 2008
@@ -33,7 +33,7 @@
#include "tracker-dbus-files.h"
#include "tracker-db.h"
#include "tracker-metadata.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-marshal.h"
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_DBUS_FILES, TrackerDBusFilesPriv))
@@ -184,7 +184,7 @@
service = g_strdup ("Files");
} else {
info->mime = tracker_file_get_mime_type (uri);
- service = tracker_service_manager_get_service_type_for_mime (info->mime);
+ service = tracker_ontology_get_service_type_for_mime (info->mime);
info = tracker_db_file_info_get (info);
}
@@ -256,7 +256,7 @@
path = tracker_file_get_vfs_path (info->uri);
}
- service = tracker_service_manager_get_service_type_for_mime (mime);
+ service = tracker_ontology_get_service_type_for_mime (mime);
file_id = tracker_db_create_service (db_con, service, info);
tracker_db_file_info_free (info);
@@ -470,7 +470,7 @@
mime);
/* Get service from mime */
- *value = tracker_service_manager_get_service_type_for_mime (mime);
+ *value = tracker_ontology_get_service_type_for_mime (mime);
tracker_dbus_request_comment (request_id,
"Info for file '%s', "
@@ -673,7 +673,7 @@
offset,
max_hits);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -875,7 +875,7 @@
TrackerDBResultSet *result_set;
guint request_id;
DBConnection *db_con;
- FieldDef *defs[255];
+ const TrackerField *defs[255];
guint i;
gchar *uri_filtered;
guint32 file_id;
@@ -903,7 +903,7 @@
/* Get fields for metadata list provided */
for (i = 0; i < g_strv_length (fields); i++) {
- defs[i] = tracker_db_get_field_def (fields[i]);
+ defs[i] = tracker_ontology_get_field_def (fields[i]);
if (!defs[i]) {
tracker_dbus_request_failed (request_id,
@@ -951,7 +951,7 @@
} else {
gchar *display_field;
- display_field = tracker_db_get_display_field (defs[i]);
+ display_field = tracker_ontology_get_display_field (defs[i]);
g_string_append_printf (sql, ", M%d.%s ", i, display_field);
g_free (display_field);
needs_join[i - 1] = TRUE;
@@ -969,7 +969,7 @@
continue;
}
- table = tracker_get_metadata_table (defs[i]->type);
+ table = tracker_get_metadata_table (tracker_field_get_data_type (defs[i]));
g_string_append_printf (sql,
" LEFT OUTER JOIN %s M%d ON "
@@ -979,7 +979,7 @@
i+1,
i+1,
i+1,
- defs[i]->id);
+ tracker_field_get_id (defs[i]));
g_free (table);
}
Modified: branches/xesam-support/src/trackerd/tracker-dbus-keywords.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-keywords.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-keywords.c Tue May 20 08:18:14 2008
@@ -196,7 +196,7 @@
"service:'%s'",
service);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -247,7 +247,7 @@
service,
uri);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -320,7 +320,7 @@
service,
uri);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -353,7 +353,7 @@
tracker_notify_file_data_available ();
for (p = values; *p; p++) {
- tracker_log ("Added keyword %s to %s with ID %s", *p, uri, id);
+ g_message ("Added keyword %s to %s with ID %s", *p, uri, id);
g_signal_emit (object, signals[KEYWORD_ADDED], 0, service, uri, *p);
}
@@ -391,7 +391,7 @@
service,
uri);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -421,7 +421,7 @@
tracker_notify_file_data_available ();
for (p = values; *p; p++) {
- tracker_log ("Removed keyword %s from %s with ID %s", *p, uri, id);
+ g_message ("Removed keyword %s from %s with ID %s", *p, uri, id);
tracker_db_delete_metadata_value (db_con, service, id, "User:Keywords", *p);
/* FIXME: Should we be doing this for EACH keyword? */
@@ -463,7 +463,7 @@
service,
uri);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -540,7 +540,7 @@
offset,
max_hits);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -601,7 +601,7 @@
g_string_free (select, TRUE);
g_string_free (where, TRUE);
- tracker_debug (query);
+ g_debug (query);
result_set = tracker_db_interface_execute_query (db_con->db, NULL, query);
*values = tracker_dbus_query_result_to_strv (result_set, NULL);
Modified: branches/xesam-support/src/trackerd/tracker-dbus-metadata.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-metadata.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-metadata.c Tue May 20 08:18:14 2008
@@ -177,7 +177,7 @@
db_con = priv->db_con;
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -268,7 +268,7 @@
query = g_string_free (sql, FALSE);
- tracker_debug (query);
+ g_debug (query);
result_set = tracker_db_interface_execute_query (db_con->db, NULL, query);
*values = tracker_dbus_query_result_to_strv (result_set, NULL);
@@ -322,7 +322,7 @@
"service:'%s'",
service);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
Modified: branches/xesam-support/src/trackerd/tracker-dbus-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-search.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-search.c Tue May 20 08:18:14 2008
@@ -34,7 +34,7 @@
#include "tracker-rdf-query.h"
#include "tracker-query-tree.h"
#include "tracker-indexer.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-marshal.h"
#define DEFAULT_SEARCH_MAX_HITS 1024
@@ -619,7 +619,7 @@
service,
search_text);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -637,23 +637,23 @@
/* Check we have the right database connection */
db_con = tracker_db_get_service_connection (db_con, service);
- services[count++] = tracker_service_manager_get_id_for_service (service);
+ services[count++] = tracker_ontology_get_id_for_service_type (service);
if (strcmp (service, "Files") == 0) {
- services[count++] = tracker_service_manager_get_id_for_service ("Folders");
- services[count++] = tracker_service_manager_get_id_for_service ("Documents");
- services[count++] = tracker_service_manager_get_id_for_service ("Images");
- services[count++] = tracker_service_manager_get_id_for_service ("Videos");
- services[count++] = tracker_service_manager_get_id_for_service ("Music");
- services[count++] = tracker_service_manager_get_id_for_service ("Text");
- services[count++] = tracker_service_manager_get_id_for_service ("Development");
- services[count++] = tracker_service_manager_get_id_for_service ("Other");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Folders");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Documents");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Images");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Videos");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Music");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Text");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Development");
+ services[count++] = tracker_ontology_get_id_for_service_type ("Other");
} else if (strcmp (service, "Emails") == 0) {
- services[count++] = tracker_service_manager_get_id_for_service ("EvolutionEmails");
- services[count++] = tracker_service_manager_get_id_for_service ("KMailEmails");
- services[count++] = tracker_service_manager_get_id_for_service ("ThunderbirdEmails");
+ services[count++] = tracker_ontology_get_id_for_service_type ("EvolutionEmails");
+ services[count++] = tracker_ontology_get_id_for_service_type ("KMailEmails");
+ services[count++] = tracker_ontology_get_id_for_service_type ("ThunderbirdEmails");
} else if (strcmp (service, "Conversations") == 0) {
- services[count++] = tracker_service_manager_get_id_for_service ("GaimConversations");
+ services[count++] = tracker_ontology_get_id_for_service_type ("GaimConversations");
}
services[count] = 0;
@@ -735,7 +735,7 @@
g_value_init (&value, G_TYPE_STRING);
g_value_take_string (&value,
- tracker_service_manager_get_service_by_id (count.service_type_id));
+ tracker_ontology_get_service_type_by_id (count.service_type_id));
_tracker_db_result_set_set_value (result_set, 0, &value);
g_value_unset (&value);
@@ -796,7 +796,7 @@
offset,
max_hits);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -900,7 +900,7 @@
offset,
max_hits);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -970,7 +970,7 @@
search_text,
id);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -1123,7 +1123,7 @@
offset,
max_hits);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -1182,7 +1182,7 @@
search_text,
id);
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
@@ -1261,7 +1261,7 @@
max_hits,
sort_by_service ? "yes" : "no");
- if (!tracker_service_manager_is_valid_service (service)) {
+ if (!tracker_ontology_is_valid_service_type (service)) {
tracker_dbus_request_failed (request_id,
error,
"Service '%s' is invalid or has not been implemented yet",
Modified: branches/xesam-support/src/trackerd/tracker-dbus-xesam.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-xesam.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-xesam.c Tue May 20 08:18:14 2008
@@ -34,7 +34,7 @@
#include "tracker-rdf-query.h"
#include "tracker-query-tree.h"
#include "tracker-indexer.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-marshal.h"
enum {
Modified: branches/xesam-support/src/trackerd/tracker-dbus.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus.c (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus.c Tue May 20 08:18:14 2008
@@ -53,26 +53,26 @@
GError *error = NULL;
guint result;
- tracker_log ("Registering DBus service...\n"
- " Name '%s'",
- name);
+ g_message ("Registering DBus service...\n"
+ " Name '%s'",
+ name);
if (!org_freedesktop_DBus_request_name (proxy,
name,
DBUS_NAME_FLAG_DO_NOT_QUEUE,
&result, &error)) {
- tracker_error ("Could not aquire name: %s, %s",
- name,
- error ? error->message : "no error given");
-
+ g_critical ("Could not aquire name: %s, %s",
+ name,
+ error ? error->message : "no error given");
g_error_free (error);
+
return FALSE;
}
if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- tracker_error ("DBus service name %s is already taken, "
- "perhaps the daemon is already running?",
- name);
+ g_critical ("DBus service name '%s' is already taken, "
+ "perhaps the daemon is already running?",
+ name);
return FALSE;
}
@@ -88,9 +88,9 @@
{
GObject *object;
- tracker_log ("Registering DBus object...");
- tracker_log (" Path '%s'", path);
- tracker_log (" Type '%s'", g_type_name (object_type));
+ g_message ("Registering DBus object...");
+ g_message (" Path '%s'", path);
+ g_message (" Type '%s'", g_type_name (object_type));
object = g_object_new (object_type, NULL);
@@ -125,7 +125,9 @@
}
gboolean
-tracker_dbus_preinit (Tracker *tracker, DBusGConnection **connection_out, DBusGProxy **proxy_out)
+tracker_dbus_preinit (Tracker *tracker,
+ DBusGConnection **connection_out,
+ DBusGProxy **proxy_out)
{
DBusGConnection *connection;
DBusGProxy *proxy;
@@ -133,14 +135,13 @@
g_return_val_if_fail (tracker != NULL, FALSE);
-
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (!connection) {
- tracker_error ("Could not connect to the DBus session bus, %s",
- error ? error->message : "no error given.");
- if (error)
- g_error_free (error);
+ g_critical ("Could not connect to the DBus session bus, %s",
+ error ? error->message : "no error given.");
+ g_clear_error (&error);
+
return FALSE;
}
@@ -164,18 +165,21 @@
}
gboolean
-tracker_dbus_init (Tracker *tracker, DBusGConnection *connection, DBusGProxy *proxy)
+tracker_dbus_init (Tracker *tracker,
+ DBusGConnection *connection,
+ DBusGProxy *proxy)
{
- GObject *object;
+ GObject *object;
g_return_val_if_fail (tracker != NULL, FALSE);
+ g_return_val_if_fail (connection != NULL, FALSE);
+ g_return_val_if_fail (proxy != NULL, FALSE);
/* Don't reinitialize */
if (objects) {
return TRUE;
}
-
/* Add org.freedesktop.Tracker */
if (!(object = dbus_register_object (connection,
proxy,
@@ -500,9 +504,9 @@
str = g_strdup_vprintf (format, args);
va_end (args);
- tracker_log ("<--- [%d] %s",
- request_id,
- str);
+ g_message ("<--- [%d] %s",
+ request_id,
+ str);
g_free (str);
}
@@ -510,8 +514,8 @@
void
tracker_dbus_request_success (gint request_id)
{
- tracker_log ("---> [%d] Success, no error given",
- request_id);
+ g_message ("---> [%d] Success, no error given",
+ request_id);
}
void
@@ -529,9 +533,9 @@
g_set_error (error, TRACKER_DBUS_ERROR, 0, str);
- tracker_log ("---> [%d] Failed, %s",
- request_id,
- str);
+ g_message ("---> [%d] Failed, %s",
+ request_id,
+ str);
g_free (str);
}
@@ -547,8 +551,8 @@
str = g_strdup_vprintf (format, args);
va_end (args);
- tracker_log ("---- [%d] %s",
- request_id,
- str);
+ g_message ("---- [%d] %s",
+ request_id,
+ str);
g_free (str);
}
Modified: branches/xesam-support/src/trackerd/tracker-email-evolution.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-evolution.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-evolution.c Tue May 20 08:18:14 2008
@@ -393,7 +393,7 @@
if (g_str_has_prefix (file_name, "outbox")) goto end_index;
if (g_str_has_prefix (file_name, "drafts")) goto end_index;
- tracker_debug ("indexing email summary %s", info->uri);
+ g_debug ("indexing email summary %s", info->uri);
if (is_in_dir_local (info->uri) && g_str_has_suffix (file_name, ".ev-summary")) {
/* a MBox file changed */
@@ -402,7 +402,7 @@
mbox_file = tracker_get_radix_by_suffix (info->uri, ".ev-summary");
- tracker_debug ("summary %s is an mbox", info->uri);
+ g_debug ("summary %s is an mbox", info->uri);
/* check mbox is registered */
if (tracker_db_email_get_mbox_id (db_con, mbox_file) == -1) {
@@ -433,16 +433,16 @@
if (store && open_summary_file (info->uri, &summary)) {
SummaryFileHeader *header = NULL;
- tracker_info ("investigating summary file %s", mbox_file);
+ g_message ("Investigating summary file:'%s'", mbox_file);
if (!load_summary_file_header (summary, &header)) {
- tracker_error ("ERROR: failed to load summary file %s", info->uri);
+ g_critical ("failed to load summary file %s", info->uri);
free_summary_file (summary);
goto end_index;
}
if (!load_summary_file_meta_header_for_local (summary, header)) {
- tracker_error ("ERROR: failed to load summary header file %s", info->uri);
+ g_critical ("failed to load summary header file %s", info->uri);
free_summary_file_header (header);
free_summary_file (summary);
goto end_index;
@@ -453,18 +453,19 @@
load_uri_and_status_of_mbox_mail_message, NULL,
NULL, NULL,
store)) {
- tracker_info ("setting junk status on email file %s", mbox_file);
+ g_message ("Setting junk status on email file:'%s'",
+ mbox_file);
tracker_db_email_flag_mbox_junk (db_con, mbox_file);
} else {
tracker_db_email_set_message_counts (db_con, mbox_file, store->mail_count, store->junk_count, store->delete_count);
- tracker_debug ("Number of existing messages in %s are %d, %d junk, %d deleted and header totals are %d, %d, %d", mbox_file,
+ g_debug ("Number of existing messages in %s are %d, %d junk, %d deleted and header totals are %d, %d, %d", mbox_file,
store->mail_count, store->junk_count, store->delete_count, header->saved_count, header->junk_count, header->deleted_count);
}
free_summary_file_header (header);
free_summary_file (summary);
} else {
- tracker_error ("ERROR: failed to open summary file %s", info->uri);
+ g_critical ("failed to open summary file %s", info->uri);
}
g_free (mbox_file);
@@ -642,11 +643,11 @@
header = NULL;
- tracker_log ("Scanning summary file %s for junk", filename);
+ g_message ("Scanning summary file %s for junk", filename);
if (!load_summary_file_header (summary, &header)) {
free_summary_file (summary);
- tracker_error ("ERROR: failed to open summary file %s", filename);
+ g_critical ("failed to open summary file %s", filename);
return;
}
@@ -655,7 +656,7 @@
if (!load_summary_file_meta_header_for_local (summary, header)) {
free_summary_file_header (header);
free_summary_file (summary);
- tracker_error ("ERROR: failed to open summary header file %s", filename);
+ g_critical ("failed to open summary header file %s", filename);
return;
}
} else if (store->type == MAIL_TYPE_IMAP || store->type == MAIL_TYPE_IMAP4) {
@@ -663,11 +664,11 @@
if (!load_summary_file_meta_header_for_imap (summary, header)) {
free_summary_file_header (header);
free_summary_file (summary);
- tracker_error ("ERROR: failed to open summary header file %s", filename);
+ g_critical ("failed to open summary header file %s", filename);
return;
}
} else {
- tracker_error ("ERROR: summary file not supported");
+ g_critical ("summary file not supported");
free_summary_file_header (header);
free_summary_file (summary);
return;
@@ -701,7 +702,7 @@
}
} else {
- tracker_error ("ERROR: whilst scanning summary file");
+ g_critical ("whilst scanning summary file");
return;
break;
}
@@ -788,7 +789,7 @@
accounts = find_accounts_by_gconf (NULL);
- tracker_log ("Checking for Evolution email accounts...");
+ g_message ("Checking for Evolution email accounts...");
for (account = accounts; account; account = account->next) {
EvolutionAccount *evo_acc = account->data;
@@ -810,7 +811,7 @@
if (account_name) {
- tracker_log ("Found imap account %s", account_name);
+ g_message ("Found imap account %s", account_name);
m_conf->imap_dirs = g_slist_prepend (m_conf->imap_dirs, g_build_filename (dir_imap, account_name, NULL));
@@ -1115,7 +1116,7 @@
source_url = g_strndup (text, text_len);
- tracker_log ("Found email account uri %s", source_url);
+ g_message ("Found email account uri %s", source_url);
if (strncmp (source_url, "mbox:", 5) == 0 || strncmp (source_url, "pop", 3) == 0) {
state->account->protocol = EVOLUTION_MAIL_PROTOCOL_MBOX;
@@ -1356,7 +1357,7 @@
MailStore *store = tracker_db_email_get_mbox_details (db_con, dir);
if (!store) {
- tracker_error ("ERROR: could not retrieve store for file %s", dir);
+ g_critical ("could not retrieve store for file %s", dir);
free_summary_file (summary);
free_summary_file_header (header);
@@ -1364,7 +1365,7 @@
return;
}
- tracker_debug ("Number of existing messages in %s are %d, %d junk, %d deleted and header totals are %d, %d, %d", dir,
+ g_debug ("Number of existing messages in %s are %d, %d junk, %d deleted and header totals are %d, %d, %d", dir,
store->mail_count, store->junk_count, store->delete_count, header->saved_count, header->junk_count, header->deleted_count);
tracker->mbox_count++;
@@ -1386,7 +1387,7 @@
/* skip already indexed emails */
for (i = 0; i < store->mail_count; i++) {
if (!(*skip_mail) (summary)) {
- tracker_error ("ERROR: skipping email no. %d in summary file", i+1);
+ g_critical ("skipping email no. %d in summary file", i+1);
tracker_db_email_free_mail_store (store);
free_summary_file (summary);
free_summary_file_header (header);
@@ -1405,10 +1406,10 @@
MailMessage *mail_msg = NULL;
mail_count++;
- tracker_debug ("processing email no. %d / %" G_GINT32_FORMAT, store->mail_count + 1, header->saved_count);
+ g_debug ("processing email no. %d / %" G_GINT32_FORMAT, store->mail_count + 1, header->saved_count);
if (!(*load_mail) (summary, &mail_msg)) {
- tracker_error ("ERROR: loading email no. %d in summary file", mail_count);
+ g_critical ("loading email no. %d in summary file", mail_count);
tracker_db_email_free_mail_store (store);
free_summary_file (summary);
free_summary_file_header (header);
@@ -1428,10 +1429,10 @@
mail_msg->store = store;
if (!(*save_ondisk_mail) (db_con, mail_msg)) {
- tracker_log ("WARNING: Message, or message parts, could not be found locally - if you are using IMAP make sure you have selected the \"copy folder content locally for offline operation\" option in Evolution");
+ g_message ("WARNING: Message, or message parts, could not be found locally - if you are using IMAP make sure you have selected the \"copy folder content locally for offline operation\" option in Evolution");
/* we do not have all infos but we still save them */
if (!tracker_db_email_save_email (db_con, mail_msg, MAIL_APP_EVOLUTION)) {
- tracker_log ("Failed to save email");
+ g_message ("Failed to save email");
}
}
@@ -1460,7 +1461,7 @@
if (tracker_db_regulate_transactions (db_con->data, 500)) {
if (tracker_config_get_verbosity (tracker->config) == 1) {
- tracker_log ("indexing #%d - Emails in %s", tracker->index_count, dir);
+ g_message ("indexing #%d - Emails in %s", tracker->index_count, dir);
}
if (tracker->index_count % 1000 == 0) {
@@ -1482,7 +1483,7 @@
}
- tracker_log ("No. of new emails indexed in summary file %s is %d, %d junk, %d deleted", dir, mail_count, junk_count, delete_count);
+ g_message ("No. of new emails indexed in summary file %s is %d, %d junk, %d deleted", dir, mail_count, junk_count, delete_count);
tracker_db_email_set_message_counts (db_con, dir, store->mail_count, store->junk_count, store->delete_count);
@@ -1615,7 +1616,7 @@
continue;
}
- tracker_debug ("Account name for summary file is %s and path is %s", account_name, (*summary)->path);
+ g_debug ("Account name for summary file is %s and path is %s", account_name, (*summary)->path);
gchar *source_account_name = get_account_name_from_imap_uri (evo_acc->source_url);
@@ -1645,7 +1646,7 @@
}
default:
- tracker_error ("ERROR: no matching account found for email");
+ g_critical ("no matching account found for email");
continue;
break;
}
@@ -1704,17 +1705,17 @@
goto error;
}
- tracker_debug ("summary.version = %d", h->version);
+ g_debug ("summary.version = %d", h->version);
if (h->version > 0xff && (h->version & 0xff) < 12) {
- tracker_error ("ERROR: summary file header version too low");
+ g_critical ("summary file header version too low");
goto error;
}
h->legacy = !(h->version < 0x100 && h->version >= 13);
if (h->legacy) {
- tracker_debug ("WARNING: summary file is a legacy version");
+ g_debug ("WARNING: summary file is a legacy version");
}
@@ -1725,10 +1726,10 @@
goto error;
}
- tracker_debug ("summary.flags = %d", h->flags);
- tracker_debug ("summary.nextuid = %d", h->nextuid);
- tracker_debug ("summary.time = %d", h->time);
- tracker_debug ("summary.count = %" G_GINT32_FORMAT, h->saved_count);
+ g_debug ("summary.flags = %d", h->flags);
+ g_debug ("summary.nextuid = %d", h->nextuid);
+ g_debug ("summary.time = %d", (gint) h->time);
+ g_debug ("summary.count = %" G_GINT32_FORMAT, h->saved_count);
if (!h->legacy) {
if (!decode_gint32 (f, &h->unread_count) ||
@@ -1738,9 +1739,9 @@
}
}
- tracker_debug ("summary.Unread = %d", h->unread_count);
- tracker_debug ("summary.deleted = %d", h->deleted_count);
- tracker_debug ("summary.junk = %d", h->junk_count);
+ g_debug ("summary.Unread = %d", h->unread_count);
+ g_debug ("summary.deleted = %d", h->deleted_count);
+ g_debug ("summary.junk = %d", h->junk_count);
return TRUE;
@@ -1807,13 +1808,13 @@
}
if (version < 0) {
- tracker_error ("ERROR: summary file version too low");
+ g_critical ("summary file version too low");
return FALSE;
}
/* Right now we only support summary versions 1 through 3 */
if (version > 3) {
- tracker_error ("ERROR: reported summary version (%" G_GINT32_FORMAT ") is too new", version);
+ g_critical ("reported summary version (%" G_GINT32_FORMAT ") is too new", version);
return FALSE;
}
@@ -2324,7 +2325,7 @@
g_return_val_if_fail (db_con, FALSE);
g_return_val_if_fail (mail_msg, FALSE);
- tracker_log ("Trying to index mail \"%s\"", mail_msg->uri);
+ g_message ("Trying to index mail \"%s\"", mail_msg->uri);
if (!do_save_ondisk_email_message (db_con, mail_msg)) {
/* Mail not found... So two cases:
@@ -2344,21 +2345,21 @@
ret = FALSE;
- tracker_log ("... Trying to index mail parts");
+ g_message ("... Trying to index mail parts");
header_file = g_strconcat (mail_msg->path, "HEADER", NULL);
if (tracker_file_is_indexable (header_file)) {
/* email is on disk */
- tracker_log ("... Indexing mail parts of email \"%s\"", mail_msg->uri);
+ g_message ("... Indexing mail parts of email \"%s\"", mail_msg->uri);
ret = index_mail_parts (db_con, mail_msg, mail_msg->path);
- tracker_log ("... Treatment of mail parts of \"%s\" finished", mail_msg->uri);
+ g_message ("... Treatment of mail parts of \"%s\" finished", mail_msg->uri);
if (ret) {
tracker_db_email_save_email (db_con, mail_msg, MAIL_APP_EVOLUTION);
}
} else {
- tracker_log ("...Indexing of mail parts failed");
+ g_message ("...Indexing of mail parts failed");
}
g_free (header_file);
@@ -2366,7 +2367,7 @@
return ret;
} else {
- tracker_log ("Simple index of mail \"%s\" finished", mail_msg->uri);
+ g_message ("Simple index of mail \"%s\" finished", mail_msg->uri);
return TRUE;
}
}
@@ -2494,11 +2495,11 @@
} else{
if (tracker_file_is_indexable (m->mail_file)) {
- tracker_log ("Indexing message part \"%s\"", m->mail_file);
+ g_message ("Indexing message part \"%s\"", m->mail_file);
if (num_parts == 1 && strcmp (m->mime_infos->type, "text") == 0) {
/* it is the first mail part so it is assume to be body mail */
- tracker_log ("Message part \"%s\" will be indexed as mail body...", m->mail_file);
+ g_message ("Message part \"%s\" will be indexed as mail body...", m->mail_file);
g_file_get_contents (m->mail_file, &mail_msg->body, NULL, NULL);
} else {
@@ -2526,7 +2527,7 @@
email_add_saved_mail_attachment_to_mail_message (mail_msg, ma);
} else {
- tracker_error ("ERROR: failed to decode mail part \"%s\"", m->mail_file);
+ g_critical ("failed to decode mail part \"%s\"", m->mail_file);
email_free_mail_attachment (ma);
}
}
@@ -2827,7 +2828,7 @@
}
if (fseek (f, len - 1, SEEK_CUR) != 0) {
- tracker_error ("ERROR: seek failed for string with length %d with error code %d", len - 1, errno);
+ g_critical ("seek failed for string with length %d with error code %d", len - 1, errno);
return FALSE;
}
Modified: branches/xesam-support/src/trackerd/tracker-email-modest.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-modest.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-modest.c Tue May 20 08:18:14 2008
@@ -352,7 +352,7 @@
file_name = g_path_get_basename (info->uri);
- tracker_debug ("indexing email summary %s", info->uri);
+ g_debug ("indexing email summary %s", info->uri);
if (is_in_dir_imap (info->uri)) {
if (strcmp (file_name, "summary.mmap") == 0) {
@@ -414,11 +414,11 @@
header = NULL;
- tracker_log ("Scanning summary file %s for junk", filename);
+ g_message ("Scanning summary file %s for junk", filename);
if (!load_summary_file_header (summary, &header)) {
free_summary_file (summary);
- tracker_error ("ERROR: failed to open summary file %s", filename);
+ g_critical ("failed to open summary file %s", filename);
return;
}
@@ -426,7 +426,7 @@
if (!load_summary_file_meta_header_for_imap (summary, header)) {
free_summary_file_header (header);
free_summary_file (summary);
- tracker_error ("ERROR: failed to open summary header file %s", filename);
+ g_critical ("failed to open summary header file %s", filename);
return;
}
@@ -434,19 +434,19 @@
if (!load_summary_file_meta_header_for_pop (summary, header)) {
free_summary_file_header (header);
free_summary_file (summary);
- tracker_error ("ERROR: failed to open summary header file %s", filename);
+ g_critical ("failed to open summary header file %s", filename);
return;
}
} else if (store->type == MAIL_TYPE_MAILDIR) {
if (!load_summary_file_meta_header_for_pop (summary, header)) {
free_summary_file_header (header);
free_summary_file (summary);
- tracker_error ("ERROR: failed to open summary header file %s", filename);
+ g_critical ("failed to open summary header file %s", filename);
return;
}
} else {
- tracker_error ("ERROR: summary file not supported");
+ g_critical ("summary file not supported");
free_summary_file_header (header);
free_summary_file (summary);
return;
@@ -480,7 +480,7 @@
g_free (tmp);
if ((strcmp (d->d_name, "summary.mmap") == 0) || g_str_has_suffix (d->d_name, "summary.mmap")) {
- tracker_log ("Adding mail_dir: %s\n", name);
+ g_message ("Adding mail_dir: %s\n", name);
list = g_slist_prepend (list, g_strdup (name));
/* Question from Philip Van Hoof:
@@ -529,7 +529,7 @@
free_modest_config (*conf);
}
- tracker_log ("Checking for Modest email accounts...");
+ g_message ("Checking for Modest email accounts...");
*conf = g_slice_new0 (ModestConfig);
m_conf = *conf;
@@ -835,7 +835,7 @@
MailStore *store = tracker_db_email_get_mbox_details (db_con, dir);
if (!store) {
- tracker_error ("ERROR: could not retrieve store for file %s", dir);
+ g_critical ("could not retrieve store for file %s", dir);
free_summary_file (summary);
free_summary_file_header (header);
@@ -843,7 +843,7 @@
return;
}
- tracker_debug ("Number of existing messages in %s are %d, %d junk, %d deleted and header totals are %d, %d, %d", dir,
+ g_debug ("Number of existing messages in %s are %d, %d junk, %d deleted and header totals are %d, %d, %d", dir,
store->mail_count, store->junk_count, store->delete_count, header->saved_count, header->junk_count, header->deleted_count);
tracker->mbox_count++;
@@ -865,7 +865,7 @@
/* skip already indexed emails */
for (i = 0; i < store->mail_count; i++) {
if (!(*skip_mail) (summary)) {
- tracker_error ("ERROR: skipping email no. %d in summary file", i+1);
+ g_critical ("skipping email no. %d in summary file", i+1);
tracker_db_email_free_mail_store (store);
free_summary_file (summary);
free_summary_file_header (header);
@@ -884,10 +884,10 @@
MailMessage *mail_msg = NULL;
mail_count++;
- tracker_debug ("processing email no. %d / %" G_GINT32_FORMAT, store->mail_count + 1, header->saved_count);
+ g_debug ("processing email no. %d / %" G_GINT32_FORMAT, store->mail_count + 1, header->saved_count);
if (!(*load_mail) (summary, &mail_msg)) {
- tracker_error ("ERROR: loading email no. %d in summary file", mail_count);
+ g_critical ("loading email no. %d in summary file", mail_count);
tracker_db_email_free_mail_store (store);
free_summary_file (summary);
free_summary_file_header (header);
@@ -916,10 +916,10 @@
mail_msg->store = store;
if (!(*save_ondisk_mail) (db_con, mail_msg)) {
- tracker_log ("WARNING: Message, or message parts, could not be found locally - if you are using IMAP make sure you have selected the \"copy folder content locally for offline operation\" option in Modest");
+ g_message ("WARNING: Message, or message parts, could not be found locally - if you are using IMAP make sure you have selected the \"copy folder content locally for offline operation\" option in Modest");
/* we do not have all infos but we still save them */
if (!tracker_db_email_save_email (db_con, mail_msg, MAIL_APP_MODEST)) {
- tracker_log ("Failed to save email");
+ g_message ("Failed to save email");
}
}
@@ -967,7 +967,7 @@
}
- tracker_log ("No. of new emails indexed in summary file %s is %d, %d junk, %d deleted", dir, mail_count, junk_count, delete_count);
+ g_message ("No. of new emails indexed in summary file %s is %d, %d junk, %d deleted", dir, mail_count, junk_count, delete_count);
tracker_db_email_set_message_counts (db_con, dir, store->mail_count, store->junk_count, store->delete_count);
@@ -1074,17 +1074,17 @@
goto error;
}
- tracker_debug ("summary.version = %d", h->version);
+ g_debug ("summary.version = %d", h->version);
if (h->version > 0xff && (h->version & 0xff) < 12) {
- tracker_error ("ERROR: summary file header version too low");
+ g_critical ("summary file header version too low");
goto error;
}
h->legacy = !(h->version < 0x100 && h->version >= 13);
if (h->legacy) {
- tracker_debug ("WARNING: summary file is a legacy version");
+ g_debug ("WARNING: summary file is a legacy version");
}
@@ -1095,10 +1095,10 @@
goto error;
}
- tracker_debug ("summary.flags = %d", h->flags);
- tracker_debug ("summary.nextuid = %d", h->nextuid);
- tracker_debug ("summary.time = %d", h->time);
- tracker_debug ("summary.count = %" G_GINT32_FORMAT, h->saved_count);
+ g_debug ("summary.flags = %d", h->flags);
+ g_debug ("summary.nextuid = %d", h->nextuid);
+ g_debug ("summary.time = %d", (gint) h->time);
+ g_debug ("summary.count = %" G_GINT32_FORMAT, h->saved_count);
if (!h->legacy) {
if (!decode_gint32 (f, &h->unread_count) ||
@@ -1108,9 +1108,9 @@
}
}
- tracker_debug ("summary.Unread = %d", h->unread_count);
- tracker_debug ("summary.deleted = %d", h->deleted_count);
- tracker_debug ("summary.junk = %d", h->junk_count);
+ g_debug ("summary.Unread = %d", h->unread_count);
+ g_debug ("summary.deleted = %d", h->deleted_count);
+ g_debug ("summary.junk = %d", h->junk_count);
return TRUE;
@@ -1156,13 +1156,13 @@
}
if (version < 0) {
- tracker_error ("ERROR: summary file version too low");
+ g_critical ("summary file version too low");
return FALSE;
}
/* Right now we only support summary versions 1 through 3 */
if (version > 3) {
- tracker_error ("ERROR: reported summary version (%" G_GINT32_FORMAT ") is too new", version);
+ g_critical ("reported summary version (%" G_GINT32_FORMAT ") is too new", version);
return FALSE;
}
@@ -1211,13 +1211,13 @@
}
if (version < 0) {
- tracker_error ("ERROR: summary file version too low");
+ g_critical ("summary file version too low");
return FALSE;
}
/* Right now we only support summary versions 1 through 3 */
if (version > 3) {
- tracker_error ("ERROR: reported summary version (%" G_GINT32_FORMAT ") is too new", version);
+ g_critical ("reported summary version (%" G_GINT32_FORMAT ") is too new", version);
return FALSE;
}
@@ -1729,13 +1729,13 @@
g_return_val_if_fail (db_con, FALSE);
g_return_val_if_fail (mail_msg, FALSE);
- tracker_log ("Trying to index mail \"%s\"", mail_msg->uri);
+ g_message ("Trying to index mail \"%s\"", mail_msg->uri);
if (!do_save_ondisk_email_message (db_con, mail_msg)) {
- tracker_log ("Indexing mail without body nor attachment parsing \"%s\"", mail_msg->uri);
+ g_message ("Indexing mail without body nor attachment parsing \"%s\"", mail_msg->uri);
tracker_db_email_save_email (db_con, mail_msg, MAIL_APP_MODEST);
} else {
- tracker_log ("Simple index of mail \"%s\" finished", mail_msg->uri);
+ g_message ("Simple index of mail \"%s\" finished", mail_msg->uri);
}
@@ -1931,7 +1931,7 @@
* whereas this character is not present in Evolution's format */
if (fseek (f, len /*- 1*/, SEEK_CUR) != 0) {
- tracker_error ("ERROR: seek failed for string with length %d with error code %d", len - 1, errno);
+ g_critical ("seek failed for string with length %d with error code %d", len - 1, errno);
return FALSE;
}
Modified: branches/xesam-support/src/trackerd/tracker-email-utils.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-utils.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-utils.c Tue May 20 08:18:14 2008
@@ -62,15 +62,13 @@
void
email_unwatch_directory (const gchar *dir, const gchar *service)
{
- tracker_log ("Registering path %s as belonging to service %s", dir, service);
- tracker_service_directories_remove (service, dir);
+ tracker_ontology_remove_dir_to_service_type (service, dir);
}
void
email_watch_directory (const gchar *dir, const gchar *service)
{
- tracker_log ("Registering path %s as belonging to service %s", dir, service);
- tracker_service_directories_add (service, dir);
+ tracker_ontology_add_dir_to_service_type (service, dir);
}
@@ -188,7 +186,7 @@
GObject *object;
if (tracker_config_get_verbosity (tracker->config) == 1) {
- tracker_log ("indexing #%d - Emails in %s", tracker->index_count, path);
+ g_message ("indexing #%d - Emails in %s", tracker->index_count, path);
}
if (tracker->index_count % 2500 == 0) {
@@ -225,7 +223,7 @@
tracker->mbox_count);
if (indexed > 0) {
- tracker_info ("Indexed %d emails in email store %s and ignored %d junk and %d deleted emails",
+ g_message ("Indexed %d emails in email store:'%s' and ignored %d junk and %d deleted emails",
indexed, path, junk, deleted);
return TRUE;
@@ -780,7 +778,7 @@
mail_msg->attachments = g_slist_prepend (mail_msg->attachments, ma);
- tracker_debug ("saved email attachment \"%s\"", ma->tmp_decoded_file);
+ g_debug ("saved email attachment \"%s\"", ma->tmp_decoded_file);
return TRUE;
}
@@ -931,7 +929,7 @@
path_in_locale = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
if (!path_in_locale) {
- tracker_error ("ERROR: src or dst could not be converted to locale format");
+ g_critical ("src or dst could not be converted to locale format");
g_free (path_in_locale);
return NULL;
}
@@ -1059,7 +1057,7 @@
if (g_str_has_suffix (filename, "signature.asc")) {
return;
} else {
- tracker_info ("attached filename is %s", filename);
+ g_message ("Attached filename is:'%s'", filename);
}
attachment_uri = email_make_tmp_name_for_mail_attachment (filename);
@@ -1070,7 +1068,7 @@
fd = g_open (locale_uri, (O_CREAT | O_TRUNC | O_WRONLY), 0666);
if (fd == -1) {
- tracker_error ("ERROR: failed to save attachment %s", locale_uri);
+ g_critical ("failed to save attachment %s", locale_uri);
g_free (attachment_uri);
g_free (locale_uri);
return;
Modified: branches/xesam-support/src/trackerd/tracker-hal.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-hal.c (original)
+++ branches/xesam-support/src/trackerd/tracker-hal.c Tue May 20 08:18:14 2008
@@ -159,19 +159,19 @@
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not get the system DBus connection, %s",
- error.message);
+ g_critical ("Could not get the system DBus connection, %s",
+ error.message);
dbus_error_free (&error);
return;
}
dbus_connection_setup_with_g_main (connection, NULL);
- tracker_debug ("Initializing HAL...");
+ g_message ("Initializing HAL...");
priv->context = libhal_ctx_new ();
if (!priv->context) {
- tracker_error ("Could not create HAL context");
+ g_critical ("Could not create HAL context");
return;
}
@@ -180,12 +180,12 @@
if (!libhal_ctx_init (priv->context, &error)) {
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not initialise the HAL context, %s",
- error.message);
+ g_critical ("Could not initialise the HAL context, %s",
+ error.message);
dbus_error_free (&error);
} else {
- tracker_error ("Could not initialise the HAL context, "
- "no error, is hald running?");
+ g_critical ("Could not initialise the HAL context, "
+ "no error, is hald running?");
}
libhal_ctx_free (priv->context);
@@ -208,7 +208,7 @@
(GDestroyNotify) g_free);
/* Volume and property notification callbacks */
- tracker_debug ("HAL monitors set for devices added/removed/mounted/umounted...");
+ g_message ("HAL monitors set for devices added/removed/mounted/umounted...");
libhal_ctx_set_device_added (priv->context, hal_device_added_cb);
libhal_ctx_set_device_removed (priv->context, hal_device_removed_cb);
libhal_ctx_set_device_property_modified (priv->context, hal_device_property_modified_cb);
@@ -284,14 +284,14 @@
&error);
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not get devices with 'volume' capability, %s",
- error.message);
+ g_critical ("Could not get devices with 'volume' capability, %s",
+ error.message);
dbus_error_free (&error);
return FALSE;
}
if (!devices || !devices[0]) {
- tracker_log ("HAL devices not found with 'volume' capability");
+ g_message ("HAL devices not found with 'volume' capability");
return TRUE;
}
@@ -303,21 +303,21 @@
continue;
}
- tracker_debug ("HAL device found:\n"
- " - udi : %s\n"
- " - mount point: %s\n"
- " - device file: %s\n"
- " - uuid : %s\n"
- " - mounted : %s\n"
- " - file system: %s\n"
- " - label : %s",
- libhal_volume_get_udi (volume),
- libhal_volume_get_mount_point (volume),
- libhal_volume_get_device_file (volume),
- libhal_volume_get_uuid (volume),
- libhal_volume_is_mounted (volume) ? "yes" : "no",
- libhal_volume_get_fstype (volume),
- libhal_volume_get_label (volume));
+ g_message ("HAL device found:\n"
+ " - udi : %s\n"
+ " - mount point: %s\n"
+ " - device file: %s\n"
+ " - uuid : %s\n"
+ " - mounted : %s\n"
+ " - file system: %s\n"
+ " - label : %s",
+ libhal_volume_get_udi (volume),
+ libhal_volume_get_mount_point (volume),
+ libhal_volume_get_device_file (volume),
+ libhal_volume_get_uuid (volume),
+ libhal_volume_is_mounted (volume) ? "yes" : "no",
+ libhal_volume_get_fstype (volume),
+ libhal_volume_get_label (volume));
hal_device_add (hal, volume);
libhal_volume_free (volume);
@@ -346,13 +346,13 @@
&error);
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not get AC adapter capable devices, %s",
- error.message);
+ g_critical ("Could not get AC adapter capable devices, %s",
+ error.message);
dbus_error_free (&error);
return FALSE;
}
- tracker_log ("HAL found %d AC adapter capable devices", num);
+ g_message ("HAL found %d AC adapter capable devices", num);
if (!devices || !devices[0]) {
libhal_free_string_array (devices);
@@ -367,9 +367,9 @@
if (!priv->battery_udi) {
/* For now just use the first one we find */
priv->battery_udi = g_strdup (*p);
- tracker_log (" - Device '%s' (default)", *p);
+ g_message (" - Device '%s' (default)", *p);
} else {
- tracker_log (" - Device '%s'", *p);
+ g_message (" - Device '%s'", *p);
}
}
@@ -381,7 +381,7 @@
&error);
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not add device:'%s' to property watch, %s",
+ g_critical ("Could not add device:'%s' to property watch, %s",
priv->battery_udi, error.message);
dbus_error_free (&error);
return FALSE;
@@ -393,7 +393,7 @@
PROP_AC_ADAPTER_ON,
NULL);
- tracker_log ("HAL reports system is currently powered by %s",
+ g_message ("HAL reports system is currently powered by %s",
priv->battery_in_use ? "battery" : "AC adapter");
return TRUE;
@@ -409,7 +409,7 @@
priv = GET_PRIV (hal);
- tracker_log ("HAL device with mount point:'%s', removable:%s now being tracked",
+ g_message ("HAL device with mount point:'%s', removable:%s now being tracked",
mount_point,
removable_device ? "yes" : "no");
@@ -440,7 +440,7 @@
return;
}
- tracker_log ("HAL device with mount point:'%s', removable:%s NO LONGER being tracked",
+ g_message ("HAL device with mount point:'%s', removable:%s NO LONGER being tracked",
mount_point,
g_hash_table_remove (priv->removable_devices, udi) ? "yes" : "no");
@@ -569,11 +569,11 @@
libhal_drive_free (drive);
if (!eligible) {
- tracker_debug ("HAL device is not eligible, type is '%s'",
- hal_drive_type_to_string (drive_type));
+ g_message ("HAL device is not eligible, type is '%s'",
+ hal_drive_type_to_string (drive_type));
} else {
- tracker_debug ("HAL device is eligible, type is '%s'",
- hal_drive_type_to_string (drive_type));
+ g_message ("HAL device is eligible, type is '%s'",
+ hal_drive_type_to_string (drive_type));
}
return eligible;
@@ -603,7 +603,7 @@
/* If there is no mount point, then there is nothing to track */
if (!hal_device_should_be_tracked (hal, device_file)) {
- tracker_log ("HAL device should not be tracked (not eligible)");
+ g_message ("HAL device should not be tracked (not eligible)");
return TRUE;
}
@@ -611,7 +611,7 @@
libhal_device_add_property_watch (priv->context, udi, &error);
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not add device property watch for udi:'%s', %s",
+ g_critical ("Could not add device property watch for udi:'%s', %s",
udi, error.message);
dbus_error_free (&error);
return FALSE;
@@ -647,7 +647,7 @@
return;
}
- tracker_log ("HAL device added:\n"
+ g_message ("HAL device added:\n"
" - udi : %s\n"
" - mount point: %s\n"
" - device file: %s\n"
@@ -689,7 +689,7 @@
mount_point = g_hash_table_lookup (priv->mounted_devices, udi);
- tracker_log ("HAL device removed:\n"
+ g_message ("HAL device removed:\n"
" - udi : %s\n"
" - mount point: %s\n"
" - device_file: %s",
@@ -723,7 +723,7 @@
if (!device_is_battery &&
!g_hash_table_lookup (priv->all_devices, udi)) {
- tracker_debug ("HAL device property change for another device, ignoring");
+ g_message ("HAL device property change for another device, ignoring");
return;
}
@@ -739,13 +739,13 @@
&error);
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not device property:'%s' for udi:'%s', %s",
- udi, PROP_AC_ADAPTER_ON, error.message);
+ g_critical ("Could not device property:'%s' for udi:'%s', %s",
+ udi, PROP_AC_ADAPTER_ON, error.message);
dbus_error_free (&error);
return;
}
- tracker_log ("HAL reports system is now powered by %s",
+ g_message ("HAL reports system is now powered by %s",
priv->battery_in_use ? "battery" : "AC adapter");
/* If we have come off battery power wakeup index thread */
@@ -755,8 +755,8 @@
} else {
gboolean is_mounted;
- tracker_debug ("HAL device property change for udi:'%s' and key:'%s'",
- udi, key);
+ g_message ("HAL device property change for udi:'%s' and key:'%s'",
+ udi, key);
if (strcmp (key, PROP_IS_MOUNTED) != 0) {
return;
@@ -768,8 +768,8 @@
&error);
if (dbus_error_is_set (&error)) {
- tracker_error ("Could not get device property:'%s' for udi:'%s', %s",
- udi, key, error.message);
+ g_critical ("Could not get device property:'%s' for udi:'%s', %s",
+ udi, key, error.message);
dbus_error_free (&error);
return;
}
@@ -783,7 +783,7 @@
mount_point = libhal_volume_get_mount_point (volume);
device_file = libhal_volume_get_device_file (volume);
- tracker_log ("HAL device with udi:'%s' is now mounted",
+ g_message ("HAL device with udi:'%s' is now mounted",
udi);
hal_mount_point_add (hal,
@@ -793,7 +793,7 @@
libhal_volume_free (volume);
} else {
- tracker_log ("HAL device with udi:'%s' is now unmounted",
+ g_message ("HAL device with udi:'%s' is now unmounted",
udi);
hal_mount_point_remove (hal, udi);
@@ -847,9 +847,9 @@
volume = libhal_volume_from_udi (gr->context, udi);
if (!volume) {
- tracker_debug ("HAL device with udi:'%s' has no volume, "
- "should we delete?",
- udi);
+ g_message ("HAL device with udi:'%s' has no volume, "
+ "should we delete?",
+ udi);
return;
}
Modified: branches/xesam-support/src/trackerd/tracker-index-stage.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-index-stage.c (original)
+++ branches/xesam-support/src/trackerd/tracker-index-stage.c Tue May 20 08:18:14 2008
@@ -116,9 +116,9 @@
void
tracker_index_stage_set (TrackerIndexStage new_stage)
{
- tracker_log ("Index stage changing from '%s' to '%s'",
- tracker_index_stage_to_string (index_stage),
- tracker_index_stage_to_string (new_stage));
+ g_message ("Index stage changing from '%s' to '%s'",
+ tracker_index_stage_to_string (index_stage),
+ tracker_index_stage_to_string (new_stage));
index_stage = new_stage;
}
Modified: branches/xesam-support/src/trackerd/tracker-indexer.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-indexer.c (original)
+++ branches/xesam-support/src/trackerd/tracker-indexer.c Tue May 20 08:18:14 2008
@@ -61,7 +61,7 @@
#include "tracker-hal.h"
#include "tracker-process-files.h"
#include "tracker-query-tree.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-status.h"
#include "tracker-db-manager.h"
@@ -136,7 +136,7 @@
result *= bucket_ratio;
}
- tracker_log ("Preferred bucket count is %d", result);
+ g_message ("Preferred bucket count is %d", result);
return result;
}
@@ -161,7 +161,7 @@
if (!name) return NULL;
- tracker_log ("Opening index %s", name);
+ g_message ("Opening index %s", name);
if (strstr (name, "tmp")) {
word_index = dpopen (name, DP_OWRITER | DP_OCREAT | DP_ONOLCK,
@@ -172,7 +172,7 @@
}
if (!word_index) {
- tracker_error ("%s index was not closed properly and caused error %s- attempting repair", name, dperrmsg (dpecode));
+ g_critical ("%s index was not closed properly and caused error %s- attempting repair", name, dperrmsg (dpecode));
if (dprepair (name)) {
word_index = dpopen (name, DP_OWRITER | DP_OCREAT | DP_ONOLCK,
tracker_config_get_min_bucket_count (tracker->config));
@@ -232,7 +232,7 @@
bucket_count = dpbnum (result->word_index);
rec_count = dprnum (result->word_index);
- tracker_log ("Bucket count (max is %d) is %d and Record Count is %d",
+ g_message ("Bucket count (max is %d) is %d and Record Count is %d",
tracker_config_get_max_bucket_count (tracker->config),
bucket_count, rec_count);
@@ -248,7 +248,7 @@
g_mutex_lock (indexer->word_mutex);
if (!dpclose (indexer->word_index)) {
- tracker_log ("Index closure has failed due to %s", dperrmsg (dpecode));
+ g_message ("Index closure has failed due to %s", dperrmsg (dpecode));
}
g_mutex_unlock (indexer->word_mutex);
@@ -332,23 +332,29 @@
tracker_config_get_max_bucket_count (tracker->config));
b_count = num / tracker_config_get_divisions (tracker->config);
- tracker_log ("No. of buckets per division is %d", b_count);
+ g_message ("No. of buckets per division is %d", b_count);
- tracker_log ("Please wait while optimization of indexes takes place...");
- tracker_log ("Index has file size %10.0f and bucket count of %d of which %d are used...", tracker_indexer_size (indexer), dpbnum (indexer->word_index), dpbusenum (indexer->word_index));
+ g_message ("Please wait while optimization of indexes takes place...");
+ g_message ("Index has file size %d and bucket count of %d of which %d are used...",
+ tracker_indexer_size (indexer),
+ dpbnum (indexer->word_index),
+ dpbusenum (indexer->word_index));
g_mutex_lock (indexer->word_mutex);
if (!dpoptimize (indexer->word_index, b_count)) {
g_mutex_unlock (indexer->word_mutex);
- tracker_log ("Optimization has failed due to %s", dperrmsg (dpecode));
+ g_message ("Optimization has failed due to %s", dperrmsg (dpecode));
return FALSE;
}
g_mutex_unlock (indexer->word_mutex);
- tracker_log ("Index has been successfully optimized to file size %10.0f and with bucket count of %d of which %d are used...", tracker_indexer_size (indexer), dpbnum (indexer->word_index), dpbusenum (indexer->word_index));
+ g_message ("Index has been successfully optimized to file size %d and with bucket count of %d of which %d are used...",
+ tracker_indexer_size (indexer),
+ dpbnum (indexer->word_index),
+ dpbusenum (indexer->word_index));
return TRUE;
@@ -378,7 +384,7 @@
int i = 0, interval;
int buff_size = MAX_HITS_FOR_WORD * sz;
- tracker_log ("applying incremental changes to indexes");
+ g_message ("applying incremental changes to indexes");
guint32 size = tracker_indexer_size (dest);
@@ -438,7 +444,7 @@
if (bytes < 1) continue;
if (bytes % sz != 0) {
- tracker_error ("possible corruption found during application of changes to index with word %s (ignoring update for this word)", str);
+ g_critical ("possible corruption found during application of changes to index with word %s (ignoring update for this word)", str);
continue;
}
@@ -539,7 +545,7 @@
{
if (!src_index || !dest_index) {
- tracker_error ("cannot move indexes");
+ g_critical ("cannot move indexes");
return;
}
@@ -556,14 +562,14 @@
/* rename and reopen final index as main index */
- tracker_log ("renaming %s to %s", final_name, fname);
+ g_message ("renaming %s to %s", final_name, fname);
rename (final_name, fname);
dest_index->word_index = open_index (fname);
if (!dest_index->word_index) {
- tracker_error ("index creation failure for %s from %s", fname, final_name);
+ g_critical ("index creation failure for %s from %s", fname, final_name);
}
g_free (final_name);
@@ -661,7 +667,7 @@
return;
}
- tracker_log ("starting merge of %d indexes", index_count);
+ g_message ("starting merge of %d indexes", index_count);
tracker->in_merge = TRUE;
tracker->merge_count = index_count;
tracker->merge_processed = 0;
@@ -709,7 +715,7 @@
if (!final_index) {
g_slist_free (index_list);
- tracker_error ("could not open final index - abandoning index merge");
+ g_critical ("could not open final index - abandoning index merge");
goto end_of_merging;
}
@@ -779,7 +785,7 @@
}
if (offset % sz != 0) {
- tracker_error ("possible corruption found during merge of word %s - purging word from index (it will not be searchable)", str);
+ g_critical ("possible corruption found during merge of word %s - purging word from index (it will not be searchable)", str);
continue;
}
@@ -798,7 +804,7 @@
gint tmp_offset = dpgetwb (tmp_index->word_index, str, -1, 0, (buff_size - offset), tmp_buffer);
if (tmp_offset > 0 && (tmp_offset % sz != 0)) {
- tracker_error ("possible corruption found during merge of word %s - purging word from index", str);
+ g_critical ("possible corruption found during merge of word %s - purging word from index", str);
continue;
}
@@ -1032,7 +1038,7 @@
/* add hits that could not be updated directly here so they can be appended later */
if (!edited) {
list = g_slist_prepend (list, &detail_chunk[j]);
- tracker_debug ("could not update word hit %s - appending", word);
+ g_debug ("could not update word hit %s - appending", word);
}
}
@@ -1366,7 +1372,7 @@
winner_dist = dist;
} else {
- tracker_log ("No hits for %s!", str);
+ g_message ("No hits for %s!", str);
}
}
@@ -1375,7 +1381,7 @@
g_get_current_time (¤t);
if (current.tv_sec - start.tv_sec >= 2) { /* 2 second time out */
- tracker_log ("Timeout in tracker_dbus_method_search_suggest");
+ g_message ("Timeout in tracker_dbus_method_search_suggest");
break;
}
@@ -1397,7 +1403,7 @@
g_free (filename);
if (too_big) {
- tracker_error ("File index database is too big, discontinuing indexing");
+ g_critical ("File index database is too big, discontinuing indexing");
return TRUE;
}
@@ -1406,7 +1412,7 @@
g_free (filename);
if (too_big) {
- tracker_error ("Email index database is too big, discontinuing indexing");
+ g_critical ("Email index database is too big, discontinuing indexing");
return TRUE;
}
@@ -1414,7 +1420,7 @@
too_big = tracker_file_get_size (filename_const) > MAX_INDEX_FILE_SIZE;
if (too_big) {
- tracker_error ("File metadata database is too big, discontinuing indexing");
+ g_critical ("File metadata database is too big, discontinuing indexing");
return TRUE;
}
@@ -1422,7 +1428,7 @@
too_big = tracker_file_get_size (filename_const) > MAX_INDEX_FILE_SIZE;
if (too_big) {
- tracker_error ("Email metadata database is too big, discontinuing indexing");
+ g_critical ("Email metadata database is too big, discontinuing indexing");
return TRUE;
}
Modified: branches/xesam-support/src/trackerd/tracker-inotify.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-inotify.c (original)
+++ branches/xesam-support/src/trackerd/tracker-inotify.c Tue May 20 08:18:14 2008
@@ -168,13 +168,15 @@
moved_from_info = (TrackerDBFileInfo *) tmp->data;
if (!moved_from_info) {
- tracker_error ("ERROR: bad FileInfo struct found in move list. Skipping...");
+ g_critical ("bad FileInfo struct found in move list. Skipping...");
continue;
}
if ((cookie > 0) && (moved_from_info->cookie == cookie)) {
- tracker_info ("found matching inotify pair from %s to %s", moved_from_info->uri, moved_to_info->uri);
+ g_message ("Found matching inotify pair from:'%s' to:'%s'",
+ moved_from_info->uri,
+ moved_to_info->uri);
tracker->grace_period = 2;
tracker->request_waiting = TRUE;
@@ -195,7 +197,8 @@
}
/* matching pair not found so treat as a create action */
- tracker_debug ("no matching pair found for inotify move event for %s", info->uri);
+ g_debug ("no matching pair found for inotify move event for %s",
+ info->uri);
if (tracker_file_is_directory (info->uri)) {
info->action = TRACKER_DB_ACTION_DIRECTORY_CREATED;
} else {
@@ -207,16 +210,16 @@
} else if (action == TRACKER_DB_ACTION_WRITABLE_FILE_CLOSED) {
tracker_add_io_grace (info->uri);
- tracker_info ("File %s has finished changing", info->uri);
+ g_message ("File:'%s' has finished changing", info->uri);
tracker_db_insert_pending_file (main_thread_db_con, info->file_id, info->uri, NULL, info->mime, 0, info->action, info->is_directory, TRUE, -1);
tracker_db_file_info_free (info);
return;
}
- tracker_log ("WARNING: not processing event %s for uri %s",
- tracker_db_action_to_string (info->action),
- info->uri);
+ g_warning ("Not processing event:'%s' for uri:'%s'",
+ tracker_db_action_to_string (info->action),
+ info->uri);
tracker_db_file_info_free (info);
}
@@ -380,7 +383,7 @@
}
if (tracker_is_empty_string (filename)) {
- //tracker_log ("WARNING: inotify event has no filename");
+ //g_message ("WARNING: inotify event has no filename");
g_free (event);
continue;
}
@@ -388,7 +391,7 @@
file_utf8_uri = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
if (tracker_is_empty_string (file_utf8_uri)) {
- tracker_error ("ERROR: file uri could not be converted to utf8 format");
+ g_critical ("file uri could not be converted to utf8 format");
g_free (event);
continue;
}
@@ -401,7 +404,7 @@
dir_utf8_uri = g_filename_to_utf8 (monitor_name, -1, NULL, NULL, NULL);
if (!dir_utf8_uri) {
- tracker_error ("Error: file uri could not be converted to utf8 format");
+ g_critical ("file uri could not be converted to utf8 format");
g_free (file_utf8_uri);
g_free (event);
continue;
@@ -417,7 +420,7 @@
tracker_process_files_should_be_watched (tracker->config, str)) {
process_event (str, tracker_file_is_directory (str), action_type, cookie);
} else {
- tracker_debug ("ignoring action %d on file %s", action_type, str);
+ g_debug ("ignoring action %d on file %s", action_type, str);
}
if (monitor_name) {
@@ -455,7 +458,7 @@
r = read (fd, buffer, 16384);
if (r <= 0) {
- tracker_error ("ERROR: inotify system failure - unable to watch files");
+ g_critical ("inotify system failure - unable to watch files");
return FALSE;
}
@@ -505,7 +508,7 @@
/* leave 500 watches for other users */
tracker->watch_limit = atoi (limit) - 500;
- tracker_log ("Setting inotify watch limit to %d.", tracker->watch_limit);
+ g_message ("Setting inotify watch limit to %d.", tracker->watch_limit);
g_free (limit);
}
}
@@ -548,7 +551,7 @@
if (tracker_count_watch_dirs () >= (int) tracker->watch_limit) {
if (!limit_exceeded_msg) {
- tracker_log ("Inotify Watch Limit has been exceeded - for best results you should increase number of inotify watches on your system");
+ g_message ("Inotify Watch Limit has been exceeded - for best results you should increase number of inotify watches on your system");
limit_exceeded_msg = TRUE;
}
@@ -568,7 +571,7 @@
g_free (dir_in_locale);
if (wd < 0) {
- tracker_error ("ERROR: Inotify watch on %s has failed", dir);
+ g_critical ("Inotify watch on %s has failed", dir);
return FALSE;
}
@@ -576,7 +579,7 @@
tracker_exec_proc (db_con->cache, "InsertWatch", dir, str_wd, NULL);
g_free (str_wd);
inotify_count++;
- tracker_log ("Watching directory %s (total watches = %d)", dir, inotify_count);
+ g_message ("Watching directory %s (total watches = %d)", dir, inotify_count);
return TRUE;
}
@@ -599,7 +602,7 @@
wd = -1;
if (!result_set) {
- tracker_log ("WARNING: watch id not found for uri %s", dir);
+ g_message ("WARNING: watch id not found for uri %s", dir);
return FALSE;
}
Modified: branches/xesam-support/src/trackerd/tracker-ioprio.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-ioprio.c (original)
+++ branches/xesam-support/src/trackerd/tracker-ioprio.c Tue May 20 08:18:14 2008
@@ -132,14 +132,12 @@
void
ioprio (void)
{
-
-
- tracker_log ("Setting ioprio...");
+ g_message ("Setting ioprio...");
if (set_io_priority_idle () == -1) {
g_print ("Could not set idle IO priority...attempting best effort 7 priority\n");
if (set_io_priority_best_effort (7) == -1) {
- tracker_error ("ERROR: ioprio_set failed");
+ g_warning ("Could not set IO priority");
}
}
Modified: branches/xesam-support/src/trackerd/tracker-main.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-main.c (original)
+++ branches/xesam-support/src/trackerd/tracker-main.c Tue May 20 08:18:14 2008
@@ -53,7 +53,7 @@
#include "tracker-hal.h"
#include "tracker-indexer.h"
#include "tracker-process-files.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-status.h"
#include "tracker-watch.h"
#include "tracker-xesam.h"
@@ -111,15 +111,15 @@
* threads are waiting to process them.
*/
-#define ABOUT \
- "Tracker " VERSION "\n" \
+#define ABOUT \
+ "Tracker " VERSION "\n" \
"Copyright (c) 2005-2008 Jamie McCracken (jamiemcc gnome org)\n"
-#define LICENSE \
+#define LICENSE \
"This program is free software and comes without any warranty.\n" \
- "It is licensed under version 2 or later of the General Public " \
- "License which can be viewed at:\n" \
- "\n" \
+ "It is licensed under version 2 or later of the General Public " \
+ "License which can be viewed at:\n" \
+ "\n" \
" http://www.gnu.org/licenses/gpl.txt\n"
/* Public */
@@ -138,7 +138,6 @@
static gchar *language;
static gboolean disable_indexing;
static gboolean reindex;
-static gboolean fatal_errors;
static gboolean low_memory;
static gint throttle = -1;
static gint verbosity = -1;
@@ -189,10 +188,6 @@
G_OPTION_ARG_NONE, &reindex,
N_("Force a re-index of all content"),
NULL },
- { "fatal-errors", 'f', 0,
- G_OPTION_ARG_NONE, &fatal_errors,
- N_("Make tracker errors fatal"),
- NULL },
{ NULL }
};
@@ -252,7 +247,7 @@
return;
}
- tracker_log ("Resetting black list file:'%s'", uri);
+ g_message ("Resetting black list file:'%s'", uri);
/* Reset mtime on parent folder of all outstanding black list
* files so they get indexed when next restarted
@@ -274,14 +269,14 @@
GSList *l;
if (!list) {
- tracker_log ("%s: NONE!", str);
+ g_message ("%s: NONE!", str);
return;
}
- tracker_log ("%s:", str);
+ g_message ("%s:", str);
for (l = list; l; l = l->next) {
- tracker_log (" %s", l->data);
+ g_message (" %s", (gchar*) l->data);
}
}
@@ -311,72 +306,68 @@
tracker->max_extract_queue_size = 500;
}
- tracker_log ("Tracker configuration options:");
- tracker_log (" Verbosity ............................ %d",
- tracker_config_get_verbosity (tracker->config));
- tracker_log (" Low memory mode ...................... %s",
- tracker_config_get_low_memory_mode (tracker->config) ? "yes" : "no");
- tracker_log (" Indexing enabled ..................... %s",
- tracker_config_get_enable_indexing (tracker->config) ? "yes" : "no");
- tracker_log (" Watching enabled ..................... %s",
- tracker_config_get_enable_watches (tracker->config) ? "yes" : "no");
- tracker_log (" File content indexing enabled ........ %s",
- tracker_config_get_enable_content_indexing (tracker->config) ? "yes" : "no");
- tracker_log (" Thumbnailing enabled ................. %s",
- tracker_config_get_enable_thumbnails (tracker->config) ? "yes" : "no");
- tracker_log (" Email client to index ................. %s",
- tracker_config_get_email_client (tracker->config));
-
- tracker_log ("Tracker indexer parameters:");
- tracker_log (" Indexer language code ................ %s",
- tracker_config_get_language (tracker->config));
- tracker_log (" Stemmer enabled ...................... %s",
- tracker_config_get_enable_stemmer (tracker->config) ? "yes" : "no");
- tracker_log (" Fast merges enabled .................. %s",
- tracker_config_get_fast_merges (tracker->config) ? "yes" : "no");
- tracker_log (" Disable indexing on battery............ %s (initially = %s)",
- tracker_config_get_disable_indexing_on_battery (tracker->config) ? "yes" : "no",
- tracker_config_get_disable_indexing_on_battery_init (tracker->config) ? "yes" : "no");
+ g_message ("Tracker configuration options:");
+ g_message (" Verbosity ............................ %d",
+ tracker_config_get_verbosity (tracker->config));
+ g_message (" Low memory mode ...................... %s",
+ tracker_config_get_low_memory_mode (tracker->config) ? "yes" : "no");
+ g_message (" Indexing enabled ..................... %s",
+ tracker_config_get_enable_indexing (tracker->config) ? "yes" : "no");
+ g_message (" Watching enabled ..................... %s",
+ tracker_config_get_enable_watches (tracker->config) ? "yes" : "no");
+ g_message (" File content indexing enabled ........ %s",
+ tracker_config_get_enable_content_indexing (tracker->config) ? "yes" : "no");
+ g_message (" Thumbnailing enabled ................. %s",
+ tracker_config_get_enable_thumbnails (tracker->config) ? "yes" : "no");
+ g_message (" Email client to index ................. %s",
+ tracker_config_get_email_client (tracker->config));
+
+ g_message ("Tracker indexer parameters:");
+ g_message (" Indexer language code ................ %s",
+ tracker_config_get_language (tracker->config));
+ g_message (" Stemmer enabled ...................... %s",
+ tracker_config_get_enable_stemmer (tracker->config) ? "yes" : "no");
+ g_message (" Fast merges enabled .................. %s",
+ tracker_config_get_fast_merges (tracker->config) ? "yes" : "no");
+ g_message (" Disable indexing on battery............ %s (initially = %s)",
+ tracker_config_get_disable_indexing_on_battery (tracker->config) ? "yes" : "no",
+ tracker_config_get_disable_indexing_on_battery_init (tracker->config) ? "yes" : "no");
if (tracker_config_get_low_disk_space_limit (tracker->config) == -1) {
- tracker_log (" Low disk space limit .................. Disabled");
+ g_message (" Low disk space limit .................. Disabled");
} else {
- tracker_log (" Low disk space limit .................. %d%%",
- tracker_config_get_low_disk_space_limit (tracker->config));
+ g_message (" Low disk space limit .................. %d%%",
+ tracker_config_get_low_disk_space_limit (tracker->config));
}
- tracker_log (" Minimum index word length ............ %d",
- tracker_config_get_min_word_length (tracker->config));
- tracker_log (" Maximum index word length ............ %d",
- tracker_config_get_max_word_length (tracker->config));
- tracker_log (" Maximum text to index ................. %d",
- tracker_config_get_max_text_to_index (tracker->config));
- tracker_log (" Maximum words to index ................ %d",
- tracker_config_get_max_words_to_index (tracker->config));
- tracker_log (" Maximum bucket count .................. %d",
- tracker_config_get_max_bucket_count (tracker->config));
- tracker_log (" Minimum bucket count .................. %d",
- tracker_config_get_min_bucket_count (tracker->config));
- tracker_log (" Divisions ............................. %d",
- tracker_config_get_divisions (tracker->config));
- tracker_log (" Padding ............................... %d",
- tracker_config_get_padding (tracker->config));
- tracker_log (" Optimization sweep count .............. %d",
- tracker_config_get_optimization_sweep_count (tracker->config));
- tracker_log (" Thread stack size ..................... %d",
- tracker_config_get_thread_stack_size (tracker->config));
- tracker_log (" Throttle level ........................ %d",
- tracker_config_get_throttle (tracker->config));
+ g_message (" Minimum index word length ............ %d",
+ tracker_config_get_min_word_length (tracker->config));
+ g_message (" Maximum index word length ............ %d",
+ tracker_config_get_max_word_length (tracker->config));
+ g_message (" Maximum text to index ................. %d",
+ tracker_config_get_max_text_to_index (tracker->config));
+ g_message (" Maximum words to index ................ %d",
+ tracker_config_get_max_words_to_index (tracker->config));
+ g_message (" Maximum bucket count .................. %d",
+ tracker_config_get_max_bucket_count (tracker->config));
+ g_message (" Minimum bucket count .................. %d",
+ tracker_config_get_min_bucket_count (tracker->config));
+ g_message (" Divisions ............................. %d",
+ tracker_config_get_divisions (tracker->config));
+ g_message (" Padding ............................... %d",
+ tracker_config_get_padding (tracker->config));
+ g_message (" Optimization sweep count .............. %d",
+ tracker_config_get_optimization_sweep_count (tracker->config));
+ g_message (" Thread stack size ..................... %d",
+ tracker_config_get_thread_stack_size (tracker->config));
+ g_message (" Throttle level ........................ %d",
+ tracker_config_get_throttle (tracker->config));
log_option_list (watch_directory_roots, "Watching directory roots");
log_option_list (crawl_directory_roots, "Crawling directory roots");
log_option_list (no_watch_directory_roots, "NOT watching directory roots");
log_option_list (no_index_file_types, "NOT indexing file types");
- tracker->metadata_table = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- NULL,
- NULL);
}
static void
@@ -391,7 +382,7 @@
/* Reset stats for embedded services if they are being reindexed */
if (!need_data) {
- tracker_log ("*** DELETING STATS *** ");
+ g_message ("*** DELETING STATS *** ");
tracker_db_exec_no_reply (db_con->db,
"update ServiceTypes set TypeCount = 0 where Embedded = 1");
}
@@ -447,9 +438,9 @@
default:
if (g_strsignal (signo)) {
- tracker_log ("Received signal:%d->'%s'",
- signo,
- g_strsignal (signo));
+ g_message ("Received signal:%d->'%s'",
+ signo,
+ g_strsignal (signo));
}
break;
}
@@ -586,7 +577,7 @@
if (!tracker->readonly &&
!need_index &&
tracker_db_get_option_int (db_con, "IntegrityCheck") == 1) {
- tracker_log ("Performing integrity check as the daemon was not shutdown cleanly");
+ g_message ("Performing integrity check as the daemon was not shutdown cleanly");
/* FIXME: Finish */
}
@@ -621,9 +612,9 @@
TRACKER_INDEXER_FILE_INDEX_DB_FILENAME,
NULL);
- tracker_log ("Overwriting '%s' with '%s'",
- file_index_name,
- final_index_name);
+ g_message ("Overwriting '%s' with '%s'",
+ file_index_name,
+ final_index_name);
rename (final_index_name, file_index_name);
g_free (file_index_name);
}
@@ -642,9 +633,9 @@
TRACKER_INDEXER_EMAIL_INDEX_DB_FILENAME,
NULL);
- tracker_log ("Overwriting '%s' with '%s'",
- file_index_name,
- final_index_name);
+ g_message ("Overwriting '%s' with '%s'",
+ file_index_name,
+ final_index_name);
rename (final_index_name, file_index_name);
g_free (file_index_name);
}
@@ -675,7 +666,7 @@
static gboolean
shutdown_timeout_cb (gpointer user_data)
{
- tracker_error ("Could not exit in a timely fashion - terminating...");
+ g_critical ("Could not exit in a timely fashion - terminating...");
exit (EXIT_FAILURE);
return FALSE;
@@ -684,7 +675,7 @@
static void
shutdown_threads (GThread *thread_to_join)
{
- tracker_log ("Shutting down threads");
+ g_message ("Shutting down threads");
/* Wait for files thread to sleep */
while (!g_mutex_trylock (tracker->files_signal_mutex)) {
@@ -721,17 +712,17 @@
/* We wait now for the thread to exit and join, then clean up
* the mutexts and conds.
*/
- tracker_log ("Waiting for thread:%p to finish", thread_to_join);
+ g_message ("Waiting for thread to finish");
g_thread_join (thread_to_join);
/* Clean up */
#if 0
- tracker_log ("Waiting for file check/signal mutexes to unlock before cleaning up...");
+ g_message ("Waiting for file check/signal mutexes to unlock before cleaning up...");
g_mutex_free (tracker->files_check_mutex);
g_mutex_free (tracker->files_signal_mutex);
g_cond_free (tracker->files_signal_cond);
- tracker_log ("Waiting for metadata check/signal mutexes to unlock before cleaning up...");
+ g_message ("Waiting for metadata check/signal mutexes to unlock before cleaning up...");
g_mutex_free (tracker->metadata_check_mutex);
g_mutex_free (tracker->metadata_signal_mutex);
g_cond_free (tracker->metadata_signal_cond);
@@ -745,7 +736,7 @@
gint lfp;
gboolean multiple = FALSE;
- tracker_log ("Checking instances running");
+ g_message ("Checking instances running");
lock_file = get_lock_file ();
@@ -948,10 +939,11 @@
}
/* Initialise other subsystems */
- tracker_log_init (log_filename,
- tracker_config_get_verbosity (tracker->config),
- fatal_errors);
-
+ tracker_log_init (G_LOG_DOMAIN,
+ log_filename,
+ tracker_config_get_verbosity (tracker->config));
+ g_message ("Starting log");
+
if (!tracker_dbus_preinit (tracker, &connection, &proxy))
return EXIT_FAILURE;
@@ -964,7 +956,9 @@
tracker->sys_tmp_root_dir);
tracker_xesam_init ();
tracker_cache_init ();
- tracker_service_manager_init ();
+
+ tracker_ontology_init ();
+
tracker_email_init (tracker->config);
#ifdef HAVE_HAL
@@ -987,7 +981,7 @@
* call so we have to check value of errno too. Stupid...
*/
if (nice (19) == -1 && errno) {
- tracker_log ("Couldn't set nice() value");
+ g_message ("Couldn't set nice() value");
}
#ifdef IOPRIO_SUPPORT
@@ -995,7 +989,7 @@
#endif
if (!tracker_db_load_prepared_queries ()) {
- tracker_error ("Could not initialize database engine!");
+ g_critical ("Could not initialize database engine!");
return EXIT_FAILURE;
}
@@ -1020,7 +1014,7 @@
if (!tracker->readonly) {
if (!tracker_start_watching ()) {
tracker->is_running = FALSE;
- tracker_error ("File monitoring failed to start");
+ g_critical ("File monitoring failed to start");
}
else if (tracker_config_get_enable_indexing (tracker->config)) {
thread = g_thread_create_full ((GThreadFunc) tracker_process_files,
@@ -1031,7 +1025,7 @@
G_THREAD_PRIORITY_NORMAL,
NULL);
} else {
- tracker_log ("Indexing disabled, waiting for DBus requests...");
+ g_message ("Indexing disabled, waiting for DBus requests...");
}
}
@@ -1075,7 +1069,7 @@
tracker_email_shutdown ();
tracker_dbus_shutdown ();
- tracker_service_manager_shutdown ();
+ tracker_ontology_term ();
tracker_cache_shutdown ();
tracker_xesam_shutdown ();
tracker_db_manager_term ();
Modified: branches/xesam-support/src/trackerd/tracker-main.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-main.h (original)
+++ branches/xesam-support/src/trackerd/tracker-main.h Tue May 20 08:18:14 2008
@@ -97,9 +97,6 @@
gint grace_period;
gboolean request_waiting;
- /* Lookup tables for service and metadata IDs */
- GHashTable *metadata_table;
-
/* Email config options */
gint email_service_min;
gint email_service_max;
Modified: branches/xesam-support/src/trackerd/tracker-metadata.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-metadata.c (original)
+++ branches/xesam-support/src/trackerd/tracker-metadata.c Tue May 20 08:18:14 2008
@@ -37,7 +37,7 @@
#include "tracker-metadata.h"
#include "tracker-utils.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#include "tracker-main.h"
extern Tracker *tracker;
@@ -50,7 +50,7 @@
text_filter_file = NULL;
/* no need to filter text based files - index em directly */
- service_type = tracker_service_manager_get_service_type_for_mime (mime);
+ service_type = tracker_ontology_get_service_type_for_mime (mime);
if ( !strcmp ("Text", service_type) || !strcmp ("Development", service_type)) {
g_free (service_type);
@@ -94,13 +94,14 @@
g_free (text_filter_file);
if (!argv[1]) {
- tracker_error ("ERROR: uri could not be converted to locale format");
+ g_critical ("uri could not be converted to locale format");
g_free (argv[0]);
g_free (argv[2]);
return NULL;
}
- tracker_info ("extracting text for %s using filter %s", argv[1], argv[0]);
+ g_message ("Extracting text for:'%s' using filter:'%s'",
+ argv[1], argv[0]);
if (tracker_spawn (argv, 30, NULL, NULL)) {
@@ -152,7 +153,7 @@
} else if (exit_status != EXIT_SUCCESS) {
thumbnail = NULL;
} else {
- tracker_log ("got thumbnail %s", thumbnail);
+ g_message ("got thumbnail %s", thumbnail);
}
g_free (argv[0]);
@@ -177,12 +178,12 @@
return;
}
- service_type = tracker_service_manager_get_service_type_for_mime (mime);
+ service_type = tracker_ontology_get_service_type_for_mime (mime);
if (!service_type ) {
return;
}
- if (!tracker_service_manager_has_metadata (service_type)) {
+ if (!tracker_ontology_service_type_has_metadata (service_type)) {
g_free (service_type);
return;
}
@@ -194,7 +195,7 @@
argv[3] = NULL;
if (!argv[1] || !argv[2]) {
- tracker_error ("ERROR: uri or mime could not be converted to locale format");
+ g_critical ("uri or mime could not be converted to locale format");
g_free (argv[0]);
g_free (argv[1]);
Modified: branches/xesam-support/src/trackerd/tracker-process-files.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-process-files.c (original)
+++ branches/xesam-support/src/trackerd/tracker-process-files.c Tue May 20 08:18:14 2008
@@ -112,7 +112,7 @@
dir_in_locale = g_filename_from_utf8 (dir, -1, NULL, NULL, NULL);
if (!dir_in_locale) {
- tracker_error ("ERROR: dir could not be converted to utf8 format");
+ g_warning ("Could not convert directory:'%s' o UTF-8", dir);
g_free (dir_in_locale);
return NULL;
}
@@ -237,7 +237,8 @@
if (!g_utf8_validate (l->data, -1, NULL)) {
dir = g_filename_to_utf8 (l->data, -1, NULL,NULL,NULL);
if (!dir) {
- tracker_error ("Directory to watch was not valid UTF-8 and couldn't be converted either");
+ g_warning ("Could not convert directory:'%s' to UTF-8",
+ (gchar*) l->data);
continue;
}
} else {
@@ -269,7 +270,7 @@
if (watches < tracker->watch_limit) {
if (!tracker_add_watch_dir (dir, db_con)) {
- tracker_debug ("Watch failed for %s", dir);
+ g_warning ("Watch failed for:'%s'", dir);
}
}
}
@@ -386,7 +387,7 @@
files = process_get_files (tracker, uri, FALSE, TRUE, NULL);
- tracker_debug ("Scanning %s for %d files", uri, g_slist_length (files));
+ g_message ("Scanning:'%s' for %d files", uri, g_slist_length (files));
info = g_slice_new (ForEachDBCon);
info->tracker = tracker;
@@ -410,7 +411,7 @@
g_slice_free (ForEachDBCon, info);
- tracker_debug ("Finished scanning");
+ g_message ("Finished scanning");
}
static void
@@ -496,20 +497,20 @@
tracker_throttle (100);
}
- service_info = tracker_service_directories_get_service (info->uri);
+ service_info = tracker_ontology_get_service_type_for_dir (info->uri);
if (!service_info) {
- tracker_error ("ERROR: cannot find service for path %s", info->uri);
+ g_warning ("Can not find service for path:'%s'", info->uri);
return;
}
- def = tracker_service_manager_get_service (service_info);
+ def = tracker_ontology_get_service_type_by_name (service_info);
if (!def) {
if (service_info) {
- tracker_error ("ERROR: unknown service %s", service_info);
+ g_warning ("Unknown service:'%s'", service_info);
} else {
- tracker_error ("ERROR: unknown service");
+ g_warning ("Unknown service");
}
g_free (service_info);
return;
@@ -563,7 +564,7 @@
tracker_db_delete_file (db_con, info->file_id);
- tracker_log ("Deleting file %s", info->uri);
+ g_message ("Deleting file:'%s'", info->uri);
}
static void
@@ -587,7 +588,7 @@
tracker_remove_watch_dir (info->uri, TRUE, db_con);
- tracker_log ("Deleting dir %s and subdirs", info->uri);
+ g_message ("Deleting directory:'%s' and subdirs", info->uri);
}
static void
@@ -652,7 +653,7 @@
g_return_if_fail (tracker_file_is_directory (uri));
files = process_get_files (tracker, uri, FALSE, TRUE, NULL);
- tracker_debug ("Checking %s for %d files", uri, g_slist_length (files));
+ g_message ("Checking:'%s' for %d files", uri, g_slist_length (files));
g_slist_foreach (files, (GFunc) process_queue_files_foreach, tracker);
g_slist_foreach (files, (GFunc) g_free, NULL);
@@ -671,7 +672,7 @@
static void
process_index_config (Tracker *tracker, DBConnection *db_con)
{
- tracker_log ("Starting config indexing");
+ g_message ("Starting config indexing");
}
static void
@@ -679,14 +680,14 @@
{
GSList *list;
- tracker_log ("Starting application indexing");
+ g_message ("Starting application indexing");
tracker_db_start_index_transaction (db_con);
tracker_db_interface_start_transaction (db_con->cache->db);
tracker_applications_add_service_directories ();
- list = tracker_service_directories_get ("Applications");
+ list = tracker_ontology_get_dirs_for_service_type ("Applications");
process_directory_list (tracker, list, FALSE, db_con);
tracker_db_interface_end_transaction (db_con->cache->db);
@@ -787,7 +788,7 @@
GSList *index_exclude;
ForEachDBCon *info;
- tracker_log ("Starting file indexing...");
+ g_message ("Starting file indexing...");
object = tracker_dbus_get_object (TRACKER_TYPE_DBUS_DAEMON);
@@ -816,12 +817,12 @@
if (index_exclude) {
GSList *l;
- tracker_log ("Deleting entities where indexing is disabled or are not watched:");
+ g_message ("Deleting entities where indexing is disabled or are not watched:");
for (l = index_exclude; l; l = l->next) {
guint32 id;
- tracker_log (" %s", l->data);
+ g_message (" %s", (gchar*) l->data);
id = tracker_db_get_file_id (db_con, l->data);
@@ -834,7 +835,7 @@
}
if (!index_include) {
- tracker_log ("No directory roots to index!");
+ g_message ("No directory roots to index!");
return;
}
@@ -937,7 +938,7 @@
GSList *crawl_directory_roots;
ForEachDBCon *info;
- tracker_log ("Starting directory crawling...");
+ g_message ("Starting directory crawling...");
crawl_directories = NULL;
crawl_directory_roots =
@@ -991,19 +992,18 @@
if (tracker_file_is_valid (gaim)) {
has_logs = TRUE;
- tracker_service_directories_add ("GaimConversations", gaim);
+ tracker_ontology_add_dir_to_service_type ("GaimConversations", gaim);
list = g_slist_prepend (NULL, gaim);
}
if (tracker_file_is_valid (purple)) {
has_logs = TRUE;
- tracker_service_directories_add ("GaimConversations", purple);
+ tracker_ontology_add_dir_to_service_type ("GaimConversations", purple);
list = g_slist_prepend (NULL, purple);
}
if (has_logs) {
-
- tracker_log ("Starting chat log indexing...");
+ g_message ("Starting chat log indexing...");
tracker_db_interface_start_transaction (db_con->cache->db);
process_directory_list (tracker, list, TRUE, db_con);
tracker_db_interface_end_transaction (db_con->cache->db);
@@ -1025,8 +1025,8 @@
if (tracker_file_is_valid (firefox_dir)) {
list = g_slist_prepend( NULL, firefox_dir);
- tracker_log ("Starting Firefox web history indexing...");
- tracker_service_directories_add ("WebHistory", firefox_dir);
+ g_message ("Starting Firefox web history indexing...");
+ tracker_ontology_add_dir_to_service_type ("WebHistory", firefox_dir);
tracker_db_interface_start_transaction (db_con->cache->db);
process_directory_list (tracker, list, TRUE, db_con);
@@ -1075,7 +1075,7 @@
const gchar *name;
tracker_email_add_service_directories (db_con->emails);
- tracker_log ("Starting email indexing...");
+ g_message ("Starting email indexing...");
tracker_db_interface_start_transaction (db_con->cache->db);
@@ -1084,7 +1084,7 @@
if (name) {
GSList *list;
- list = tracker_service_directories_get (name);
+ list = tracker_ontology_get_dirs_for_service_type (name);
process_directory_list (tracker, list, TRUE, db_con);
g_slist_free (list);
}
@@ -1207,12 +1207,12 @@
g_timer_destroy (index_duration);
index_duration = NULL;
- tracker_log ("Indexing finished in %d seconds", time_taken);
+ g_message ("Indexing finished in %d seconds", time_taken);
g_signal_emit_by_name (object, "index-finished", time_taken);
tracker_db_set_option_int (db_con, "InitialIndex", 0);
- tracker_log ("Updating database stats, please wait...");
+ g_message ("Updating database stats, please wait...");
tracker_db_interface_start_transaction (db_con->db);
tracker_db_exec_no_reply (db_con->db, "ANALYZE");
@@ -1222,7 +1222,7 @@
tracker_db_exec_no_reply (db_con->emails->db, "ANALYZE");
tracker_db_interface_end_transaction (db_con->emails->db);
- tracker_log ("Finished optimizing, waiting for new events...");
+ g_message ("Finished optimizing, waiting for new events...");
}
/* We have no stuff to process so sleep until awoken by a new
@@ -1284,7 +1284,7 @@
case TRACKER_DB_ACTION_FILE_MOVED_FROM:
need_index = FALSE;
- tracker_log ("Starting moving file %s to %s", info->uri, info->moved_to_uri);
+ g_message ("Starting moving file:'%s' to:'%s'", info->uri, info->moved_to_uri);
tracker_db_move_file (db_con, info->uri, info->moved_to_uri);
break;
@@ -1320,7 +1320,7 @@
case TRACKER_DB_ACTION_DIRECTORY_CREATED:
need_index = TRUE;
- tracker_debug ("Processing created directory %s", info->uri);
+ g_message ("Processing created directory %s", info->uri);
/* Schedule a rescan for all files in folder
* to avoid race conditions.
@@ -1338,8 +1338,8 @@
g_slist_free (list);
} else {
- tracker_debug ("Blocked scan of directory %s as its in the no watch list",
- info->uri);
+ g_message ("Blocked scan of directory:'%s' as its in the no watch list",
+ info->uri);
}
break;
@@ -1382,10 +1382,10 @@
info->is_new = TRUE;
}
- tracker_debug ("Processing %s with action %s and counter %d ",
- info->uri,
- tracker_db_action_to_string (info->action),
- info->counter);
+ g_message ("Processing:'%s' with action:'%s' and counter:%d ",
+ info->uri,
+ tracker_db_action_to_string (info->action),
+ info->counter);
/* Preprocess ambiguous actions when we need to work
* out if its a file or a directory that the action
@@ -1461,7 +1461,7 @@
{
GSList *list;
- tracker_log ("** TRAWLING THROUGH NEW MOUNT POINT '%s'", mount_point);
+ g_message ("** TRAWLING THROUGH NEW MOUNT POINT:'%s'", mount_point);
list = g_slist_prepend (NULL, (gchar*) mount_point);
process_directory_list (tracker, list, TRUE, db_con);
@@ -1474,7 +1474,7 @@
Tracker *tracker,
DBConnection *db_con)
{
- tracker_log ("** CLEANING UP OLD MOUNT POINT '%s'", mount_point);
+ g_message ("** CLEANING UP OLD MOUNT POINT:'%s'", mount_point);
process_index_delete_directory_check (tracker, mount_point, db_con);
}
@@ -1568,7 +1568,7 @@
/* Sleep for N secs before watching/indexing any of the major services */
initial_sleep = tracker_config_get_initial_sleep (tracker->config);
- tracker_log ("Sleeping for %d secs before starting...", initial_sleep);
+ g_message ("Sleeping for:%d secs before starting...", initial_sleep);
while (initial_sleep > 0) {
g_usleep (G_USEC_PER_SEC);
@@ -1581,7 +1581,7 @@
}
}
- tracker_log ("Proceeding with indexing...");
+ g_message ("Proceeding with indexing...");
tracker_index_stage_set (TRACKER_INDEX_STAGE_CONFIG);
@@ -1591,7 +1591,7 @@
first_run = TRUE;
moved_from_list = NULL;
- tracker_log ("Starting indexing...");
+ g_message ("Starting indexing...");
if (index_duration) {
g_timer_destroy (index_duration);
@@ -1718,7 +1718,9 @@
if (need_index) {
if (tracker_db_regulate_transactions (db_con, 250)) {
if (tracker_config_get_verbosity (tracker->config) == 1) {
- tracker_log ("indexing #%d - %s", tracker->index_count, info->uri);
+ g_message ("Indexing #%d, '%s'",
+ tracker->index_count,
+ info->uri);
}
/* Signal progress */
@@ -1753,7 +1755,7 @@
g_mutex_unlock (tracker->files_signal_mutex);
- tracker_log ("Process thread:%p now finishing", g_thread_self ());
+ g_message ("Process thread now finishing");
g_thread_exit (NULL);
return NULL;
@@ -1798,12 +1800,12 @@
/* Check if equal or a prefix with an appended '/' */
if (strcmp (uri, l->data) == 0) {
- tracker_log ("Blocking watch of %s (already being watched)", uri);
+ g_message ("Blocking watch of:'%s' (already being watched)", uri);
return FALSE;
}
if (process_is_in_path (uri, l->data)) {
- tracker_log ("Blocking watch of %s (already a watch in parent path)", uri);
+ g_message ("Blocking watch of:'%s' (already a watch in parent path)", uri);
return FALSE;
}
}
@@ -1863,9 +1865,9 @@
g_slist_free (crawl_directory_roots);
- tracker_log ("Indexer %s %s",
- should_be_crawled ? "crawling" : "blocking",
- uri);
+ g_message ("Indexer %s:'%s'",
+ should_be_crawled ? "crawling" : "blocking",
+ uri);
return should_be_crawled;
}
@@ -2013,7 +2015,7 @@
g_return_val_if_fail (info->uri != NULL, FALSE);
if (!g_utf8_validate (info->uri, -1, NULL)) {
- tracker_log ("Expected UTF-8 validation of TrackerDBFileInfo URI");
+ g_warning ("Expected UTF-8 validation of TrackerDBFileInfo URI");
return FALSE;
}
Modified: branches/xesam-support/src/trackerd/tracker-query-tree.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-query-tree.c (original)
+++ branches/xesam-support/src/trackerd/tracker-query-tree.c Tue May 20 08:18:14 2008
@@ -37,7 +37,7 @@
#include "tracker-query-tree.h"
#include "tracker-parser.h"
#include "tracker-utils.h"
-#include "tracker-service-manager.h"
+#include "tracker-ontology.h"
#define TRACKER_QUERY_TREE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_QUERY_TREE, TrackerQueryTreePrivate))
@@ -924,7 +924,7 @@
g_hash_table_insert (table, GINT_TO_POINTER (hit.service_type_id), GINT_TO_POINTER (count));
/* update service's parent count too (if it has a parent) */
- parent_id = tracker_service_manager_get_parent_id_for_service_id (hit.service_type_id);
+ parent_id = tracker_ontology_get_parent_id_for_service_id (hit.service_type_id);
if (parent_id != -1) {
count = GPOINTER_TO_INT (g_hash_table_lookup (table, GINT_TO_POINTER (parent_id)));
Modified: branches/xesam-support/src/trackerd/tracker-rdf-query.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-rdf-query.c (original)
+++ branches/xesam-support/src/trackerd/tracker-rdf-query.c Tue May 20 08:18:14 2008
@@ -690,14 +690,14 @@
return FALSE;
}
- if (field_data->data_type == DATA_DATE) {
+ if (field_data->data_type == TRACKER_FIELD_TYPE_DATE) {
char *bvalue;
int cvalue;
bvalue = tracker_date_format (avalue);
- tracker_debug (bvalue);
+ g_debug (bvalue);
cvalue = tracker_string_to_date (bvalue);
- tracker_debug ("%d", cvalue);
+ g_debug ("%d", cvalue);
value = tracker_int_to_string (cvalue);
g_free (bvalue);
} else {
@@ -726,7 +726,9 @@
if (sub) {
g_string_append_printf (str, " (%s glob '%s') ", field_data->where_field, data->current_value);
} else {
- if (field_data->data_type == DATA_DATE || field_data->data_type == DATA_INTEGER || field_data->data_type == DATA_DOUBLE) {
+ if (field_data->data_type == TRACKER_FIELD_TYPE_DATE
+ || field_data->data_type == TRACKER_FIELD_TYPE_INTEGER
+ || field_data->data_type == TRACKER_FIELD_TYPE_DOUBLE) {
g_string_append_printf (str, " (%s = %s) ", field_data->where_field, value);
} else {
g_string_append_printf (str, " (%s = '%s') ", field_data->where_field, value);
@@ -1014,7 +1016,7 @@
GError *error,
gpointer user_data)
{
- tracker_error ("ERROR: in rdf query parse: %s", error->message);
+ g_critical ("in rdf query parse: %s", error->message);
}
@@ -1025,7 +1027,7 @@
int type;
result = g_string_new ("");
- type = tracker_service_manager_get_id_for_service (service);
+ type = tracker_ontology_get_id_for_service_type (service);
switch (type) {
@@ -1082,7 +1084,7 @@
field_data = add_metadata_field (&data, fields[i], TRUE, FALSE);
if (!field_data) {
- tracker_error ("ERROR: RDF Query failed: field %s not found", fields[i]);
+ g_critical ("RDF Query failed: field %s not found", fields[i]);
g_slist_foreach (data.fields, (GFunc) tracker_free_metadata_field, NULL);
g_slist_free (data.fields);
g_string_free (data.sql_select, TRUE);
@@ -1098,7 +1100,7 @@
data.sql_from = g_string_new ("");
- tracker_debug ("search term is %s", search_text);
+ g_debug ("search term is %s", search_text);
if (!tracker_is_empty_string (search_text)) {
Modified: branches/xesam-support/src/trackerd/tracker-utils.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-utils.c (original)
+++ branches/xesam-support/src/trackerd/tracker-utils.c Tue May 20 08:18:14 2008
@@ -133,8 +133,8 @@
return;
}
- tracker_log ("File changes to:'%s' is causing tracker to pause...",
- uri);
+ g_message ("File changes to:'%s' is causing tracker to pause...",
+ uri);
tracker->grace_period++;
}
@@ -155,13 +155,13 @@
static gboolean reported = 0;
if (! reported) {
reported = 1;
- tracker_error ("Could not statvfs %s", tracker->data_dir);
+ g_critical ("Could not statvfs %s", tracker->data_dir);
}
return FALSE;
}
if (((long long) st.f_bavail * 100 / st.f_blocks) <= low_disk_space_limit) {
- tracker_error ("Disk space is low!");
+ g_critical ("Disk space is low!");
return TRUE;
}
Modified: branches/xesam-support/src/trackerd/tracker-xesam-query.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-query.c (original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-query.c Tue May 20 08:18:14 2008
@@ -827,17 +827,17 @@
g_string_append (str, " OR ");
}
- if (((FieldData *)field_data->data)->data_type == DATA_DATE) {
+ if (((FieldData *)field_data->data)->data_type == TRACKER_FIELD_TYPE_DATE) {
char *bvalue;
int cvalue;
bvalue = tracker_date_format (avalue);
- tracker_debug (bvalue);
+ g_debug (bvalue);
cvalue = tracker_string_to_date (bvalue);
- tracker_debug ("%d", cvalue);
+ g_debug ("%d", cvalue);
value = tracker_int_to_string (cvalue);
g_free (bvalue);
- } else if (state == STATE_END_BOOLEAN) { /* FIXME We do a state check here, because DATA_BOOLEAN is not in db */
+ } else if (state == STATE_END_BOOLEAN) { /* FIXME We do a state check here, because TRACKER_FIELD_TYPE_BOOLEAN is not in db */
if (!strcmp(avalue,"true")) {
value = g_strdup("1");
} else if(!strcmp(avalue,"false")) {
@@ -869,7 +869,9 @@
if (sub) {
g_string_append_printf (str, " (%s glob '%s') ", ((FieldData *)field_data->data)->where_field, data->current_value);
} else {
- if (((FieldData *)field_data->data)->data_type == DATA_DATE || ((FieldData *)field_data->data)->data_type == DATA_INTEGER || ((FieldData *)field_data->data)->data_type == DATA_DOUBLE) {
+ if (((FieldData *)field_data->data)->data_type == TRACKER_FIELD_TYPE_DATE
+ || ((FieldData *)field_data->data)->data_type == TRACKER_FIELD_TYPE_INTEGER
+ || ((FieldData *)field_data->data)->data_type == TRACKER_FIELD_TYPE_DOUBLE) {
g_string_append_printf (str, " (%s = %s) ", ((FieldData *)field_data->data)->where_field, value);
} else {
g_string_append_printf (str, " (%s = '%s') ", ((FieldData *)field_data->data)->where_field, value);
@@ -1164,7 +1166,7 @@
GError *error,
gpointer user_data)
{
- tracker_error ("ERROR: in rdf query parse: %s", error->message);
+ g_critical ("Failed to parse RDF query, %s", error->message);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]