tracker r1525 - in branches/xesam-support: . data src/libtracker-common src/libtracker-db src/tracker-indexer src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1525 - in branches/xesam-support: . data src/libtracker-common src/libtracker-db src/tracker-indexer src/trackerd
- Date: Thu, 29 May 2008 09:41:19 +0000 (UTC)
Author: pvanhoof
Date: Thu May 29 09:41:18 2008
New Revision: 1525
URL: http://svn.gnome.org/viewvc/tracker?rev=1525&view=rev
Log:
2008-05-29 Philip Van Hoof <pvanhoof gnome org>
* Merged xesam-support with indexer-split
svn merge -r 1502:1524 ../indexer-split
Added:
branches/xesam-support/data/org.freedesktop.Tracker.Indexer.service.in
- copied unchanged from r1524, /branches/indexer-split/data/org.freedesktop.Tracker.Indexer.service.in
branches/xesam-support/data/org.freedesktop.Tracker.service.in
- copied unchanged from r1524, /branches/indexer-split/data/org.freedesktop.Tracker.service.in
branches/xesam-support/data/tracker-indexer.xml
- copied unchanged from r1524, /branches/indexer-split/data/tracker-indexer.xml
branches/xesam-support/src/libtracker-common/tracker-dbus.c
- copied unchanged from r1524, /branches/indexer-split/src/libtracker-common/tracker-dbus.c
branches/xesam-support/src/libtracker-common/tracker-dbus.h
- copied unchanged from r1524, /branches/indexer-split/src/libtracker-common/tracker-dbus.h
branches/xesam-support/src/libtracker-db/tracker-db-dbus.c
- copied unchanged from r1524, /branches/indexer-split/src/libtracker-db/tracker-db-dbus.c
branches/xesam-support/src/libtracker-db/tracker-db-dbus.h
- copied unchanged from r1524, /branches/indexer-split/src/libtracker-db/tracker-db-dbus.h
branches/xesam-support/src/tracker-indexer/tracker-dbus.c
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-dbus.c
branches/xesam-support/src/tracker-indexer/tracker-dbus.h
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-dbus.h
branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-indexer-db.c
branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-indexer-db.h
branches/xesam-support/src/tracker-indexer/tracker-ioprio.c
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-ioprio.c
branches/xesam-support/src/tracker-indexer/tracker-ioprio.h
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-ioprio.h
branches/xesam-support/src/tracker-indexer/tracker-main.c
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-main.c
branches/xesam-support/src/tracker-indexer/tracker-metadata.c
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-metadata.c
branches/xesam-support/src/tracker-indexer/tracker-metadata.h
- copied unchanged from r1524, /branches/indexer-split/src/tracker-indexer/tracker-metadata.h
Removed:
branches/xesam-support/data/sqlite-service-stored-procs.sql
branches/xesam-support/data/tracker.service.in
branches/xesam-support/src/tracker-indexer/main.c
branches/xesam-support/src/trackerd/tracker-apps.c
branches/xesam-support/src/trackerd/tracker-apps.h
branches/xesam-support/src/trackerd/tracker-ioprio.c
branches/xesam-support/src/trackerd/tracker-ioprio.h
branches/xesam-support/src/trackerd/tracker-metadata.c
branches/xesam-support/src/trackerd/tracker-metadata.h
Modified:
branches/xesam-support/ChangeLog
branches/xesam-support/configure.ac
branches/xesam-support/data/Makefile.am
branches/xesam-support/src/libtracker-common/Makefile.am
branches/xesam-support/src/libtracker-db/Makefile.am
branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c
branches/xesam-support/src/tracker-indexer/Makefile.am
branches/xesam-support/src/tracker-indexer/tracker-indexer.c
branches/xesam-support/src/tracker-indexer/tracker-indexer.h
branches/xesam-support/src/trackerd/Makefile.am
branches/xesam-support/src/trackerd/tracker-db-sqlite.c
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-daemon.h
branches/xesam-support/src/trackerd/tracker-dbus-files.c
branches/xesam-support/src/trackerd/tracker-dbus-files.h
branches/xesam-support/src/trackerd/tracker-dbus-keywords.c
branches/xesam-support/src/trackerd/tracker-dbus-keywords.h
branches/xesam-support/src/trackerd/tracker-dbus-metadata.c
branches/xesam-support/src/trackerd/tracker-dbus-metadata.h
branches/xesam-support/src/trackerd/tracker-dbus-search.c
branches/xesam-support/src/trackerd/tracker-dbus-search.h
branches/xesam-support/src/trackerd/tracker-dbus-xesam.c
branches/xesam-support/src/trackerd/tracker-dbus-xesam.h
branches/xesam-support/src/trackerd/tracker-dbus.c
branches/xesam-support/src/trackerd/tracker-dbus.h
branches/xesam-support/src/trackerd/tracker-main.c
branches/xesam-support/src/trackerd/tracker-process-files.c
branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
Modified: branches/xesam-support/configure.ac
==============================================================================
--- branches/xesam-support/configure.ac (original)
+++ branches/xesam-support/configure.ac Thu May 29 09:41:18 2008
@@ -756,7 +756,7 @@
####################################################################
AC_MSG_CHECKING([[checking ioprio support]])
-ioprio_support=no
+have_ioprio=no
AC_RUN_IFELSE([ AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <errno.h>
@@ -769,8 +769,8 @@
]], [[
exit(ioprio_get(1,0));
]]) ],
- [ AC_DEFINE(IOPRIO_SUPPORT,[],[Define ioprio support]) ioprio_support=yes ])
-AC_MSG_RESULT([$ioprio_support])
+ [ AC_DEFINE(HAVE_IOPRIO,[],[Define ioprio support]) have_ioprio=yes ])
+AC_MSG_RESULT([$have_ioprio])
#####################################################
@@ -855,7 +855,7 @@
build with debug symbols: $enable_debug_code
file monitor backend to be used: $primary_backend
inotify header location: $inotify_header
- ioprio support: $ioprio_support
+ ioprio support: $have_ioprio
Win32: $native_win32
HAL support: $have_hal
unac accent stripper support: $enable_unac
Modified: branches/xesam-support/data/Makefile.am
==============================================================================
--- branches/xesam-support/data/Makefile.am (original)
+++ branches/xesam-support/data/Makefile.am Thu May 29 09:41:18 2008
@@ -2,33 +2,42 @@
configdir = $(datadir)/tracker
-config_DATA = \
- tracker-dbus-daemon.xml \
- tracker-dbus-files.xml \
- tracker-dbus-keywords.xml \
- tracker-dbus-metadata.xml \
- tracker-dbus-search.xml \
- tracker-dbus-xesam.xml \
- sqlite-tracker.sql \
- sqlite-cache.sql \
- sqlite-contents.sql \
- sqlite-email.sql \
- sqlite-service-stored-procs.sql \
- sqlite-service-triggers.sql \
- sqlite-tracker-triggers.sql \
- sqlite-user-data.sql \
- sqlite-stored-procs.sql \
- sqlite-service.sql \
- sqlite-service-types.sql \
- sqlite-metadata.sql \
+config_DATA = \
+ tracker-dbus-daemon.xml \
+ tracker-dbus-files.xml \
+ tracker-dbus-keywords.xml \
+ tracker-dbus-metadata.xml \
+ tracker-dbus-search.xml \
+ tracker-dbus-xesam.xml \
+ tracker-indexer.xml \
+ sqlite-tracker.sql \
+ sqlite-cache.sql \
+ sqlite-contents.sql \
+ sqlite-email.sql \
+ sqlite-service-triggers.sql \
+ sqlite-tracker-triggers.sql \
+ sqlite-user-data.sql \
+ sqlite-stored-procs.sql \
+ sqlite-service.sql \
+ sqlite-service-types.sql \
+ sqlite-metadata.sql \
sqlite-xesam.sql
-servicedir = $(DBUS_SERVICES_DIR)
-service_in_files = tracker.service.in
-service_DATA = tracker.service
+# Services
+org.freedesktop.Tracker_servicedir = $(DBUS_SERVICES_DIR)
+org.freedesktop.Tracker_service_DATA = org.freedesktop.Tracker.service
-CLEANFILES = $(service_DATA)
-EXTRA_DIST = $(config_DATA) $(service_in_files)
+org.freedesktop.Tracker.Indexer_servicedir = $(DBUS_SERVICES_DIR)
+org.freedesktop.Tracker.Indexer_service_DATA = org.freedesktop.Tracker.Indexer.service
%.service: %.service.in
@sed -e "s|\ bindir\@|$(bindir)|" $< > $@
+
+EXTRA_DIST = \
+ $(org.freedesktop.Tracker_service_DATA) \
+ $(org.freedesktop.Tracker.Indexer_service_DATA) \
+ $(config_DATA)
+
+CLEANFILES = \
+ $(org.freedesktop.Tracker_service_DATA) \
+ $(org.freedesktop.Tracker.Indexer_service_DATA)
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 Thu May 29 09:41:18 2008
@@ -2,9 +2,10 @@
-DSHAREDIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"Tracker\" \
-I$(top_srcdir)/src \
- $(GLIB2_CFLAGS) \
+ $(HAL_CFLAGS) \
+ $(DBUS_CFLAGS) \
$(PANGO_CFLAGS) \
- $(HAL_CFLAGS)
+ $(GLIB2_CFLAGS)
noinst_LTLIBRARIES = libtracker-common.la
@@ -27,6 +28,8 @@
tracker-configuration.h \
tracker-config.c \
tracker-config.h \
+ tracker-dbus.c \
+ tracker-dbus.h \
tracker-field.c \
tracker-field.h \
tracker-field-data.c \
@@ -55,7 +58,8 @@
libtracker_common_la_LDFLAGS = -version-info 0:0:0
libtracker_common_la_LIBADD = \
- $(GLIB2_LIBS) \
+ $(HAL_LIBS) \
+ $(DBUS_LIBS) \
$(PANGO_LIBS) \
- $(HAL_LIBS)
+ $(GLIB2_LIBS)
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 Thu May 29 09:41:18 2008
@@ -3,15 +3,18 @@
-DSHAREDIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"Tracker\" \
-I$(top_srcdir)/src \
- $(GLIB2_CFLAGS) \
$(SQLITE3_CFLAGS) \
- $(QDBM_CFLAGS)
+ $(QDBM_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ $(GLIB2_CFLAGS)
noinst_LTLIBRARIES = libtracker-db.la
libtracker_db_la_SOURCES = \
tracker-db-action.c \
tracker-db-action.h \
+ tracker-db-dbus.c \
+ tracker-db-dbus.h \
tracker-db-file-info.c \
tracker-db-file-info.h \
tracker-db-interface.c \
@@ -23,6 +26,7 @@
libtracker_db_la_LDFLAGS = -version-info 0:0:0
libtracker_db_la_LIBADD = \
- $(GLIB2_LIBS) \
$(SQLITE3_LIBS) \
- $(QDBM_LIBS)
+ $(QDBM_LIBS) \
+ $(DBUS_LIBS) \
+ $(GLIB2_LIBS)
Modified: branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-interface-sqlite.c Thu May 29 09:41:18 2008
@@ -132,7 +132,10 @@
g_free (priv->filename);
g_hash_table_destroy (priv->statements);
- g_hash_table_unref (priv->procedures);
+
+ if (priv->procedures) {
+ g_hash_table_unref (priv->procedures);
+ }
g_slist_foreach (priv->function_data, (GFunc) g_free, NULL);
g_slist_free (priv->function_data);
@@ -175,9 +178,6 @@
priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
- priv->procedures = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) g_free);
priv->statements = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) sqlite3_finalize);
@@ -317,7 +317,15 @@
TrackerDBInterfaceSqlitePrivate *priv;
priv = TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE (db_interface);
- priv->procedures = g_hash_table_ref (procedure_table);
+
+ if (priv->procedures) {
+ g_hash_table_unref (priv->procedures);
+ priv->procedures = NULL;
+ }
+
+ if (procedure_table) {
+ priv->procedures = g_hash_table_ref (procedure_table);
+ }
}
static TrackerDBResultSet *
Modified: branches/xesam-support/src/tracker-indexer/Makefile.am
==============================================================================
--- branches/xesam-support/src/tracker-indexer/Makefile.am (original)
+++ branches/xesam-support/src/tracker-indexer/Makefile.am Thu May 29 09:41:18 2008
@@ -5,49 +5,50 @@
-DLIBDIR=\""$(libdir)"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-DINDEXER_MODULES_DIR=\""$(libdir)"/tracker/indexer-modules\" \
- $(GLIB2_CFLAGS) \
+ -DG_LOG_DOMAIN=\"Tracker-Indexer\" \
+ -I$(top_srcdir)/src \
+ $(DBUS_CFLAGS) \
$(GMODULE_CFLAGS) \
- -I$(top_srcdir)/src
+ $(GLIB2_CFLAGS)
bin_PROGRAMS = tracker-indexer
tracker_indexer_SOURCES = \
- main.c \
+ tracker-dbus.c \
+ tracker-dbus.h \
+ tracker-ioprio.c \
+ tracker-ioprio.h \
tracker-indexer.c \
tracker-indexer.h \
+ tracker-indexer-db.c \
+ tracker-indexer-db.h \
tracker-indexer-module.c \
- tracker-indexer-module.h
+ tracker-indexer-module.h \
+ tracker-main.c \
+ tracker-metadata.c \
+ tracker-metadata.h
tracker_indexer_LDADD = \
- $(GLIB2_LIBS) \
- $(GMODULE_LIBS) \
- $(GTHREAD_LIBS) \
- -lz \
- -lm \
$(top_builddir)/src/libtracker-db/libtracker-db.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(top_builddir)/src/libstemmer/libstemmer-private.la \
$(top_builddir)/src/xdgmime/libxdgmime.la \
- $(trackerd_win_libs)
+ $(trackerd_win_libs) \
+ $(DBUS_LIBS) \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GLIB2_LIBS) \
+ -lz \
+ -lm
+
+dbus_sources = \
+ tracker-indexer-glue.h
+
+%-glue.h: $(top_builddir)/data/%.xml
+ $(DBUSBINDINGTOOL) --mode=glib-server --output=$@ --prefix=$(subst -,_,$*) $^
+
+BUILT_SOURCES = $(dbus_sources)
+
+CLEANFILES = $(BUILT_SOURCES)
-# mail_modules_LTLIBRARIES = \
-# libemail-evolution.la \
-# libemail-thunderbird.la \
-# libemail-kmail.la \
-# libemail-modest.la
-
-# libemail_modest_la_SOURCES = tracker-email-modest.c
-# libemail_modest_la_LDFLAGS = $(module_flags)
-# libemail_modest_la_LIBADD = $(GLIB2_LIBS)
-
-# libemail_evolution_la_SOURCES = tracker-email-evolution.c
-# libemail_evolution_la_LDFLAGS = $(module_flags)
-# libemail_evolution_la_LIBADD = $(GLIB2_LIBS)
-
-# libemail_thunderbird_la_SOURCES = tracker-email-thunderbird.c
-# libemail_thunderbird_la_LDFLAGS = $(module_flags)
-# libemail_thunderbird_la_LIBADD = $(GLIB2_LIBS)
-
-# libemail_kmail_la_SOURCES = tracker-email-kmail.c
-# libemail_kmail_la_LDFLAGS = $(module_flags)
-# libemail_kmail_la_LIBADD = $(GLIB2_LIBS)
+EXTRA_DIST = $(BUILT_SOURCES)
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 Thu May 29 09:41:18 2008
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
+/*
* Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
* Copyright (C) 2008, Nokia
@@ -54,6 +54,7 @@
#include "tracker-indexer.h"
#include "tracker-indexer-module.h"
+#include "tracker-indexer-db.h"
#define TRACKER_INDEXER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_INDEXER, TrackerIndexerPrivate))
@@ -73,6 +74,7 @@
DEPOT *index;
TrackerDBInterface *metadata;
TrackerDBInterface *contents;
+ TrackerDBInterface *common;
TrackerConfig *config;
@@ -140,6 +142,14 @@
g_object_unref (priv->config);
+ if (priv->common) {
+ g_object_unref (priv->common);
+ }
+
+ if (priv->metadata) {
+ g_object_unref (priv->metadata);
+ }
+
G_OBJECT_CLASS (tracker_indexer_parent_class)->finalize (object);
}
@@ -233,30 +243,13 @@
tracker_dir_remove (priv->db_dir);
}
+ priv->common = tracker_indexer_db_get_common ();
+ priv->metadata = tracker_indexer_db_get_file_metadata ();
+
tracker_indexer_set_running (indexer, TRUE);
return FALSE;
}
-TrackerDBInterface *
-create_db_interface (const gchar *filename)
-{
-#if 0
- TrackerDBInterface *interface;
- gchar *path;
-
- path = g_build_filename (g_get_user_cache_dir (),
- "tracker",
- filename,
- NULL);
-
- interface = tracker_db_interface_sqlite_new (path);
- g_free (path);
-
- return interface;
-#endif
- return NULL;
-}
-
static void
tracker_indexer_init (TrackerIndexer *indexer)
{
@@ -273,8 +266,6 @@
priv->db_dir = g_build_filename (g_get_user_cache_dir (),
"tracker", NULL);
- priv->index = create_db_interface ("file-meta.db");
-
priv->module_names = tracker_config_get_index_modules (priv->config);
priv->indexer_modules = g_hash_table_new_full (g_direct_hash,
@@ -337,7 +328,7 @@
if (!ignore) {
g_queue_push_tail (priv->dir_queue, info);
} else {
- g_message ("Ignoring directory: %s\n", info->path);
+ g_message ("Ignoring directory:'%s'", info->path);
path_info_free (info);
}
@@ -350,24 +341,30 @@
{
GHashTable *metadata;
- g_message ("Processing file: %s\n", info->path);
+ g_message ("Processing file:'%s'", info->path);
metadata = tracker_indexer_module_get_file_metadata (info->module, info->path);
if (metadata) {
- /* FIXME: store metadata in DB */
- GList *keys, *k;
-
- keys = g_hash_table_get_keys (metadata);
-
- for (k = keys; k; k = k->next) {
- g_print (" %s = %s\n",
- (gchar *) k->data,
- (gchar *) g_hash_table_lookup (metadata, k->data));
+ TrackerIndexerPrivate *priv;
+ const gchar *service_type;
+ guint32 id;
+
+ priv = TRACKER_INDEXER_GET_PRIVATE (indexer);
+
+ service_type = tracker_indexer_module_get_name (info->module);
+ id = tracker_db_get_new_service_id (priv->common);
+
+ if (tracker_db_create_service (priv->metadata, id, service_type, info->path, metadata)) {
+ tracker_db_increment_stats (priv->common, service_type);
+
+ /* FIXME
+ if (tracker_config_get_enable_xesam (tracker->config))
+ tracker_db_create_event (db_con, id, "Create");
+ */
}
g_hash_table_destroy (metadata);
- g_list_free (keys);
}
}
@@ -379,7 +376,7 @@
const gchar *name;
GDir *dir;
- g_message ("Processing directory: %s\n", info->path);
+ g_message ("Processing directory:'%s'", info->path);
dir = g_dir_open (info->path, 0, NULL);
@@ -416,7 +413,7 @@
gchar **dirs;
gint i;
- g_message ("Starting module: %s\n", module_name);
+ g_message ("Starting module:'%s'", module_name);
priv = TRACKER_INDEXER_GET_PRIVATE (indexer);
module = g_hash_table_lookup (priv->indexer_modules, module_name);
@@ -448,15 +445,15 @@
priv = TRACKER_INDEXER_GET_PRIVATE (indexer);
if ((path = g_queue_pop_head (priv->file_process_queue)) != NULL) {
- /* process file */
+ /* Process file */
process_file (indexer, path);
path_info_free (path);
} else if ((path = g_queue_pop_head (priv->dir_queue)) != NULL) {
- /* process directory contents */
+ /* Process directory contents */
process_directory (indexer, path, TRUE);
path_info_free (path);
} else {
- /* dirs/files queues are empty, process the next module */
+ /* Dirs/files queues are empty, process the next module */
if (!priv->current_module) {
priv->current_module = priv->module_names;
} else {
@@ -464,7 +461,7 @@
}
if (!priv->current_module) {
- /* no more modules to query, we're done */
+ /* No more modules to query, we're done */
g_signal_emit (indexer, signals[FINISHED], 0);
return FALSE;
}
Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer.h
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer.h (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer.h Thu May 29 09:41:18 2008
@@ -22,7 +22,9 @@
#ifndef __TRACKER_INDEXER_H__
#define __TRACKER_INDEXER_H__
-#include <glib.h>
+#define TRACKER_INDEXER_SERVICE "org.freedesktop.Tracker.Indexer"
+#define TRACKER_INDEXER_PATH "/org/freedesktop/Tracker/Indexer"
+#define TRACKER_INDEXER_INTERFACE "org.freedesktop.Tracker.Indexer"
G_BEGIN_DECLS
Modified: branches/xesam-support/src/trackerd/Makefile.am
==============================================================================
--- branches/xesam-support/src/trackerd/Makefile.am (original)
+++ branches/xesam-support/src/trackerd/Makefile.am Thu May 29 09:41:18 2008
@@ -6,15 +6,16 @@
-DMAIL_MODULES_DIR=\""$(libdir)"/tracker/mail-modules\" \
-DG_LOG_DOMAIN=\"Tracker\" \
-I$(top_srcdir)/src \
- $(GLIB2_CFLAGS) \
- $(GMODULE_CFLAGS) \
- $(PANGO_CFLAGS) \
$(GMIME_CFLAGS) \
$(FAM_CFLAGS) \
- $(DBUS_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(QDBM_CFLAGS) \
- $(UNAC_CFLAGS)
+ $(UNAC_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ $(PANGO_CFLAGS) \
+ $(GMODULE_CFLAGS) \
+ $(GTHREAD_CFLAGS) \
+ $(GLIB2_CFLAGS)
if HAVE_INOTIFY
watch_sources = \
@@ -64,8 +65,6 @@
$(watch_sources) \
$(win_sources) \
$(unix_sources) \
- tracker-apps.c \
- tracker-apps.h \
tracker-cache.c \
tracker-cache.h \
tracker-db.c \
@@ -99,8 +98,6 @@
tracker-main.c \
tracker-main.h \
tracker-marshal-main.c \
- tracker-metadata.c \
- tracker-metadata.h \
tracker-process-files.c \
tracker-process-files.h \
tracker-query-tree.c \
@@ -109,8 +106,6 @@
tracker-rdf-query.h \
tracker-utils.c \
tracker-utils.h \
- tracker-ioprio.c \
- tracker-ioprio.h \
tracker-watch.h \
tracker-status.c \
tracker-status.h \
@@ -130,23 +125,23 @@
endif
trackerd_LDADD = \
- $(GLIB2_LIBS) \
- $(GMODULE_LIBS) \
- $(FAM_LIBS) \
- $(DBUS_LIBS) \
- $(PANGO_LIBS) \
+ $(top_builddir)/src/libtracker-db/libtracker-db.la \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(top_builddir)/src/libstemmer/libstemmer-private.la \
+ $(top_builddir)/src/xdgmime/libxdgmime.la \
$(GMIME_LIBS) \
+ $(FAM_LIBS) \
$(SQLITE3_LIBS) \
$(QDBM_LIBS) \
$(UNAC_LIBS) \
+ $(DBUS_LIBS) \
+ $(PANGO_LIBS) \
+ $(GMODULE_LIBS) \
$(GTHREAD_LIBS) \
+ $(GLIB2_LIBS) \
+ $(trackerd_win_libs) \
-lz \
- -lm \
- $(top_builddir)/src/libtracker-db/libtracker-db.la \
- $(top_builddir)/src/libtracker-common/libtracker-common.la \
- $(top_builddir)/src/libstemmer/libstemmer-private.la \
- $(top_builddir)/src/xdgmime/libxdgmime.la \
- $(trackerd_win_libs)
+ -lm
tracker-marshal.h: tracker-marshal.list
$(GLIB_GENMARSHAL) $< --prefix=tracker_marshal --header > $@
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 Thu May 29 09:41:18 2008
@@ -42,7 +42,6 @@
#include "tracker-db-sqlite.h"
#include "tracker-indexer.h"
#include "tracker-cache.h"
-#include "tracker-metadata.h"
#include "tracker-main.h"
#include "tracker-utils.h"
#include "tracker-watch.h"
@@ -1553,13 +1552,6 @@
return !tracker_db_manager_file_exists (TRACKER_DB_COMMON);
}
-static gint
-tracker_metadata_is_key (const gchar *service, const gchar *meta_name)
-{
- return tracker_ontology_metadata_key_in_service (service, meta_name);
-}
-
-
static inline gboolean
is_equal (const char *s1, const char *s2)
{
@@ -1567,10 +1559,13 @@
}
/* Replace with tracker_ontology_get_field_column_in_services */
-char *
-tracker_db_get_field_name (const char *service, const char *meta_name)
+gchar *
+tracker_db_get_field_name (const gchar *service,
+ const gchar *meta_name)
{
- int key_field = tracker_metadata_is_key (service, meta_name);
+ gint key_field;
+
+ key_field = tracker_ontology_metadata_key_in_service (service, meta_name);
if (key_field > 0) {
return g_strdup_printf ("KeyMetadata%d", key_field);
@@ -3058,12 +3053,20 @@
}
void
-tracker_db_delete_metadata_value (DBConnection *db_con, const char *service, const char *id, const char *key, const char *value)
+tracker_db_delete_metadata_value (DBConnection *db_con,
+ const gchar *service,
+ const gchar *id,
+ const gchar *key,
+ const gchar *value)
{
- char *old_value = NULL, *new_value = NULL, *mvalue;
TrackerField *def;
+ gchar *old_value = NULL;
+ gchar *new_value = NULL;
+ gchar *mvalue;
+ gchar *res_service;
gboolean update_index;
+ gint key_field;
g_return_if_fail (id && key && service && db_con);
@@ -3074,29 +3077,26 @@
return;
}
-
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);
+ res_service = tracker_db_get_service_for_entity (db_con, id);
if (!res_service) {
g_warning ("Entity not found");
return;
}
- int key_field = tracker_metadata_is_key (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);
+ 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;
+
if (update_index) {
-
- /* get current value and claculate the new value */
-
+ /* Get current value and claculate the new value */
old_value = tracker_db_get_metadata_delimited (db_con, service, id, key);
if (old_value) {
@@ -3105,11 +3105,9 @@
g_free (res_service);
return;
}
-
}
-
- /* perform deletion */
+ /* Perform deletion */
switch (tracker_field_get_data_type (def)) {
case TRACKER_FIELD_TYPE_INDEX:
@@ -3133,13 +3131,11 @@
case TRACKER_FIELD_TYPE_INTEGER:
case TRACKER_FIELD_TYPE_DATE:
-
tracker_exec_proc (db_con, "DeleteMetadataNumericValue", id, tracker_field_get_id (def), value, NULL);
break;
case TRACKER_FIELD_TYPE_KEYWORD:
-
tracker_exec_proc (db_con, "DeleteMetadataKeywordValue", id, tracker_field_get_id (def), value, NULL);
break;
@@ -3149,13 +3145,11 @@
tracker_field_get_data_type (def),
key);
break;
-
-
}
if (key_field > 0) {
TrackerDBResultSet *result_set;
- gchar *value;
+ gchar *value;
result_set = tracker_db_get_metadata (db_con, service, id, key);
@@ -3163,7 +3157,9 @@
tracker_db_result_set_get (result_set, 0, &value, -1);
if (value) {
- char *esc_value = tracker_escape_string (value);
+ gchar *esc_value;
+
+ esc_value = tracker_escape_string (value);
tracker_db_exec_no_reply (db_con->db,
"update Services set KeyMetadata%d = '%s' where id = %s",
@@ -3185,8 +3181,7 @@
}
}
-
- /* update fulltext index differentially with old and new values */
+ /* Update fulltext index differentially with old and new values */
if (update_index) {
update_metadata_index (id, service, def, old_value, new_value);
}
@@ -3195,21 +3190,24 @@
g_free (old_value);
g_free (res_service);
-
}
-
void
-tracker_db_delete_metadata (DBConnection *db_con, const char *service, const char *id, const char *key, gboolean update_indexes)
+tracker_db_delete_metadata (DBConnection *db_con,
+ const gchar *service,
+ const gchar *id,
+ const gchar *key,
+ gboolean update_indexes)
{
- char *old_value = NULL;
- TrackerField *def;
- gboolean update_index;
+ TrackerField *def;
+ gchar *old_value = NULL;
+ gchar *res_service;
+ gboolean update_index;
+ gint key_field;
g_return_if_fail (id && key && service && db_con);
-
- /* get type details */
+ /* Get type details */
def = tracker_ontology_get_field_def(key);
if (!def) {
@@ -3221,66 +3219,59 @@
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);
+ res_service = tracker_db_get_service_for_entity (db_con, id);
if (!res_service) {
g_warning ("Entity not found");
return;
}
+ key_field = tracker_ontology_metadata_key_in_service (res_service, key);
- int key_field = tracker_metadata_is_key (res_service, key);
-
- update_index = update_indexes && (tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_INDEX || tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_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);
}
-
-
if (key_field > 0) {
tracker_db_exec_no_reply (db_con->db,
"update Services set KeyMetadata%d = NULL where id = %s",
key_field, id);
}
-
-
- /* perform deletion */
+
+ /* Perform deletion */
switch (tracker_field_get_data_type (def)) {
-
- 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 TRACKER_FIELD_TYPE_INTEGER:
- case TRACKER_FIELD_TYPE_DATE:
- tracker_exec_proc (db_con, "DeleteMetadataNumeric", id, tracker_field_get_id (def), NULL);
- break;
-
+ 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 TRACKER_FIELD_TYPE_KEYWORD:
- tracker_exec_proc (db_con, "DeleteMetadataKeyword", id, tracker_field_get_id (def), NULL);
- break;
-
- case TRACKER_FIELD_TYPE_FULLTEXT:
-
- tracker_exec_proc (db_con, "DeleteContent", id, tracker_field_get_id (def), NULL);
- break;
-
- default:
- 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;
-
+ 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 TRACKER_FIELD_TYPE_KEYWORD:
+ tracker_exec_proc (db_con, "DeleteMetadataKeyword", id, tracker_field_get_id (def), NULL);
+ break;
+
+ case TRACKER_FIELD_TYPE_FULLTEXT:
+ tracker_exec_proc (db_con, "DeleteContent", id, tracker_field_get_id (def), NULL);
+ break;
+
+ default:
+ 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;
}
@@ -3288,12 +3279,9 @@
if (update_index && old_value) {
update_metadata_index (id, service, def, old_value, " ");
}
-
g_free (old_value);
g_free (res_service);
-
-
}
TrackerDBResultSet*
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 Thu May 29 09:41:18 2008
@@ -35,7 +35,6 @@
#include "tracker-db.h"
#include "tracker-email.h"
-#include "tracker-metadata.h"
#include "tracker-process-files.h"
extern Tracker *tracker;
@@ -359,26 +358,6 @@
return (gchar **) g_ptr_array_free (array, FALSE);
}
-
-gboolean
-tracker_metadata_is_date (DBConnection *db_con, const char *meta)
-{
- TrackerField *def;
-
- def = tracker_ontology_get_field_def (meta);
-
- if (!def) {
- 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);
-
- return tracker_field_get_data_type (def) == TRACKER_FIELD_TYPE_DATE;
-}
-
-
TrackerDBFileInfo *
tracker_db_get_pending_file (DBConnection *db_con, const char *uri)
{
@@ -844,14 +823,22 @@
void
-tracker_db_index_service (DBConnection *db_con, TrackerDBFileInfo *info, const char *service, GHashTable *meta_table, const char *attachment_uri, const char *attachment_service, gboolean get_embedded, gboolean get_full_text, gboolean get_thumbs)
-{
- char *str_file_id;
- const char *uri;
- GHashTable *index_table, *old_table;
+tracker_db_index_service (DBConnection *db_con,
+ TrackerDBFileInfo *info,
+ const gchar *service,
+ GHashTable *meta_table,
+ const gchar *attachment_uri,
+ const gchar *attachment_service,
+ gboolean get_embedded,
+ gboolean get_full_text,
+ gboolean get_thumbs)
+{
+ gchar *str_file_id;
+ const gchar *uri;
+ GHashTable *index_table, *old_table;
if (!service) {
- /* its an external service - TODO get external service name */
+ /* It's an external service - TODO get external service name */
if (service) {
g_message ("External service %s not supported yet", service);
} else {
@@ -893,8 +880,6 @@
uri, service);
}
-
-
if (!info->is_new) {
old_table = g_hash_table_new (g_str_hash, g_str_equal);
} else {
@@ -903,15 +888,26 @@
index_table = g_hash_table_new (g_str_hash, g_str_equal);
+#if 0
+ /* FIXME-indexer-split: This has been commented out as a
+ * result of moving tracker-metadata.[ch] to the indexer
+ * directory. This code will be removed when this function is
+ * updated to work correctly in the indexer application.
+ *
+ * -Martyn
+ */
+
/* get embedded metadata filter */
if (get_embedded && meta_table) {
tracker_metadata_get_embedded (info->uri, info->mime, meta_table);
}
+#endif
if (info->is_new) {
+ gchar *old_uri;
- char *old_uri = info->uri;
- info->uri = (char *) uri;
+ old_uri = info->uri;
+ info->uri = (gchar *) uri;
if (attachment_service) {
info->file_id = tracker_db_create_service (db_con, attachment_service, info);
@@ -934,12 +930,19 @@
str_file_id = tracker_uint_to_string (info->file_id);
if (get_thumbs && tracker_config_get_enable_thumbnails (tracker->config)) {
- char *small_thumb_file = NULL;
+#if 0
+ gchar *small_thumb_file = NULL;
+ /* FIXME-indexer-split: This has been commented out as a
+ * result of moving tracker-metadata.[ch] to the indexer
+ * directory. This code will be removed when this function is
+ * updated to work correctly in the indexer application.
+ *
+ * -Martyn
+ */
small_thumb_file = tracker_metadata_get_thumbnail (info->uri, info->mime, "normal");
-
g_free (small_thumb_file);
-
+#endif
}
@@ -950,13 +953,25 @@
if (get_full_text && tracker_config_get_enable_content_indexing (tracker->config)) {
- char *file_as_text;
+ gchar *file_as_text = NULL;
+#if 0
+ /* FIXME-indexer-split: This has been commented out as a
+ * result of moving tracker-metadata.[ch] to the indexer
+ * directory. This code will be removed when this function is
+ * updated to work correctly in the indexer application.
+ *
+ * -Martyn
+ */
file_as_text = tracker_metadata_get_text_file (info->uri, info->mime);
+#endif
if (file_as_text) {
-
- tracker_db_save_file_contents (db_con, index_table, old_table, file_as_text, info);
+ tracker_db_save_file_contents (db_con,
+ index_table,
+ old_table,
+ file_as_text,
+ info);
/* clear up if text contents are in a temp file */
if (g_str_has_prefix (file_as_text, tracker_get_sys_tmp_dir ())) {
@@ -964,45 +979,34 @@
}
g_free (file_as_text);
-
} else {
get_full_text = FALSE;
}
-
}
if (attachment_service) {
info->service_type_id = tracker_ontology_get_id_for_service_type (attachment_service);
}
- /* save stuff to Db */
-
-
-
+ /* Save stuff to Db */
if (!info->is_new) {
-
- /* update existing file entry */
+ /* Update existing file entry */
tracker_db_update_file (db_con, info);
- /* get original embedded metadata for the differential indexer */
+ /* Get original embedded metadata for the differential indexer */
old_table = tracker_db_get_indexable_content_words (db_con, info->file_id, old_table, TRUE);
- /* delete any exisitng embedded metadata */
+ /* Delete any exisitng embedded metadata */
tracker_exec_proc (db_con, "DeleteEmbeddedServiceMetadata1", str_file_id, NULL);
tracker_exec_proc (db_con, "DeleteEmbeddedServiceMetadata2", str_file_id, NULL);
tracker_exec_proc (db_con, "DeleteEmbeddedServiceMetadata3", str_file_id, NULL);
-
}
if (meta_table && (g_hash_table_size (meta_table) > 0)) {
tracker_db_save_metadata (db_con, meta_table, index_table, service, info->file_id, info->is_new);
}
-
-
-
-
- /* update full text indexes */
+ /* Update full text indexes */
if (info->is_new) {
tracker_db_update_indexes_for_new_service (info->file_id, info->service_type_id, index_table);
} else {
@@ -1012,19 +1016,19 @@
tracker_parser_text_free (index_table);
tracker_parser_text_free (old_table);
- /* check for backup user defined metadata */
+ /* Check for backup user defined metadata */
if (info->is_new) {
TrackerDBResultSet *result_set;
- char *name = tracker_file_get_vfs_name (info->uri);
- char *path = tracker_file_get_vfs_path (info->uri);
+ gchar *name = tracker_file_get_vfs_name (info->uri);
+ gchar *path = tracker_file_get_vfs_path (info->uri);
result_set = tracker_exec_proc (db_con->common, "GetBackupMetadata", path, name, NULL);
if (result_set) {
- gboolean valid = TRUE;
- GHashTable *meta_table;
- DatabaseAction db_action;
- gchar *key, *value;
+ gboolean valid = TRUE;
+ GHashTable *meta_table;
+ DatabaseAction db_action;
+ gchar *key, *value;
meta_table = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
@@ -1062,7 +1066,6 @@
g_free (path);
}
-
g_free (str_file_id);
}
@@ -1109,16 +1112,23 @@
void
-tracker_db_index_file (DBConnection *db_con, TrackerDBFileInfo *info, const char *attachment_uri, const char *attachment_service)
-{
-
- GHashTable *meta_table;
- const char *ext;
- char *filename, *dirname;
- char *str_link_uri, *service_name;
- gboolean is_file_indexable, service_has_metadata, is_external_service, service_has_fulltext, service_has_thumbs, is_sidecar;
-
- const char *uri;
+tracker_db_index_file (DBConnection *db_con,
+ TrackerDBFileInfo *info,
+ const gchar *attachment_uri,
+ const gchar *attachment_service)
+{
+
+ GHashTable *meta_table;
+ const gchar *ext;
+ const gchar *uri;
+ gchar *filename, *dirname;
+ gchar *str_link_uri, *service_name;
+ gboolean is_file_indexable;
+ gboolean is_external_service;
+ gboolean is_sidecar;
+ gboolean service_has_metadata;
+ gboolean service_has_fulltext;
+ gboolean service_has_thumbs;
if (!attachment_uri) {
uri = info->uri;
@@ -1145,91 +1155,124 @@
info->mime, info->uri);
service_name = tracker_ontology_get_service_type_for_mime (info->mime);
-
}
if (info->is_link) {
- str_link_uri = g_build_filename (info->link_path, info->link_name, NULL);
+ str_link_uri = g_build_filename (info->link_path,
+ info->link_name,
+ NULL);
} else {
str_link_uri = NULL;
}
if (!info->is_hidden) {
-
- meta_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) free_metadata_list);
-
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:NameDelimited"), g_strdup (uri));
+ meta_table = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ (GDestroyNotify) free_metadata_list);
+
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:NameDelimited"),
+ g_strdup (uri));
dirname = g_path_get_dirname (uri);
filename = g_path_get_basename (uri);
ext = strrchr (filename, '.');
+
if (ext) {
ext++;
g_debug ("file extension is %s", ext);
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:Ext"), g_strdup (ext));
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:Ext"),
+ g_strdup (ext));
is_sidecar = strcmp("xmp",ext) == 0;
} else {
is_sidecar = FALSE;
}
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:Path"), g_strdup (dirname));
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:Name"), g_strdup (filename));
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:Path"),
+ g_strdup (dirname));
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:Name"),
+ g_strdup (filename));
if (str_link_uri) {
tracker_add_metadata_to_table (meta_table, g_strdup ("File:Link"), str_link_uri);
}
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:Mime"), g_strdup (info->mime));
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:Size"), tracker_uint_to_string (info->file_size));
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:Modified"), tracker_date_to_string (info->mtime));
- tracker_add_metadata_to_table (meta_table, g_strdup ("File:Accessed"), tracker_date_to_string (info->atime));
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:Mime"),
+ g_strdup (info->mime));
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:Size"),
+ tracker_uint_to_string (info->file_size));
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:Modified"),
+ tracker_date_to_string (info->mtime));
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("File:Accessed"),
+ tracker_date_to_string (info->atime));
/* need to add special data for web history */
- if (attachment_service != NULL && strcmp(attachment_service,"WebHistory") == 0) {
-
- gchar* meta_file = g_strconcat(dirname,"/.",filename,NULL);
-
- FILE* fp = g_fopen(meta_file, "r");
+ if (attachment_service != NULL &&
+ strcmp(attachment_service,"WebHistory") == 0) {
+ gchar *meta_file;
+ FILE *fp;
+
+ meta_file = g_strconcat(dirname,"/.",filename,NULL);
+ fp = g_fopen(meta_file, "r");
if (fp != NULL) {
- char buf[512];
+ gchar buf[512];
- fgets(buf,512,fp); //get the first line, it is URL for this web history object
+ fgets (buf,512,fp); /* Get the first
+ * line, it is
+ * URL for this
+ * web history
+ * object
+ */
+
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);
- fgets(buf,512,fp);
- fgets(buf,512,fp);
- fgets(buf,512,fp); // get the keywords for this file
+ fgets (buf,512,fp);
+ fgets (buf,512,fp);
+ fgets (buf,512,fp);
+ fgets (buf,512,fp); /* Get the
+ * keywords for
+ * this file
+ */
if (buf != NULL) {
-
- /* format like t:dc:keyword=xxx */
- gchar** keys = g_strsplit (buf,"=",0);
-
- if (keys != NULL && strcmp(keys[0],"t:dc:keyword") == 0 && keys[1]) {
+ gchar **keys;
- char *doc_keyword = g_strdup (keys[1]);
+ /* Format like t:dc:keyword=xxx */
+ keys = g_strsplit (buf, "=", 0);
+
+ if (keys != NULL &&
+ strcmp (keys[0], "t:dc:keyword") == 0 &&
+ keys[1]) {
+ gchar *doc_keyword;
+ doc_keyword = g_strdup (keys[1]);
g_debug("found keywords : %s\n",doc_keyword);
-
- tracker_add_metadata_to_table (meta_table, g_strdup ("Doc:Keywords"), doc_keyword);
+ tracker_add_metadata_to_table (meta_table,
+ g_strdup ("Doc:Keywords"),
+ doc_keyword);
}
-
-
- if (keys) g_strfreev(keys);
-
-
+
+ if (keys) {
+ g_strfreev(keys);
+ }
}
fclose (fp);
}
+
g_free (meta_file);
}
-
-
is_external_service = g_str_has_prefix (info->mime, "service/");
is_file_indexable = (!info->is_directory &&
(strcmp (info->mime, "unknown") != 0) &&
@@ -1250,13 +1293,13 @@
(is_external_service ||
(is_file_indexable &&
tracker_ontology_service_type_has_thumbnails (service_name)));
-
- #ifdef HAVE_EXEMPI
+
+#ifdef HAVE_EXEMPI
if (!info->is_directory) {
gchar *basename;
if (ext) {
- basename = g_strndup (filename, (ext - filename -1));
+ basename = g_strndup (filename, (ext - filename - 1));
} else {
basename = g_strdup (filename);
}
@@ -1264,43 +1307,71 @@
if (is_sidecar) {
tracker_db_index_master_files (db_con, dirname, basename, filename);
} else {
- gchar *sidecar_filename = g_strconcat (basename, ".xmp", NULL);
- gchar *sidecar_uri = g_build_filename (dirname, sidecar_filename, NULL);
+ gchar *sidecar_filename;
+ gchar *sidecar_uri;
+ sidecar_filename = g_strconcat (basename, ".xmp", NULL);
+ sidecar_uri = g_build_filename (dirname, sidecar_filename, NULL);
+
+#if 0
if (g_file_test (sidecar_uri, G_FILE_TEST_EXISTS)) {
g_debug ("xmp sidecar found for %s", uri);
+
+ /* FIXME-indexer-split: This has been commented out as a
+ * result of moving tracker-metadata.[ch] to the indexer
+ * directory. This code will be removed when this function is
+ * updated to work correctly in the indexer application.
+ *
+ * -Martyn
+ */
tracker_metadata_get_embedded (sidecar_uri, XMP_MIME_TYPE, meta_table);
}
+#endif
g_free (sidecar_filename);
g_free (sidecar_uri);
}
g_free (basename);
}
- #endif
+#endif /* HAVE_EXEMPI */
- 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_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);
g_free (filename);
g_free (dirname);
} else {
- tracker_db_index_service (db_con, info, service_name, NULL, uri, NULL, FALSE, FALSE, FALSE);
-
+ tracker_db_index_service (db_con,
+ info,
+ service_name,
+ NULL,
+ uri,
+ NULL,
+ FALSE,
+ FALSE,
+ FALSE);
}
g_free (service_name);
- if (attachment_uri ) {
+ if (attachment_uri) {
tracker_file_unlink (info->uri);
}
tracker_db_file_info_unref (info);
}
-
void
tracker_db_index_conversation (DBConnection *db_con, TrackerDBFileInfo *info)
{
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 Thu May 29 09:41:18 2008
@@ -62,8 +62,6 @@
guint32 file_id);
gchar ** tracker_db_get_files_in_folder (DBConnection *db_con,
const gchar *folder_uri);
-gboolean tracker_metadata_is_date (DBConnection *db_con,
- const gchar *meta);
TrackerDBFileInfo *tracker_db_get_pending_file (DBConnection *db_con,
const gchar *uri);
void tracker_db_update_pending_file (DBConnection *db_con,
@@ -87,8 +85,6 @@
const gchar *attachment_service);
void tracker_db_index_conversation (DBConnection *db_con,
TrackerDBFileInfo *info);
-void tracker_db_index_application (DBConnection *db_con,
- TrackerDBFileInfo *info);
void tracker_db_index_webhistory (DBConnection *db_con,
TrackerDBFileInfo *info);
void tracker_db_file_change_free (TrackerDBFileChange **change);
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 Thu May 29 09:41:18 2008
@@ -19,14 +19,16 @@
* Boston, MA 02110-1301, USA.
*/
-#include <config.h>
+#include "config.h"
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-config.h>
+#include <libtracker-common/tracker-dbus.h>
+
+#include <libtracker-db/tracker-db-dbus.h>
#include "tracker-dbus.h"
#include "tracker-dbus-daemon.h"
Modified: branches/xesam-support/src/trackerd/tracker-dbus-daemon.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-daemon.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-daemon.h Thu May 29 09:41:18 2008
@@ -22,9 +22,7 @@
#ifndef __TRACKERD_DBUS_DAEMON_H__
#define __TRACKERD_DBUS_DAEMON_H__
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <dbus/dbus-glib-lowlevel.h>
+#include <glib-object.h>
#include <libtracker-common/tracker-config.h>
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 Thu May 29 09:41:18 2008
@@ -19,21 +19,22 @@
* Boston, MA 02110-1301, USA.
*/
-#include <config.h>
+#include "config.h"
-#include <stdlib.h>
#include <string.h>
+#include <libtracker-common/tracker-dbus.h>
#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-utils.h>
#include <libtracker-common/tracker-file-utils.h>
#include <libtracker-common/tracker-ontology.h>
#include <libtracker-common/tracker-type-utils.h>
+#include <libtracker-db/tracker-db-dbus.h>
+
#include "tracker-dbus.h"
#include "tracker-dbus-files.h"
#include "tracker-db.h"
-#include "tracker-metadata.h"
#include "tracker-marshal.h"
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_DBUS_FILES, TrackerDBusFilesPriv))
Modified: branches/xesam-support/src/trackerd/tracker-dbus-files.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-files.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-files.h Thu May 29 09:41:18 2008
@@ -22,9 +22,7 @@
#ifndef __TRACKERD_DBUS_FILES_H__
#define __TRACKERD_DBUS_FILES_H__
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <dbus/dbus-glib-lowlevel.h>
+#include <glib-object.h>
#include "tracker-db-sqlite.h"
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 Thu May 29 09:41:18 2008
@@ -19,14 +19,14 @@
* Boston, MA 02110-1301, USA.
*/
-#include <config.h>
-
-#include <stdlib.h>
-#include <string.h>
+#include "config.h"
+#include <libtracker-common/tracker-dbus.h>
#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-utils.h>
+#include <libtracker-db/tracker-db-dbus.h>
+
#include "tracker-dbus.h"
#include "tracker-dbus-keywords.h"
#include "tracker-db.h"
Modified: branches/xesam-support/src/trackerd/tracker-dbus-keywords.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-keywords.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-keywords.h Thu May 29 09:41:18 2008
@@ -22,9 +22,7 @@
#ifndef __TRACKERD_DBUS_KEYWORDS_H__
#define __TRACKERD_DBUS_KEYWORDS_H__
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <dbus/dbus-glib-lowlevel.h>
+#include <glib-object.h>
#include "tracker-db-sqlite.h"
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 Thu May 29 09:41:18 2008
@@ -19,15 +19,17 @@
* Boston, MA 02110-1301, USA.
*/
-#include <config.h>
+#include "config.h"
-#include <stdlib.h>
#include <string.h>
+#include <libtracker-common/tracker-dbus.h>
#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-field-data.h>
#include <libtracker-common/tracker-utils.h>
+#include <libtracker-db/tracker-db-dbus.h>
+
#include "tracker-dbus.h"
#include "tracker-dbus-metadata.h"
#include "tracker-db.h"
Modified: branches/xesam-support/src/trackerd/tracker-dbus-metadata.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-metadata.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-metadata.h Thu May 29 09:41:18 2008
@@ -22,9 +22,7 @@
#ifndef __TRACKERD_DBUS_METADATA_H__
#define __TRACKERD_DBUS_METADATA_H__
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <dbus/dbus-glib-lowlevel.h>
+#include <glib-object.h>
#include "tracker-db-sqlite.h"
#include "tracker-indexer.h"
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 Thu May 29 09:41:18 2008
@@ -19,10 +19,11 @@
* Boston, MA 02110-1301, USA.
*/
-#include <string.h>
+#include "config.h"
-#include <libtracker-common/tracker-log.h>
+#include <string.h>
+#include <libtracker-common/tracker-dbus.h>
#include <libtracker-common/tracker-config.h>
#include <libtracker-common/tracker-language.h>
#include <libtracker-common/tracker-log.h>
@@ -30,6 +31,8 @@
#include <libtracker-common/tracker-parser.h>
#include <libtracker-common/tracker-utils.h>
+#include <libtracker-db/tracker-db-dbus.h>
+
#include "tracker-dbus.h"
#include "tracker-dbus-search.h"
#include "tracker-rdf-query.h"
Modified: branches/xesam-support/src/trackerd/tracker-dbus-search.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-search.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-search.h Thu May 29 09:41:18 2008
@@ -22,9 +22,7 @@
#ifndef __TRACKERD_DBUS_SEARCH_H__
#define __TRACKERD_DBUS_SEARCH_H__
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <dbus/dbus-glib-lowlevel.h>
+#include <glib-object.h>
#include <libtracker-common/tracker-language.h>
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 Thu May 29 09:41:18 2008
@@ -23,8 +23,9 @@
#include <string.h>
-#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-config.h>
+#include <libtracker-common/tracker-dbus.h>
+#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-ontology.h>
#include <libtracker-common/tracker-utils.h>
Modified: branches/xesam-support/src/trackerd/tracker-dbus-xesam.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus-xesam.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus-xesam.h Thu May 29 09:41:18 2008
@@ -22,9 +22,9 @@
#ifndef __TRACKERD_DBUS_XESAM_H__
#define __TRACKERD_DBUS_XESAM_H__
-#include <dbus/dbus-glib.h>
+#include <glib-object.h>
+
#include <dbus/dbus-glib-bindings.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include "tracker-db-sqlite.h"
#include "tracker-indexer.h"
@@ -56,67 +56,67 @@
GType tracker_dbus_xesam_get_type (void);
TrackerDBusXesam *
- tracker_dbus_xesam_new (DBConnection *db_con);
-void tracker_dbus_xesam_new_session (TrackerDBusXesam *object,
+ tracker_dbus_xesam_new (DBConnection *db_con);
+void tracker_dbus_xesam_new_session (TrackerDBusXesam *object,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_set_property (TrackerDBusXesam *object,
+void tracker_dbus_xesam_set_property (TrackerDBusXesam *object,
const gchar *session_id,
const gchar *prop,
GValue *val,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_get_property (TrackerDBusXesam *object,
+void tracker_dbus_xesam_get_property (TrackerDBusXesam *object,
const gchar *session_id,
const gchar *prop,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_close_session (TrackerDBusXesam *object,
+void tracker_dbus_xesam_close_session (TrackerDBusXesam *object,
const gchar *session_id,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_new_search (TrackerDBusXesam *object,
+void tracker_dbus_xesam_new_search (TrackerDBusXesam *object,
const gchar *session_id,
const gchar *query_xml,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_start_search (TrackerDBusXesam *object,
+void tracker_dbus_xesam_start_search (TrackerDBusXesam *object,
const gchar *search_id,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_get_hit_count (TrackerDBusXesam *object,
+void tracker_dbus_xesam_get_hit_count (TrackerDBusXesam *object,
const gchar *search_id,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_get_hits (TrackerDBusXesam *object,
+void tracker_dbus_xesam_get_hits (TrackerDBusXesam *object,
const gchar *search_id,
guint count,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_get_range_hits (TrackerDBusXesam *object,
- const gchar *search_id,
- guint a,
- guint b,
- DBusGMethodInvocation *context);
-void tracker_dbus_xesam_get_hit_data (TrackerDBusXesam *object,
+void tracker_dbus_xesam_get_range_hits (TrackerDBusXesam *object,
+ const gchar *search_id,
+ guint a,
+ guint b,
+ DBusGMethodInvocation *context);
+void tracker_dbus_xesam_get_hit_data (TrackerDBusXesam *object,
const gchar *search_id,
GArray *hit_ids,
GStrv fields,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_get_range_hit_data (TrackerDBusXesam *object,
+void tracker_dbus_xesam_get_range_hit_data (TrackerDBusXesam *object,
const gchar *search_id,
guint a,
guint b,
- GStrv fields,
+ GStrv fields,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_close_search (TrackerDBusXesam *object,
+void tracker_dbus_xesam_close_search (TrackerDBusXesam *object,
const gchar *search_id,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_get_state (TrackerDBusXesam *object,
+void tracker_dbus_xesam_get_state (TrackerDBusXesam *object,
DBusGMethodInvocation *context);
-void tracker_dbus_xesam_emit_state_changed (TrackerDBusXesam *self,
+void tracker_dbus_xesam_emit_state_changed (TrackerDBusXesam *self,
GStrv state_info);
void tracker_dbus_xesam_name_owner_changed (DBusGProxy *proxy,
const char *name,
const char *prev_owner,
const char *new_owner,
- TrackerDBusXesam *self);
-void tracker_dbus_xesam_emit_search_done (TrackerDBusXesam *self,
- const gchar *search_id);
-void tracker_dbus_xesam_set_db_connection (TrackerDBusXesam *object,
- DBConnection *db_con);
+ TrackerDBusXesam *self);
+void tracker_dbus_xesam_emit_search_done (TrackerDBusXesam *self,
+ const gchar *search_id);
+void tracker_dbus_xesam_set_db_connection (TrackerDBusXesam *object,
+ DBConnection *db_con);
G_END_DECLS
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 Thu May 29 09:41:18 2008
@@ -19,8 +19,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <string.h>
-#include <stdlib.h>
+#include <dbus/dbus-glib-bindings.h>
#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-config.h>
@@ -40,15 +39,16 @@
#include "tracker-dbus-search-glue.h"
#include "tracker-dbus-xesam.h"
#include "tracker-dbus-xesam-glue.h"
-
#include "tracker-utils.h"
#include "tracker-watch.h"
-static GSList *objects;
-
-gboolean
-static dbus_register_service (DBusGProxy *proxy,
- const gchar *name)
+static DBusGConnection *connection;
+static DBusGProxy *proxy;
+static GSList *objects;
+
+static gboolean
+dbus_register_service (DBusGProxy *proxy,
+ const gchar *name)
{
GError *error = NULL;
guint result;
@@ -67,7 +67,7 @@
g_error_free (error);
return FALSE;
- }
+ }
if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
g_critical ("DBus service name '%s' is already taken, "
@@ -100,105 +100,108 @@
return object;
}
-static GValue *
-tracker_dbus_g_value_slice_new (GType type)
-{
- GValue *value;
-
- value = g_slice_new0 (GValue);
- g_value_init (value, type);
-
- return value;
-}
-
-static void
-tracker_dbus_g_value_slice_free (GValue *value)
-{
- g_value_unset (value);
- g_slice_free (GValue, value);
-}
-
static void
-name_owner_changed_done (gpointer data, GClosure *closure)
+dbus_name_owner_changed (gpointer data,
+ GClosure *closure)
{
g_object_unref (data);
}
-gboolean
-tracker_dbus_preinit (Tracker *tracker,
- DBusGConnection **connection_out,
- DBusGProxy **proxy_out,
- DBusGProxy **xesam_out)
+static gboolean
+dbus_register_names (TrackerConfig *config)
{
- DBusGConnection *connection;
- DBusGProxy *proxy, *xesam = NULL;
- GError *error = NULL;
+ GError *error = NULL;
- g_return_val_if_fail (tracker != NULL, FALSE);
+ if (connection) {
+ g_critical ("The DBusGConnection is already set, have we already initialized?");
+ return FALSE;
+ }
+ if (proxy) {
+ g_critical ("The DBusGProxy is already set, have we already initialized?");
+ return FALSE;
+ }
+
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (!connection) {
g_critical ("Could not connect to the DBus session bus, %s",
error ? error->message : "no error given.");
g_clear_error (&error);
-
return FALSE;
}
/* The definitions below (DBUS_SERVICE_DBUS, etc) are
- * predefined for us to just use.
+ * predefined for us to just use (dbus_g_proxy_...)
*/
proxy = dbus_g_proxy_new_for_name (connection,
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
- /* Set up the main tracker service */
+ /* Register the service name for org.freedesktop.Tracker */
if (!dbus_register_service (proxy, TRACKER_DBUS_DAEMON_SERVICE)) {
return FALSE;
}
- if (tracker_config_get_enable_xesam (tracker->config)) {
- /* The definitions below (DBUS_SERVICE_DBUS, etc) are
- * predefined for us to just use.
- */
- xesam = dbus_g_proxy_new_for_name (connection,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS);
-
- /* Set up the main tracker service */
- if (!dbus_register_service (xesam, TRACKER_DBUS_XESAM_SERVICE)) {
- return FALSE;
- }
+ /* Register the service name for org.freedesktop.xesam if XESAM is enabled */
+ if (tracker_config_get_enable_xesam (config)) {
+ if (!dbus_register_service (proxy, TRACKER_DBUS_XESAM_SERVICE)) {
+ return FALSE;
+ }
}
- *connection_out = connection;
- *proxy_out = proxy;
- *xesam_out = xesam;
-
return TRUE;
}
gboolean
-tracker_dbus_init (Tracker *tracker,
- DBusGConnection *connection,
- DBusGProxy *proxy,
- DBusGProxy *xesam)
+tracker_dbus_init (TrackerConfig *config)
{
- GObject *object;
- DBConnection *db_connection;
-
- g_return_val_if_fail (tracker != NULL, FALSE);
- g_return_val_if_fail (connection != NULL, FALSE);
- g_return_val_if_fail (proxy != NULL, FALSE);
+ g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
/* Don't reinitialize */
if (objects) {
return TRUE;
}
+ /* Register names and get proxy/connection details */
+ if (!dbus_register_names (config)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void
+tracker_dbus_shutdown (void)
+{
+ if (objects) {
+ g_slist_foreach (objects, (GFunc) g_object_unref, NULL);
+ g_slist_free (objects);
+ objects = NULL;
+ }
+
+ if (proxy) {
+ g_object_unref (proxy);
+ proxy = NULL;
+ }
+
+ connection = NULL;
+}
+
+gboolean
+tracker_dbus_register_objects (Tracker *tracker)
+{
+ GObject *object;
+ DBConnection *db_connection;
+
+ g_return_val_if_fail (tracker != NULL, FALSE);
+
+ if (!connection || !proxy) {
+ g_critical ("DBus support must be initialized before registering objects!");
+ return FALSE;
+ }
+
/* Add org.freedesktop.Tracker */
if (!(object = dbus_register_object (connection,
proxy,
@@ -260,24 +263,24 @@
return FALSE;
}
- g_object_set (object, "db-connection", db_connection, NULL);
- g_object_set (object, "config", tracker->config, NULL);
- g_object_set (object, "language", tracker->language, NULL);
- g_object_set (object, "file-index", tracker->file_index, NULL);
- g_object_set (object, "email-index", tracker->email_index, NULL);
- objects = g_slist_prepend (objects, object);
+ g_object_set (object, "db-connection", db_connection, NULL);
+ g_object_set (object, "config", tracker->config, NULL);
+ g_object_set (object, "language", tracker->language, NULL);
+ g_object_set (object, "file-index", tracker->file_index, NULL);
+ g_object_set (object, "email-index", tracker->email_index, NULL);
+ objects = g_slist_prepend (objects, object);
- if (xesam) {
+ /* Register the XESAM object if enabled */
+ if (tracker_config_get_enable_xesam (tracker->config)) {
/* Add org.freedesktop.xesam.Search */
if (!(object = dbus_register_object (connection,
- xesam,
+ proxy,
TRACKER_TYPE_DBUS_XESAM,
&dbus_glib_tracker_dbus_xesam_object_info,
TRACKER_DBUS_XESAM_PATH))) {
return FALSE;
}
- /* g_object_set (object, "db-connection", db_connection, NULL); */
db_connection = tracker_db_connect_xesam ();
g_object_set (object, "db-connection", db_connection, NULL);
@@ -288,40 +291,17 @@
dbus_g_proxy_connect_signal (proxy, "NameOwnerChanged",
G_CALLBACK (tracker_dbus_xesam_name_owner_changed),
g_object_ref (object),
- name_owner_changed_done);
+ dbus_name_owner_changed);
objects = g_slist_prepend (objects, object);
}
-
+
/* Reverse list since we added objects at the top each time */
objects = g_slist_reverse (objects);
- /* Clean up */
- g_object_unref (proxy);
-
return TRUE;
}
-void
-tracker_dbus_shutdown (void)
-{
- if (!objects) {
- return;
- }
-
- g_slist_foreach (objects, (GFunc) g_object_unref, NULL);
- g_slist_free (objects);
- objects = NULL;
-}
-
-guint
-tracker_dbus_get_next_request_id (void)
-{
- static guint request_id = 1;
-
- return request_id++;
-}
-
GObject *
tracker_dbus_get_object (GType type)
{
@@ -330,252 +310,8 @@
for (l = objects; l; l = l->next) {
if (G_OBJECT_TYPE (l->data) == type) {
return l->data;
- }
- }
-
- return NULL;
-}
-
-GQuark
-tracker_dbus_error_quark (void)
-{
- return g_quark_from_static_string (TRACKER_DBUS_ERROR_DOMAIN);
-}
-
-TrackerDBusData *
-tracker_dbus_data_new (const gpointer arg1,
- const gpointer arg2)
-{
- TrackerDBusData *data;
-
- data = g_new0 (TrackerDBusData, 1);
-
- data->id = tracker_dbus_get_next_request_id ();
-
- data->data1 = arg1;
- data->data2 = arg2;
-
- return data;
-}
-
-gchar **
-tracker_dbus_slist_to_strv (GSList *list)
-{
- GSList *l;
- gchar **strv;
- gint i = 0;
-
- strv = g_new0 (gchar*, g_slist_length (list) + 1);
-
- for (l = list; l != NULL; l = l->next) {
- strv[i++] = g_strdup (l->data);
- }
-
- strv[i] = NULL;
-
- return strv;
-}
-
-gchar **
-tracker_dbus_query_result_to_strv (TrackerDBResultSet *result_set,
- gint *count)
-{
- gchar **strv = NULL;
- gint rows = 0;
-
- if (result_set) {
- gboolean valid = TRUE;
- gint i = 0;
-
- rows = tracker_db_result_set_get_n_rows (result_set);
- strv = g_new (gchar*, rows + 1);
-
- while (valid) {
- tracker_db_result_set_get (result_set, 0, &strv[i], -1);
- valid = tracker_db_result_set_iter_next (result_set);
- i++;
}
- strv[i] = NULL;
}
- if (count) {
- *count = rows;
- }
-
- return strv;
-}
-
-GHashTable *
-tracker_dbus_query_result_to_hash_table (TrackerDBResultSet *result_set)
-{
- GHashTable *hash_table;
- gint field_count;
- gboolean valid = FALSE;
-
- hash_table = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) tracker_dbus_g_value_slice_free);
-
- if (result_set) {
- valid = TRUE;
- field_count = tracker_db_result_set_get_n_columns (result_set);
- }
-
- while (valid) {
- GValue transform;
- GValue *values;
- gchar **p;
- gint field_count;
- gint i = 0;
- gchar *key;
- GSList *list = NULL;
-
- g_value_init (&transform, G_TYPE_STRING);
-
- tracker_db_result_set_get (result_set, 0, &key, -1);
- values = tracker_dbus_g_value_slice_new (G_TYPE_STRV);
-
- for (i = 1; i < field_count; i++) {
- GValue value;
- const gchar *str;
-
- _tracker_db_result_set_get_value (result_set, i, &value);
-
- if (g_value_transform (&value, &transform)) {
- str = g_value_dup_string (&transform);
- } else {
- str = g_strdup ("");
- }
-
- list = g_slist_prepend (list, (gchar*) str);
- }
-
- list = g_slist_reverse (list);
- p = tracker_dbus_slist_to_strv (list);
- g_slist_free (list);
- g_value_take_boxed (values, p);
- g_hash_table_insert (hash_table, key, values);
-
- valid = tracker_db_result_set_iter_next (result_set);
- }
-
- return hash_table;
-}
-
-GPtrArray *
-tracker_dbus_query_result_to_ptr_array (TrackerDBResultSet *result_set)
-{
- GPtrArray *ptr_array;
- gboolean valid = FALSE;
- gint columns;
- gint i;
-
- ptr_array = g_ptr_array_new ();
-
- if (result_set) {
- valid = TRUE;
- columns = tracker_db_result_set_get_n_columns (result_set);
- }
-
- while (valid) {
- GSList *list = NULL;
- GValue transform = { 0, };
- gchar **p;
-
- g_value_init (&transform, G_TYPE_STRING);
-
- /* Append fields to the array */
- for (i = 0; i < columns; i++) {
- GValue value = { 0, };
- const gchar *str;
-
- _tracker_db_result_set_get_value (result_set, i, &value);
-
- if (g_value_transform (&value, &transform)) {
- str = g_value_dup_string (&transform);
- } else {
- str = g_strdup ("");
- }
-
- list = g_slist_prepend (list, (gchar*) str);
-
- g_value_unset (&value);
- g_value_reset (&transform);
- }
-
- list = g_slist_reverse (list);
- p = tracker_dbus_slist_to_strv (list);
- g_slist_free (list);
- g_ptr_array_add (ptr_array, p);
-
- valid = tracker_db_result_set_iter_next (result_set);
- }
-
- return ptr_array;
-}
-
-void
-tracker_dbus_request_new (gint request_id,
- const gchar *format,
- ...)
-{
- gchar *str;
- va_list args;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- va_end (args);
-
- g_message ("<--- [%d] %s",
- request_id,
- str);
-
- g_free (str);
-}
-
-void
-tracker_dbus_request_success (gint request_id)
-{
- g_message ("---> [%d] Success, no error given",
- request_id);
-}
-
-void
-tracker_dbus_request_failed (gint request_id,
- GError **error,
- const gchar *format,
- ...)
-{
- gchar *str;
- va_list args;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- va_end (args);
-
- g_set_error (error, TRACKER_DBUS_ERROR, 0, str);
-
- g_message ("---> [%d] Failed, %s",
- request_id,
- str);
- g_free (str);
-}
-
-void
-tracker_dbus_request_comment (gint request_id,
- const gchar *format,
- ...)
-{
- gchar *str;
- va_list args;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- va_end (args);
-
- g_message ("---- [%d] %s",
- request_id,
- str);
- g_free (str);
+ return NULL;
}
Modified: branches/xesam-support/src/trackerd/tracker-dbus.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-dbus.h (original)
+++ branches/xesam-support/src/trackerd/tracker-dbus.h Thu May 29 09:41:18 2008
@@ -22,15 +22,9 @@
#ifndef __TRACKERD_DBUS_H__
#define __TRACKERD_DBUS_H__
-#ifndef DBUS_API_SUBJECT_TO_CHANGE
-#define DBUS_API_SUBJECT_TO_CHANGE
-#endif
-
-#include <glib/gi18n.h>
-
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus-glib.h>
+#include <glib.h>
+
+#include <libtracker-common/tracker-config.h>
#include <libtracker-db/tracker-db-interface.h>
@@ -38,79 +32,10 @@
G_BEGIN_DECLS
-#define TRACKER_DBUS_ERROR_DOMAIN "TrackerDBus"
-#define TRACKER_DBUS_ERROR tracker_dbus_error_quark()
-
-#define tracker_dbus_async_return_if_fail(expr,context) \
- G_STMT_START { \
- if G_LIKELY(expr) { } else { \
- GError *error = NULL; \
- \
- g_set_error (&error, \
- TRACKER_DBUS_ERROR, \
- 0, \
- _("Assertion `%s' failed"), \
- #expr); \
- \
- dbus_g_method_return_error (context, error); \
- g_clear_error (&error); \
- \
- return; \
- }; \
- } G_STMT_END
-
-#define tracker_dbus_return_val_if_fail(expr,val,error) \
- G_STMT_START { \
- if G_LIKELY(expr) { } else { \
- g_set_error (error, \
- TRACKER_DBUS_ERROR, \
- 0, \
- _("Assertion `%s' failed"), \
- #expr); \
- \
- return val; \
- }; \
- } G_STMT_END
-
-typedef struct {
- guint id;
- gpointer data1;
- gpointer data2;
-} TrackerDBusData;
-
-gboolean tracker_dbus_preinit (Tracker *tracker,
- DBusGConnection **connection_out,
- DBusGProxy **proxy_out,
- DBusGProxy **xesam_out);
-gboolean tracker_dbus_init (Tracker *tracker,
- DBusGConnection *connection,
- DBusGProxy *proxy,
- DBusGProxy *xesam);
-void tracker_dbus_shutdown (void);
-guint tracker_dbus_get_next_request_id (void);
-GObject * tracker_dbus_get_object (GType type);
-GQuark tracker_dbus_error_quark (void);
-
-
-/* Utils */
-TrackerDBusData *tracker_dbus_data_new (const gpointer arg1,
- const gpointer arg2);
-gchar ** tracker_dbus_slist_to_strv (GSList *list);
-gchar ** tracker_dbus_query_result_to_strv (TrackerDBResultSet *result_set,
- gint *count);
-GHashTable * tracker_dbus_query_result_to_hash_table (TrackerDBResultSet *result_set);
-GPtrArray * tracker_dbus_query_result_to_ptr_array (TrackerDBResultSet *result_set);
-void tracker_dbus_request_new (gint request_id,
- const gchar *format,
- ...);
-void tracker_dbus_request_success (gint request_id);
-void tracker_dbus_request_failed (gint request_id,
- GError **error,
- const gchar *format,
- ...);
-void tracker_dbus_request_comment (gint request_id,
- const gchar *format,
- ...);
+gboolean tracker_dbus_init (TrackerConfig *config);
+void tracker_dbus_shutdown (void);
+gboolean tracker_dbus_register_objects (Tracker *tracker);
+GObject *tracker_dbus_get_object (GType type);
G_END_DECLS
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 Thu May 29 09:41:18 2008
@@ -26,20 +26,15 @@
#include "config.h"
#include <signal.h>
-#include <errno.h>
#include <locale.h>
#include <string.h>
-#include <unistd.h>
+#include <unistd.h>
#include <fcntl.h>
#include <glib/gstdio.h>
#include <glib/gi18n.h>
#include <glib/gpattern.h>
-#ifdef IOPRIO_SUPPORT
-#include "tracker-ioprio.h"
-#endif
-
#include <libtracker-common/tracker-config.h>
#include <libtracker-common/tracker-language.h>
#include <libtracker-common/tracker-log.h>
@@ -495,7 +490,7 @@
/* Private locations */
log_filename = g_build_filename (g_get_user_data_dir (),
"tracker",
- "tracker.log",
+ "trackerd.log",
NULL);
}
@@ -808,9 +803,6 @@
gint
main (gint argc, gchar *argv[])
{
- DBusGConnection *connection = NULL;
- DBusGProxy *proxy = NULL;
- DBusGProxy *xesam = NULL;
GOptionContext *context = NULL;
GError *error = NULL;
GThread *thread;
@@ -871,7 +863,7 @@
/* Print information */
g_print ("\n" ABOUT "\n" LICENSE "\n");
- g_print ("Initialising tracker...\n");
+ g_print ("Initializing trackerd...\n");
initialise_signal_handler ();
@@ -936,12 +928,12 @@
}
/* Initialise other subsystems */
- tracker_log_init (log_filename,
- tracker_config_get_verbosity (tracker->config));
+ tracker_log_init (log_filename, tracker_config_get_verbosity (tracker->config));
g_message ("Starting log");
- if (!tracker_dbus_preinit (tracker, &connection, &proxy, &xesam))
+ if (!tracker_dbus_init (tracker->config)) {
return EXIT_FAILURE;
+ }
sanity_check_option_values ();
@@ -964,22 +956,6 @@
tracker->readonly = check_multiple_instances ();
- /* Set child's niceness to 19 */
- errno = 0;
-
- /* nice() uses attribute "warn_unused_result" and so complains
- * if we do not check its returned value. But it seems that
- * since glibc 2.2.4, nice() can return -1 on a successful
- * call so we have to check value of errno too. Stupid...
- */
- if (nice (19) == -1 && errno) {
- g_message ("Couldn't set nice() value");
- }
-
-#ifdef IOPRIO_SUPPORT
- ioprio ();
-#endif
-
if (!tracker_db_load_prepared_queries ()) {
g_critical ("Could not initialize database engine!");
return EXIT_FAILURE;
@@ -992,12 +968,10 @@
*/
tracker->is_running = TRUE;
- /* If we are already running, this should return some
- * indication.
- */
- if (!tracker_dbus_init (tracker, connection, proxy, xesam)) {
- return EXIT_FAILURE;
- }
+ /* Make Tracker available for introspection */
+ if (!tracker_dbus_register_objects (tracker)) {
+ return EXIT_FAILURE;
+ }
if (!tracker->readonly) {
if (!tracker_start_watching ()) {
@@ -1022,6 +996,8 @@
g_main_loop_run (main_loop);
}
+ g_message ("Shutting down...\n");
+
/*
* Shutdown the daemon
*/
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 Thu May 29 09:41:18 2008
@@ -41,7 +41,6 @@
#include "../xdgmime/xdgmime.h"
-#include "tracker-apps.h"
#include "tracker-db.h"
#include "tracker-dbus.h"
#include "tracker-dbus-daemon.h"
@@ -541,7 +540,16 @@
} else if (g_str_has_suffix (service_info, "Conversations")) {
tracker_db_index_conversation (db_con, info);
} else if (strcmp (service_info, "Applications") == 0) {
+#if 0
+ /* FIXME-indexer-split: This has been commented out as a
+ * result of moving the tracker-apps.[ch] code to the indexer
+ * directory. This code will be removed when this function is
+ * updated to work correctly in the indexer application.
+ *
+ * -Martyn
+ */
tracker_db_index_application (db_con, info);
+#endif
} else {
tracker_db_index_service (db_con, info, NULL, NULL, NULL, FALSE, TRUE, TRUE, TRUE);
}
@@ -688,8 +696,17 @@
tracker_db_start_index_transaction (db_con);
tracker_db_interface_start_transaction (db_con->cache->db);
-
+
+#if 0
+ /* FIXME-indexer-split: This has been commented out as a
+ * result of moving the tracker-apps.[ch] code to the indexer
+ * directory. This code will be removed when this function is
+ * updated to work correctly in the indexer application.
+ *
+ * -Martyn
+ */
tracker_applications_add_service_directories ();
+#endif
list = tracker_ontology_get_dirs_for_service_type ("Applications");
process_directory_list (tracker, list, FALSE, db_con);
Modified: branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-live-search.c (original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-live-search.c Thu May 29 09:41:18 2008
@@ -21,6 +21,8 @@
#include <string.h>
+#include <dbus/dbus-glib-bindings.h>
+
#include "tracker-xesam-live-search.h"
#include "tracker-dbus-xesam.h"
#include "tracker-dbus.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]