[tracker/tracker-store] tracker-store: Do not implicitly start indexer
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-store] tracker-store: Do not implicitly start indexer
- Date: Thu, 25 Jun 2009 15:12:07 +0000 (UTC)
commit 0c699d6dd002bcf62c1f087f1b5a5fc418c6a5fb
Author: Jürg Billeter <j bitron ch>
Date: Thu Jun 25 16:52:08 2009 +0200
tracker-store: Do not implicitly start indexer
src/tracker-store/Makefile.am | 3 +-
src/tracker-store/tracker-backup.c | 2 +-
src/tracker-store/tracker-daemon.c | 84 -------------------
src/tracker-store/tracker-dbus.c | 144 ---------------------------------
src/tracker-store/tracker-main.c | 1 -
src/tracker-store/tracker-resources.c | 1 -
6 files changed, 2 insertions(+), 233 deletions(-)
---
diff --git a/src/tracker-store/Makefile.am b/src/tracker-store/Makefile.am
index 10e2c7a..cf936c7 100644
--- a/src/tracker-store/Makefile.am
+++ b/src/tracker-store/Makefile.am
@@ -96,8 +96,7 @@ dbus_sources = \
tracker-daemon-glue.h \
tracker-resources-glue.h \
tracker-search-glue.h \
- tracker-resources-class-glue.h \
- tracker-indexer-client.h
+ tracker-resources-class-glue.h
%-glue.h: $(top_srcdir)/data/dbus/%.xml
$(DBUSBINDINGTOOL) --mode=glib-server --output=$@ --prefix=$(subst -,_,$*) $^
diff --git a/src/tracker-store/tracker-backup.c b/src/tracker-store/tracker-backup.c
index d19500f..852f2aa 100644
--- a/src/tracker-store/tracker-backup.c
+++ b/src/tracker-store/tracker-backup.c
@@ -26,9 +26,9 @@
#include <libtracker-common/tracker-dbus.h>
#include <libtracker-common/tracker-status.h>
#include <libtracker-data/tracker-data-backup.h>
+#include <libtracker-data/tracker-data-update.h>
#include "tracker-dbus.h"
-#include "tracker-indexer-client.h"
#include "tracker-backup.h"
G_DEFINE_TYPE (TrackerBackup, tracker_backup, G_TYPE_OBJECT)
diff --git a/src/tracker-store/tracker-daemon.c b/src/tracker-store/tracker-daemon.c
index f8eec4d..3e7033c 100644
--- a/src/tracker-store/tracker-daemon.c
+++ b/src/tracker-store/tracker-daemon.c
@@ -36,7 +36,6 @@
#include "tracker-dbus.h"
#include "tracker-daemon.h"
#include <libtracker-data/tracker-data-manager.h>
-#include "tracker-indexer-client.h"
#include "tracker-main.h"
#include "tracker-marshal.h"
@@ -49,7 +48,6 @@
typedef struct {
TrackerConfig *config;
- DBusGProxy *indexer_proxy;
GHashTable *stats_cache;
guint stats_cache_timeout_id;
@@ -145,82 +143,12 @@ tracker_daemon_class_init (TrackerDaemonClass *klass)
}
static void
-indexer_started_cb (DBusGProxy *proxy,
- gpointer user_data)
-{
- TrackerDaemonPrivate *priv;
-
- priv = TRACKER_DAEMON_GET_PRIVATE (user_data);
-
- /* Make sure we have the cache timeout set up */
- if (priv->stats_cache_timeout_id != 0) {
- return;
- }
-
- g_debug ("Starting statistics cache timeout");
- priv->stats_cache_timeout_id =
- g_timeout_add_seconds (STATS_CACHE_LIFETIME,
- stats_cache_timeout,
- user_data);
-}
-
-static void
-indexer_finished_cb (DBusGProxy *proxy,
- gdouble seconds_elapsed,
- guint items_processed,
- guint items_done,
- gboolean interrupted,
- gpointer user_data)
-{
- TrackerDaemonPrivate *priv;
-
- tracker_daemon_signal_statistics ();
-
- priv = TRACKER_DAEMON_GET_PRIVATE (user_data);
-
- if (priv->stats_cache_timeout_id == 0) {
- return;
- }
-
- g_debug ("Stopping statistics cache timeout");
- g_source_remove (priv->stats_cache_timeout_id);
- priv->stats_cache_timeout_id = 0;
-}
-
-static void
-indexing_error_cb (DBusGProxy *proxy,
- const gchar *reason,
- gboolean requires_reindex,
- TrackerDaemon *daemon)
-{
- g_signal_emit (daemon, signals[INDEXING_ERROR], 0,
- reason, requires_reindex);
-}
-
-static void
tracker_daemon_init (TrackerDaemon *object)
{
TrackerDaemonPrivate *priv;
- DBusGProxy *proxy;
priv = TRACKER_DAEMON_GET_PRIVATE (object);
- proxy = tracker_dbus_indexer_get_proxy ();
- priv->indexer_proxy = g_object_ref (proxy);
-
- dbus_g_proxy_connect_signal (proxy, "Started",
- G_CALLBACK (indexer_started_cb),
- object,
- NULL);
- dbus_g_proxy_connect_signal (proxy, "Finished",
- G_CALLBACK (indexer_finished_cb),
- object,
- NULL);
- dbus_g_proxy_connect_signal (proxy, "IndexingError",
- G_CALLBACK (indexing_error_cb),
- object,
- NULL);
-
/* Do first time stats lookup */
priv->stats_cache = stats_cache_get_latest ();
@@ -243,22 +171,10 @@ tracker_daemon_finalize (GObject *object)
g_source_remove (priv->stats_cache_timeout_id);
}
- dbus_g_proxy_disconnect_signal (priv->indexer_proxy, "Started",
- G_CALLBACK (indexer_started_cb),
- daemon);
- dbus_g_proxy_disconnect_signal (priv->indexer_proxy, "Finished",
- G_CALLBACK (indexer_finished_cb),
- daemon);
- dbus_g_proxy_disconnect_signal (priv->indexer_proxy, "IndexingError",
- G_CALLBACK (indexing_error_cb),
- daemon);
-
if (priv->stats_cache) {
g_hash_table_unref (priv->stats_cache);
}
- g_object_unref (priv->indexer_proxy);
-
g_object_unref (priv->config);
G_OBJECT_CLASS (tracker_daemon_parent_class)->finalize (object);
diff --git a/src/tracker-store/tracker-dbus.c b/src/tracker-store/tracker-dbus.c
index bb8cfa8..38a20f9 100644
--- a/src/tracker-store/tracker-dbus.c
+++ b/src/tracker-store/tracker-dbus.c
@@ -45,20 +45,13 @@
#include "tracker-search-glue.h"
#include "tracker-backup.h"
#include "tracker-backup-glue.h"
-#include "tracker-indexer-client.h"
#include "tracker-utils.h"
#include "tracker-marshal.h"
#include "tracker-main.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"
-
static DBusGConnection *connection;
static DBusGProxy *gproxy;
-static DBusGProxy *proxy_for_indexer;
static GSList *objects;
-static gboolean indexer_available;
static gboolean
dbus_register_service (DBusGProxy *proxy,
@@ -108,37 +101,6 @@ dbus_register_object (DBusGConnection *lconnection,
dbus_g_connection_register_g_object (lconnection, path, object);
}
-static void
-indexer_name_owner_changed (DBusGProxy *proxy,
- const char *name,
- const char *prev_owner,
- const char *new_owner,
- gpointer *user_data)
-{
- if (strcmp (name, TRACKER_INDEXER_SERVICE) == 0) {
- if (!new_owner || !*new_owner) {
- g_debug ("Indexer no longer present");
- indexer_available = FALSE;
- } else {
- g_debug ("Indexer has become present");
- indexer_available = TRUE;
- }
- }
-}
-
-static void
-initialize_indexer_presence (DBusGProxy *proxy)
-{
- gchar *owner;
-
- if (org_freedesktop_DBus_get_name_owner (gproxy, TRACKER_INDEXER_SERVICE, &owner, NULL)) {
- indexer_available = (owner != NULL);
- g_free (owner);
- } else {
- indexer_available = FALSE;
- }
-}
-
static gboolean
dbus_register_names (TrackerConfig *config)
{
@@ -171,17 +133,6 @@ dbus_register_names (TrackerConfig *config)
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
- /* Register signals to know about tracker-indexer presence */
- dbus_g_proxy_add_signal (gproxy, "NameOwnerChanged",
- G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (gproxy, "NameOwnerChanged",
- G_CALLBACK (indexer_name_owner_changed),
- NULL, NULL);
-
- initialize_indexer_presence (gproxy);
-
/* Register the service name for org.freedesktop.Tracker */
if (!dbus_register_service (gproxy, TRACKER_DAEMON_SERVICE)) {
return FALSE;
@@ -222,11 +173,6 @@ tracker_dbus_shutdown (void)
gproxy = NULL;
}
- if (proxy_for_indexer) {
- g_object_unref (proxy_for_indexer);
- proxy_for_indexer = NULL;
- }
-
connection = NULL;
}
@@ -389,93 +335,3 @@ tracker_dbus_get_object (GType type)
return NULL;
}
-DBusGProxy *
-tracker_dbus_indexer_get_proxy (void)
-{
- if (!connection) {
- g_critical ("DBus support must be initialized before starting the indexer!");
- return NULL;
- }
-
- if (!proxy_for_indexer) {
- /* Get proxy for Service / Path / Interface of the indexer */
- proxy_for_indexer = dbus_g_proxy_new_for_name (connection,
- TRACKER_INDEXER_SERVICE,
- TRACKER_INDEXER_PATH,
- TRACKER_INDEXER_INTERFACE);
-
- if (!proxy_for_indexer) {
- g_critical ("Couldn't create a DBusGProxy to the indexer service");
- return NULL;
- }
-
- /* Add marshallers */
- dbus_g_object_register_marshaller (tracker_marshal_VOID__DOUBLE_STRING_UINT_UINT_UINT,
- G_TYPE_NONE,
- G_TYPE_DOUBLE,
- G_TYPE_STRING,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_INVALID);
- dbus_g_object_register_marshaller (tracker_marshal_VOID__DOUBLE_UINT_UINT_BOOL,
- G_TYPE_NONE,
- G_TYPE_DOUBLE,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
- dbus_g_object_register_marshaller (tracker_marshal_VOID__STRING_BOOLEAN,
- G_TYPE_NONE,
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
-
- /* Add signals, why can't we use introspection for this? */
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "Status",
- G_TYPE_DOUBLE,
- G_TYPE_STRING,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "Started",
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "Paused",
- G_TYPE_STRING,
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "Continued",
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "Finished",
- G_TYPE_DOUBLE,
- G_TYPE_UINT,
- G_TYPE_UINT,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "ModuleStarted",
- G_TYPE_STRING,
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "ModuleFinished",
- G_TYPE_STRING,
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "IndexingError",
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
- dbus_g_proxy_add_signal (proxy_for_indexer,
- "EventHappened",
- TRACKER_TYPE_EVENT_ARRAY,
- G_TYPE_INVALID);
-
- }
-
- return proxy_for_indexer;
-}
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index c9f2b2c..c373660 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -67,7 +67,6 @@
#include "tracker-dbus.h"
#include "tracker-events.h"
-#include "tracker-indexer-client.h"
#include "tracker-main.h"
#include "tracker-volume-cleanup.h"
#include "tracker-backup.h"
diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index b3059d4..ee0bb48 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -36,7 +36,6 @@
#include <libtracker-data/tracker-data-query.h>
#include <libtracker-data/tracker-data-update.h>
-#include "tracker-indexer-client.h"
#include "tracker-dbus.h"
#include "tracker-marshal.h"
#include "tracker-resources.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]