[tracker/mainloop-fixes] libtracker-sparql: Use raw D-Bus connection to fix mainloop registration
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/mainloop-fixes] libtracker-sparql: Use raw D-Bus connection to fix mainloop registration
- Date: Wed, 13 Oct 2010 09:55:38 +0000 (UTC)
commit a2230952e9013ad57f9b7ffed846d6c0eebfc2e5
Author: Jürg Billeter <j bitron ch>
Date: Wed Oct 13 11:55:09 2010 +0200
libtracker-sparql: Use raw D-Bus connection to fix mainloop registration
src/libtracker-bus/tracker-bus.vala | 8 ++++++--
src/libtracker-sparql/tracker-backend.vala | 16 ++++++++++++----
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index c8fba06..43d9e03 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -33,6 +33,8 @@ private interface Tracker.Bus.Statistics : GLib.Object {
// Imported DBus FD API until we have support with Vala
public extern Tracker.Sparql.Cursor tracker_bus_fd_query (DBus.Connection connection, string query, Cancellable? cancellable) throws Tracker.Sparql.Error, DBus.Error, GLib.IOError;
+extern unowned DBus.Connection dbus_connection_get_g_connection (DBus.RawConnection raw);
+
// Actual class definition
public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
static DBus.Connection connection;
@@ -45,9 +47,11 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
initialized = true;
try {
- connection = DBus.Bus.get (DBus.BusType.SESSION);
+ var raw_error = DBus.RawError ();
+ var raw_connection = DBus.RawBus.get (DBus.BusType.SESSION, ref raw_error);
- connection.get_connection().setup_with_main(MainContext.get_thread_default());
+ raw_connection.setup_with_main(MainContext.get_thread_default());
+ connection = dbus_connection_get_g_connection (raw_connection);
// FIXME: Ideally we would just get these as and when we need them
resources_object = (Resources) connection.get_object (TRACKER_DBUS_SERVICE,
diff --git a/src/libtracker-sparql/tracker-backend.vala b/src/libtracker-sparql/tracker-backend.vala
index 08986e0..c2240fd 100644
--- a/src/libtracker-sparql/tracker-backend.vala
+++ b/src/libtracker-sparql/tracker-backend.vala
@@ -24,6 +24,8 @@ interface Tracker.Backend.Status : GLib.Object {
public abstract async void wait_async () throws DBus.Error;
}
+extern unowned DBus.Connection dbus_connection_get_g_connection (DBus.RawConnection raw);
+
class Tracker.Sparql.Backend : Connection {
static bool is_constructed = false;
static bool is_initialized = false;
@@ -60,8 +62,11 @@ class Tracker.Sparql.Backend : Connection {
public override void init () throws Sparql.Error
requires (is_constructed) {
try {
- var connection = DBus.Bus.get (DBus.BusType.SESSION);
- connection.get_connection().setup_with_main(MainContext.get_thread_default());
+ var raw_error = DBus.RawError ();
+ var raw_connection = DBus.RawBus.get (DBus.BusType.SESSION, ref raw_error);
+
+ raw_connection.setup_with_main(MainContext.get_thread_default());
+ var connection = dbus_connection_get_g_connection (raw_connection);
var status = (Tracker.Backend.Status) connection.get_object (TRACKER_DBUS_SERVICE,
TRACKER_DBUS_OBJECT_STATUS,
TRACKER_DBUS_INTERFACE_STATUS);
@@ -81,8 +86,11 @@ class Tracker.Sparql.Backend : Connection {
public async override void init_async () throws Sparql.Error
requires (is_constructed) {
try {
- var connection = DBus.Bus.get (DBus.BusType.SESSION);
- connection.get_connection().setup_with_main(MainContext.get_thread_default());
+ var raw_error = DBus.RawError ();
+ var raw_connection = DBus.RawBus.get (DBus.BusType.SESSION, ref raw_error);
+
+ raw_connection.setup_with_main(MainContext.get_thread_default());
+ var connection = dbus_connection_get_g_connection (raw_connection);
var status = (Tracker.Backend.Status) connection.get_object (TRACKER_DBUS_SERVICE,
TRACKER_DBUS_OBJECT_STATUS,
TRACKER_DBUS_INTERFACE_STATUS);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]