summaryrefslogtreecommitdiff
path: root/src/libtracker-sparql
diff options
context:
space:
mode:
Diffstat (limited to 'src/libtracker-sparql')
-rw-r--r--src/libtracker-sparql/tracker-connection.vala29
-rw-r--r--src/libtracker-sparql/tracker-notifier.c4
2 files changed, 32 insertions, 1 deletions
diff --git a/src/libtracker-sparql/tracker-connection.vala b/src/libtracker-sparql/tracker-connection.vala
index 412f7e88f..a949ea26a 100644
--- a/src/libtracker-sparql/tracker-connection.vala
+++ b/src/libtracker-sparql/tracker-connection.vala
@@ -606,4 +606,33 @@ public abstract class Tracker.Sparql.Connection : Object {
* Since: 2.0
*/
public extern static string? get_domain ();
+
+ /**
+ * tracker_sparql_connection_set_dbus_connection:
+ * @dbus_connection: A #GDBusConnection to a suitable message bus.
+ *
+ * By default, a connection is opened to the session-wide Tracker services
+ * running on the D-Bus session bus. This function allows you to connect to
+ * Tracker services that are running on a different bus.
+ *
+ * This function must be called before any tracker_sparql_connection_get()
+ * calls happen.
+ *
+ * See also: the TRACKER_IPC_BUS environment variable.
+ *
+ * Since: 2.2
+ */
+ public extern static void set_dbus_connection (DBusConnection dbus_connection);
+
+ /**
+ * tracker_sparql_connection_get_dbus_connection:
+ *
+ * Gets the D-Bus connection that is used to contact the Tracker services.
+ *
+ * Returns: (transfer none): A #GDBusConnection instance, or %NULL if the
+ * default is being used.
+ *
+ * Since: 2.0
+ */
+ public extern static DBusConnection? get_dbus_connection ();
}
diff --git a/src/libtracker-sparql/tracker-notifier.c b/src/libtracker-sparql/tracker-notifier.c
index 72b29da65..7058955c0 100644
--- a/src/libtracker-sparql/tracker-notifier.c
+++ b/src/libtracker-sparql/tracker-notifier.c
@@ -704,7 +704,9 @@ tracker_notifier_initable_init (GInitable *initable,
tracker_notifier_cache_id (notifier, "nie:dataSource");
tracker_notifier_cache_id (notifier, "tracker:extractor-data-source");
- priv->dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, error);
+ priv->dbus_connection = tracker_sparql_connection_get_dbus_connection ();
+ if (!priv->dbus_connection)
+ priv->dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, error);
if (!priv->dbus_connection)
return FALSE;