tracker r1461 - in branches/xesam-support: . src/libtracker-common src/libtracker-db src/tracker-indexer/modules src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1461 - in branches/xesam-support: . src/libtracker-common src/libtracker-db src/tracker-indexer/modules src/trackerd
- Date: Tue, 20 May 2008 11:52:02 +0000 (UTC)
Author: pvanhoof
Date: Tue May 20 11:52:01 2008
New Revision: 1461
URL: http://svn.gnome.org/viewvc/tracker?rev=1461&view=rev
Log:
svn merge -r 1453:1460 ../indexer-split
Modified:
branches/xesam-support/ChangeLog
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-nfs-lock.h
branches/xesam-support/src/libtracker-db/Makefile.am
branches/xesam-support/src/tracker-indexer/modules/files.c
branches/xesam-support/src/trackerd/Makefile.am
branches/xesam-support/src/trackerd/tracker-db-manager.c
branches/xesam-support/src/trackerd/tracker-db-manager.h
branches/xesam-support/src/trackerd/tracker-db.c
branches/xesam-support/src/trackerd/tracker-db.h
branches/xesam-support/src/trackerd/tracker-dbus.c
branches/xesam-support/src/trackerd/tracker-main.c
branches/xesam-support/src/trackerd/tracker-main.h
branches/xesam-support/src/trackerd/tracker-ontology.c
branches/xesam-support/src/trackerd/tracker-ontology.h
branches/xesam-support/src/trackerd/tracker-process-files.c
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 11:52:01 2008
@@ -36,7 +36,6 @@
typedef struct {
GMutex *mutex;
- gchar *domain;
gchar *filename;
gint verbosity;
gboolean abort_on_error;
@@ -116,11 +115,9 @@
}
void
-tracker_log_init (const gchar *domain,
- const gchar *filename,
+tracker_log_init (const gchar *filename,
gint verbosity)
{
- g_return_if_fail (domain != NULL);
g_return_if_fail (filename != NULL);
if (log != NULL) {
@@ -129,7 +126,6 @@
}
log = g_new0 (TrackerLog, 1);
- log->domain = g_strdup (domain);
log->filename = g_strdup (filename);
log->mutex = g_mutex_new ();
log->verbosity = verbosity;
@@ -139,7 +135,7 @@
}
void
-tracker_log_term (void)
+tracker_log_shutdown (void)
{
g_return_if_fail (log != NULL);
@@ -147,7 +143,6 @@
log_handler_id = 0;
g_mutex_free (log->mutex);
- g_free (log->domain);
g_free (log->filename);
g_free (log);
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 11:52:01 2008
@@ -26,10 +26,9 @@
G_BEGIN_DECLS
-void tracker_log_init (const gchar *domain,
- const char *filename,
- gint verbosity);
-void tracker_log_term (void);
+void tracker_log_init (const char *filename,
+ gint verbosity);
+void tracker_log_shutdown (void);
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 11:52:01 2008
@@ -169,7 +169,7 @@
}
void
-tracker_nfs_lock_term (void)
+tracker_nfs_lock_shutdown (void)
{
if (!is_initialized ()) {
return;
Modified: branches/xesam-support/src/libtracker-common/tracker-nfs-lock.h
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-nfs-lock.h (original)
+++ branches/xesam-support/src/libtracker-common/tracker-nfs-lock.h Tue May 20 11:52:01 2008
@@ -26,10 +26,10 @@
G_BEGIN_DECLS
-void tracker_nfs_lock_init (const gchar *root_dir, gboolean nfs);
-gboolean tracker_nfs_lock_obtain (void);
-void tracker_nfs_lock_release (void);
-void tracker_nfs_lock_term (void);
+void tracker_nfs_lock_init (const gchar *root_dir, gboolean nfs);
+void tracker_nfs_lock_shutdown (void);
+gboolean tracker_nfs_lock_obtain (void);
+void tracker_nfs_lock_release (void);
G_END_DECLS
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 11:52:01 2008
@@ -4,7 +4,7 @@
$(GMIME_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(QDBM_CFLAGS) \
- -DG_LOG_DOMAIN=\"Ttracker\" \
+ -DG_LOG_DOMAIN=\"Tracker\" \
-I$(top_srcdir)/src
noinst_LTLIBRARIES = libtracker-db.la
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 11:52:01 2008
@@ -26,6 +26,7 @@
#include <libtracker-common/tracker-config.h>
#include <libtracker-common/tracker-file-utils.h>
+#include <libtracker-common/tracker-os-dependant.h>
#define METADATA_FILE_NAME_DELIMITED "File:NameDelimited"
#define METADATA_FILE_EXT "File:Ext"
@@ -90,12 +91,98 @@
return (gchar **) g_ptr_array_free (dirs, FALSE);
}
+void
+tracker_metadata_get_embedded (const char *uri,
+ const char *mimetype,
+ GHashTable *table)
+{
+ gboolean success;
+ gchar **argv, *output, **values;
+ gint i;
+
+ /* FIXME: lookup the service type to check whether it possibly has metadata */
+#if 0
+ service_type = tracker_ontology_get_service_type_for_mime (mime);
+ if (!service_type ) {
+ return;
+ }
+
+ if (!tracker_ontology_service_type_has_metadata (service_type)) {
+ g_free (service_type);
+ return;
+ }
+#endif
+
+ /* we extract metadata out of process using pipes */
+ argv = g_new0 (gchar *, 4);
+ argv[0] = g_strdup ("tracker-extract");
+ argv[1] = g_filename_from_utf8 (uri, -1, NULL, NULL, NULL);
+ argv[2] = g_strdup (mimetype);
+
+ if (!argv[1] || !argv[2]) {
+ g_critical ("uri or mime could not be converted to locale format");
+ g_strfreev (argv);
+ return;
+ }
+
+ success = tracker_spawn (argv, 10, &output, NULL);
+ g_strfreev (argv);
+
+ if (!success || !output)
+ return;
+
+ /* parse returned stdout and extract keys and associated metadata values */
+
+ values = g_strsplit_set (output, ";", -1);
+
+ for (i = 0; values[i]; i++) {
+ char *meta_data, *sep;
+ const char *name, *value;
+ char *utf_value;
+
+ meta_data = g_strstrip (values[i]);
+ sep = strchr (meta_data, '=');
+
+ if (!sep)
+ continue;
+
+ /* zero out the separator, so we get
+ * NULL-terminated name and value
+ */
+ sep[0] = '\0';
+ name = meta_data;
+ value = sep + 1;
+
+ if (!name || !value)
+ continue;
+
+ if (g_hash_table_lookup (table, name))
+ continue;
+
+ if (!g_utf8_validate (value, -1, NULL)) {
+ utf_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
+ } else {
+ utf_value = g_strdup (value);
+ }
+
+ if (!utf_value)
+ continue;
+
+ /* FIXME: name should be const */
+ g_hash_table_insert (table, g_strdup (name), utf_value);
+ }
+
+ g_strfreev (values);
+ g_free (output);
+}
+
GHashTable *
tracker_module_get_file_metadata (const gchar *file)
{
GHashTable *metadata;
struct stat st;
const gchar *ext;
+ gchar *mimetype;
/* FIXME: check exclude extensions */
@@ -109,12 +196,13 @@
g_hash_table_insert (metadata, METADATA_FILE_EXT, g_strdup (ext + 1));
}
+ mimetype = tracker_file_get_mime_type (file);
+
g_hash_table_insert (metadata, METADATA_FILE_NAME, g_filename_display_basename (file));
g_hash_table_insert (metadata, METADATA_FILE_PATH, g_path_get_dirname (file));
g_hash_table_insert (metadata, METADATA_FILE_NAME_DELIMITED,
g_filename_to_utf8 (file, -1, NULL, NULL, NULL));
- g_hash_table_insert (metadata, METADATA_FILE_MIMETYPE,
- tracker_file_get_mime_type (file));
+ g_hash_table_insert (metadata, METADATA_FILE_MIMETYPE, mimetype);
if (S_ISLNK (st.st_mode)) {
gchar *link_path;
@@ -125,6 +213,8 @@
g_free (link_path);
}
+ tracker_metadata_get_embedded (file, mimetype, metadata);
+
/* FIXME, Missing:
*
* File:Size
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 11:52:01 2008
@@ -1,9 +1,10 @@
INCLUDES = \
- -g \
+ -g \
-DSHAREDIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-DMAIL_MODULES_DIR=\""$(libdir)"/tracker/mail-modules\" \
+ -DG_LOG_DOMAIN=\"Tracker\" \
$(GLIB2_CFLAGS) \
$(GMODULE_CFLAGS) \
$(PANGO_CFLAGS) \
Modified: branches/xesam-support/src/trackerd/tracker-db-manager.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db-manager.c (original)
+++ branches/xesam-support/src/trackerd/tracker-db-manager.c Tue May 20 11:52:01 2008
@@ -184,6 +184,28 @@
}
}
+void
+tracker_db_manager_shutdown (void)
+{
+ gint dbs, i;
+
+ if (!initialized) {
+ return;
+ }
+
+ initialized = FALSE;
+
+ dbs = sizeof (tracker_db_definitions) /sizeof (TrackerDBDefinition);
+
+ for (i = 0; i < dbs; i++) {
+ if (tracker_db_definitions[i].abs_filename) {
+ g_free (tracker_db_definitions[i].abs_filename);
+ }
+ }
+
+ g_free (services_dir);
+ g_free (sql_dir);
+}
const gchar *
tracker_db_manager_get_file (TrackerDatabase db)
@@ -234,25 +256,3 @@
return tracker_dbs[db]->name;
}
-void
-tracker_db_manager_term ()
-{
- gint dbs, i;
-
- if (!initialized) {
- return;
- }
-
- initialized = FALSE;
-
- dbs = sizeof (tracker_db_definitions) /sizeof (TrackerDBDefinition);
-
- for (i = 0; i < dbs; i++) {
- if (tracker_db_definitions[i].abs_filename) {
- g_free (tracker_db_definitions[i].abs_filename);
- }
- }
-
- g_free (services_dir);
- g_free (sql_dir);
-}
Modified: branches/xesam-support/src/trackerd/tracker-db-manager.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db-manager.h (original)
+++ branches/xesam-support/src/trackerd/tracker-db-manager.h Tue May 20 11:52:01 2008
@@ -40,6 +40,7 @@
void tracker_db_manager_init (const gchar *data_dir,
const gchar *user_data_dir,
const gchar *sys_tmp_root_dir);
+void tracker_db_manager_shutdown (void);
const gchar *tracker_db_manager_get_file (TrackerDatabase db);
gboolean tracker_db_manager_file_exists (TrackerDatabase db);
@@ -50,8 +51,6 @@
gboolean tracker_db_manager_get_add_functions (TrackerDatabase db);
const gchar *tracker_db_manager_get_name (TrackerDatabase db);
-void tracker_db_manager_term (void);
-
G_END_DECLS
#endif /* __TRACKER_DB_MANAGER_H__ */
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 11:52:01 2008
@@ -53,6 +53,8 @@
GHashTable *table;
} DatabaseAction;
+GQueue *file_change_queue;
+
static void
free_metadata_list (GSList *list)
{
@@ -590,7 +592,7 @@
gint *current = (gint *)user_data;
if ((*current - change->first_change_time) > MAX_DURATION) {
- g_queue_remove_all (tracker->file_change_queue, data);
+ g_queue_remove_all (file_change_queue, data);
tracker_db_file_change_free (&change);
}
}
@@ -626,7 +628,7 @@
TrackerDBFileChange *change;
gint count;
- head = g_queue_peek_head_link (tracker->file_change_queue);
+ head = g_queue_peek_head_link (file_change_queue);
g_message ("File Change queue is:");
count = 1;
@@ -642,6 +644,13 @@
}
static void
+free_file_change_queue (gpointer data, gpointer user_data)
+{
+ TrackerDBFileChange *change = (TrackerDBFileChange *) data;
+ tracker_db_file_change_free (&change);
+}
+
+static void
index_blacklist_file (char *uri)
{
TrackerDBFileInfo *info;
@@ -689,18 +698,13 @@
TrackerDBFileChange *change;
time_t current;
- if (!tracker->file_change_queue) {
- /* init queue */
- tracker->file_change_queue = g_queue_new ();
- }
-
current = time (NULL);
/* remove items which are very old */
- g_queue_foreach (tracker->file_change_queue,
+ g_queue_foreach (file_change_queue,
refresh_file_change_queue, ¤t);
- find = g_queue_find_custom (tracker->file_change_queue, uri, uri_comp);
+ find = g_queue_find_custom (file_change_queue, uri, uri_comp);
if (!find) {
/* not found, add to in the queue */
@@ -708,18 +712,18 @@
change->uri = g_strdup (uri);
change->first_change_time = current;
change->num_of_change = 1;
- if (g_queue_get_length (tracker->file_change_queue) == STACK_SIZE) {
- TrackerDBFileChange *tmp = g_queue_pop_head (tracker->file_change_queue);
+ if (g_queue_get_length (file_change_queue) == STACK_SIZE) {
+ TrackerDBFileChange *tmp = g_queue_pop_head (file_change_queue);
tracker_db_file_change_free (&tmp);
}
- g_queue_insert_sorted (tracker->file_change_queue, change,
+ g_queue_insert_sorted (file_change_queue, change,
file_change_sort_comp, NULL);
print_file_change_queue ();
return FALSE;
} else {
change = (TrackerDBFileChange *) find->data;
(change->num_of_change)++;
- g_queue_sort (tracker->file_change_queue,
+ g_queue_sort (file_change_queue,
file_change_sort_comp, NULL);
if (change->num_of_change < MAX_CHANGE_TIMES) {
print_file_change_queue ();
@@ -738,7 +742,7 @@
g_timeout_add_seconds (BLACK_LIST_SECONDS, (GSourceFunc) index_black_list, NULL);
}
- g_queue_remove_all (tracker->file_change_queue, change);
+ g_queue_remove_all (file_change_queue, change);
tracker_db_file_change_free (&change);
return TRUE;
@@ -1330,3 +1334,26 @@
(*change)->uri = NULL;
*change = NULL;
}
+
+void
+tracker_db_init (void)
+{
+ if (file_change_queue) {
+ return;
+ }
+
+ file_change_queue = g_queue_new ();
+}
+
+void
+tracker_db_shutdown (void)
+{
+ if (!file_change_queue) {
+ return;
+ }
+
+ g_queue_foreach (file_change_queue,
+ free_file_change_queue, NULL);
+ g_queue_free (file_change_queue);
+ file_change_queue = NULL;
+}
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 11:52:01 2008
@@ -38,6 +38,8 @@
gint num_of_change;
} TrackerDBFileChange;
+void tracker_db_init (void);
+void tracker_db_shutdown (void);
gboolean tracker_db_is_file_up_to_date (DBConnection *db_con,
const gchar *uri,
guint32 *id);
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 11:52:01 2008
@@ -169,7 +169,8 @@
DBusGConnection *connection,
DBusGProxy *proxy)
{
- GObject *object;
+ GObject *object;
+ DBConnection *db_connection;
g_return_val_if_fail (tracker != NULL, FALSE);
g_return_val_if_fail (connection != NULL, FALSE);
@@ -189,7 +190,9 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
+ db_connection = tracker_db_connect_all ();
+
+ g_object_set (object, "db-connection", db_connection, NULL);
g_object_set (object, "config", tracker->config, NULL);
g_object_set (object, "tracker", tracker, NULL);
objects = g_slist_prepend (objects, object);
@@ -203,7 +206,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
+ g_object_set (object, "db-connection", db_connection, NULL);
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Keywords */
@@ -215,7 +218,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
+ g_object_set (object, "db-connection", db_connection, NULL);
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Metadata */
@@ -227,7 +230,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
+ g_object_set (object, "db-connection", db_connection, NULL);
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Search */
@@ -239,7 +242,7 @@
return FALSE;
}
- g_object_set (object, "db-connection", tracker->mainloop_db, NULL);
+ 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);
@@ -247,27 +250,29 @@
objects = g_slist_prepend (objects, object);
if (tracker_config_get_enable_xesam (tracker->config)) {
- /* Add org.freedesktop.xesam.Search */
- if (!(object = dbus_register_object (connection,
- proxy,
- TRACKER_TYPE_DBUS_XESAM,
- &dbus_glib_tracker_dbus_xesam_object_info,
- TRACKER_DBUS_XESAM_PATH))) {
- return FALSE;
- }
-
- g_object_set (object, "db-connection", tracker->xesam_db, NULL);
-
- dbus_g_proxy_add_signal (proxy, "NameOwnerChanged",
- G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (proxy, "NameOwnerChanged",
- G_CALLBACK (tracker_dbus_xesam_name_owner_changed),
- g_object_ref (object),
- name_owner_changed_done);
-
- objects = g_slist_prepend (objects, object);
+ /* Add org.freedesktop.xesam.Search */
+ if (!(object = dbus_register_object (connection,
+ 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);
+
+ dbus_g_proxy_add_signal (proxy, "NameOwnerChanged",
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_INVALID);
+
+ dbus_g_proxy_connect_signal (proxy, "NameOwnerChanged",
+ G_CALLBACK (tracker_dbus_xesam_name_owner_changed),
+ g_object_ref (object),
+ name_owner_changed_done);
+
+ objects = g_slist_prepend (objects, object);
}
/* Reverse list since we added objects at the top each time */
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 11:52:01 2008
@@ -219,13 +219,6 @@
}
static void
-free_file_change_queue (gpointer data, gpointer user_data)
-{
- TrackerDBFileChange *change = (TrackerDBFileChange *) data;
- tracker_db_file_change_free (&change);
-}
-
-static void
reset_blacklist_file (gchar *uri)
{
gchar *dirname;
@@ -881,7 +874,6 @@
tracker = g_new0 (Tracker, 1);
tracker->pid = getpid ();
- tracker->dir_queue = g_async_queue_new ();
tracker->max_process_queue_size = MAX_PROCESS_QUEUE_SIZE;
tracker->max_extract_queue_size = MAX_EXTRACT_QUEUE_SIZE;
@@ -939,8 +931,7 @@
}
/* Initialise other subsystems */
- tracker_log_init (G_LOG_DOMAIN,
- log_filename,
+ tracker_log_init (log_filename,
tracker_config_get_verbosity (tracker->config));
g_message ("Starting log");
@@ -951,6 +942,7 @@
tracker_nfs_lock_init (tracker->root_dir,
tracker_config_get_nfs_locking (tracker->config));
+ tracker_db_init ();
tracker_db_manager_init (tracker->data_dir,
tracker->user_data_dir,
tracker->sys_tmp_root_dir);
@@ -1000,10 +992,6 @@
*/
tracker->is_running = TRUE;
- /* Connect to databases */
- tracker->mainloop_db = tracker_db_connect_all ();
- tracker->xesam_db = tracker_db_connect_xesam ();
-
/* If we are already running, this should return some
* indication.
*/
@@ -1045,14 +1033,6 @@
g_slist_foreach (l, (GFunc) reset_blacklist_file, NULL);
g_slist_free (l);
- /* Remove file change queue */
- if (tracker->file_change_queue) {
- g_queue_foreach (tracker->file_change_queue,
- free_file_change_queue, NULL);
- g_queue_free (tracker->file_change_queue);
- tracker->file_change_queue = NULL;
- }
-
/* Set kill timeout */
g_timeout_add_full (G_PRIORITY_LOW, 20000, shutdown_timeout_cb, NULL, NULL);
@@ -1069,12 +1049,13 @@
tracker_email_shutdown ();
tracker_dbus_shutdown ();
- tracker_ontology_term ();
+ tracker_ontology_shutdown ();
tracker_cache_shutdown ();
tracker_xesam_shutdown ();
- tracker_db_manager_term ();
- tracker_nfs_lock_term ();
- tracker_log_term ();
+ tracker_db_shutdown ();
+ tracker_db_manager_shutdown ();
+ tracker_nfs_lock_shutdown ();
+ tracker_log_shutdown ();
if (tracker->language) {
g_object_unref (tracker->language);
@@ -1095,10 +1076,6 @@
g_async_queue_unref (tracker->file_metadata_queue);
}
- if (tracker->dir_queue) {
- g_async_queue_unref (tracker->dir_queue);
- }
-
return EXIT_SUCCESS;
}
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 11:52:01 2008
@@ -58,7 +58,6 @@
/* Config options */
guint32 watch_limit;
- gpointer mainloop_db;
gpointer xesam_db;
/* Data directories */
@@ -102,7 +101,6 @@
gint email_service_max;
/* Queue for recorad file changes */
- GQueue *file_change_queue;
gboolean black_list_timer_active;
/* Progress info for merges */
@@ -119,7 +117,6 @@
GAsyncQueue *file_process_queue;
GAsyncQueue *file_metadata_queue;
- GAsyncQueue *dir_queue;
GMutex *files_check_mutex;
GMutex *files_signal_mutex;
Modified: branches/xesam-support/src/trackerd/tracker-ontology.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-ontology.c (original)
+++ branches/xesam-support/src/trackerd/tracker-ontology.c Tue May 20 11:52:01 2008
@@ -132,7 +132,7 @@
}
void
-tracker_ontology_term (void)
+tracker_ontology_shutdown (void)
{
g_hash_table_remove_all (service_directory_table);
g_hash_table_remove_all (service_id_table);
Modified: branches/xesam-support/src/trackerd/tracker-ontology.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-ontology.h (original)
+++ branches/xesam-support/src/trackerd/tracker-ontology.h Tue May 20 11:52:01 2008
@@ -30,7 +30,7 @@
G_BEGIN_DECLS
void tracker_ontology_init (void);
-void tracker_ontology_term (void);
+void tracker_ontology_shutdown (void);
void tracker_ontology_add_service_type (TrackerService *service,
GSList *mimes,
GSList *mime_prefixes);
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 11:52:01 2008
@@ -52,6 +52,8 @@
#include "tracker-status.h"
#include "tracker-process-files.h"
+static GAsyncQueue *dir_queue;
+
static GSList *ignore_pattern_list;
static GSList *temp_black_list;
static GSList *crawl_directories;
@@ -1104,10 +1106,10 @@
/* Check dir_queue in case there are
* directories waiting to be indexed.
*/
- if (g_async_queue_length (tracker->dir_queue) > 0) {
+ if (g_async_queue_length (dir_queue) > 0) {
gchar *uri;
- uri = g_async_queue_try_pop (tracker->dir_queue);
+ uri = g_async_queue_try_pop (dir_queue);
if (uri) {
process_check_directory (tracker, uri);
@@ -1291,7 +1293,7 @@
case TRACKER_DB_ACTION_DIRECTORY_REFRESH:
if (need_index &&
tracker_process_files_should_be_watched (tracker->config, info->uri)) {
- g_async_queue_push (tracker->dir_queue, g_strdup (info->uri));
+ g_async_queue_push (dir_queue, g_strdup (info->uri));
if (tracker_index_stage_get () != TRACKER_INDEX_STAGE_EMAILS) {
tracker->folders_count++;
@@ -1304,7 +1306,7 @@
case TRACKER_DB_ACTION_DIRECTORY_CHECK:
if (need_index &&
tracker_process_files_should_be_watched (tracker->config, info->uri)) {
- g_async_queue_push (tracker->dir_queue, g_strdup (info->uri));
+ g_async_queue_push (dir_queue, g_strdup (info->uri));
if (info->indextime > 0) {
process_index_delete_directory_check (tracker, info->uri, db_con);
@@ -1501,25 +1503,31 @@
gpointer
tracker_process_files (gpointer data)
{
- DBConnection *db_con = tracker_db_connect_all ();
- Tracker *tracker;
- GObject *object;
- GSList *moved_from_list; /* List to hold moved_from
- * events whilst waiting for a
- * matching moved_to event.
- */
- gboolean pushed_events;
- gboolean first_run;
- gint initial_sleep;
+ Tracker *tracker;
+ DBConnection *db_con;
+ GObject *object;
+ GSList *moved_from_list; /* List to hold moved_from
+ * events whilst waiting for a
+ * matching moved_to event.
+ */
+ gboolean pushed_events;
+ gboolean first_run;
+ gint initial_sleep;
+ /* Set up thread */
process_block_signals ();
- object = tracker_dbus_get_object (TRACKER_TYPE_DBUS_DAEMON);
-
tracker = (Tracker*) data;
+ /* Lock this process */
g_mutex_lock (tracker->files_signal_mutex);
+ /* Get pointers we need */
+ db_con = tracker_db_connect_all ();
+ object = tracker_dbus_get_object (TRACKER_TYPE_DBUS_DAEMON);
+
+ dir_queue = g_async_queue_new ();
+
tracker->pause_io = TRUE;
/* When initially run, we set up variables */
@@ -1753,11 +1761,15 @@
tracker_db_close_all (db_con);
+ /* Clean up */
+ if (dir_queue) {
+ g_async_queue_unref (dir_queue);
+ }
+
g_mutex_unlock (tracker->files_signal_mutex);
g_message ("Process thread now finishing");
- g_thread_exit (NULL);
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]