tracker r1441 - in branches/indexer-split: . src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1441 - in branches/indexer-split: . src/trackerd
- Date: Fri, 16 May 2008 17:26:48 +0100 (BST)
Author: pvanhoof
Date: Fri May 16 16:26:47 2008
New Revision: 1441
URL: http://svn.gnome.org/viewvc/tracker?rev=1441&view=rev
Log:
2008-05-16 Philip Van Hoof <pvanhoof gnome org>
* DBus initialization. We must be more early at detecting whether or
not another DBus trackerd service is already running. Else during the
creation of the SQLite tables, a client that makes the DBus trackerd
service start would cause two trackerd instances to be running.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/trackerd/tracker-dbus.c
branches/indexer-split/src/trackerd/tracker-dbus.h
branches/indexer-split/src/trackerd/tracker-main.c
Modified: branches/indexer-split/src/trackerd/tracker-dbus.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.c (original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.c Fri May 16 16:26:47 2008
@@ -124,29 +124,25 @@
g_object_unref (data);
}
-gboolean
-tracker_dbus_init (Tracker *tracker)
+gboolean
+tracker_dbus_preinit (Tracker *tracker, DBusGConnection **connection_out, DBusGProxy **proxy_out)
{
DBusGConnection *connection;
DBusGProxy *proxy;
- GObject *object;
GError *error = NULL;
g_return_val_if_fail (tracker != NULL, FALSE);
+
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (!connection) {
tracker_error ("Could not connect to the DBus session bus, %s",
error ? error->message : "no error given.");
+ g_error_free (error);
return FALSE;
}
- /* Don't reinitialize */
- if (objects) {
- return TRUE;
- }
-
/* The definitions below (DBUS_SERVICE_DBUS, etc) are
* predefined for us to just use.
*/
@@ -160,6 +156,25 @@
return FALSE;
}
+ *connection_out = connection;
+ *proxy_out = proxy;
+
+ return TRUE;
+}
+
+gboolean
+tracker_dbus_init (Tracker *tracker, DBusGConnection *connection, DBusGProxy *proxy)
+{
+ GObject *object;
+
+ g_return_val_if_fail (tracker != NULL, FALSE);
+
+ /* Don't reinitialize */
+ if (objects) {
+ return TRUE;
+ }
+
+
/* Add org.freedesktop.Tracker */
if (!(object = dbus_register_object (connection,
proxy,
Modified: branches/indexer-split/src/trackerd/tracker-dbus.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.h (original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.h Fri May 16 16:26:47 2008
@@ -78,7 +78,12 @@
gpointer data2;
} TrackerDBusData;
-gboolean tracker_dbus_init (Tracker *tracker);
+gboolean tracker_dbus_preinit (Tracker *tracker,
+ DBusGConnection **connection_out,
+ DBusGProxy **proxy_out);
+gboolean tracker_dbus_init (Tracker *tracker,
+ DBusGConnection *connection,
+ DBusGProxy *proxy);
void tracker_dbus_shutdown (void);
guint tracker_dbus_get_next_request_id (void);
GObject * tracker_dbus_get_object (GType type);
Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c (original)
+++ branches/indexer-split/src/trackerd/tracker-main.c Fri May 16 16:26:47 2008
@@ -820,6 +820,8 @@
gint
main (gint argc, gchar *argv[])
{
+ DBusGConnection *connection = NULL;
+ DBusGProxy *proxy = NULL;
GOptionContext *context = NULL;
GError *error = NULL;
GThread *thread;
@@ -950,6 +952,9 @@
tracker_config_get_verbosity (tracker->config),
fatal_errors);
+ if (!tracker_dbus_preinit (tracker, &connection, &proxy))
+ return EXIT_FAILURE;
+
sanity_check_option_values ();
tracker_nfs_lock_init (tracker->root_dir,
@@ -1008,7 +1013,7 @@
/* If we are already running, this should return some
* indication.
*/
- if (!tracker_dbus_init (tracker)) {
+ if (!tracker_dbus_init (tracker, connection, proxy)) {
return EXIT_FAILURE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]