diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2018-04-20 19:00:31 +0200 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2018-08-11 20:14:54 +0200 |
commit | eb24ea93bc550934d15223d002b490143e604921 (patch) | |
tree | 2a1c2151161a7178550871b43ebb84647107fcf3 /src/libtracker-sparql/tracker-connection.vala | |
parent | 061667e1eeac036130a944083aca4fcf16004e6a (diff) | |
download | tracker-eb24ea93bc550934d15223d002b490143e604921.tar.gz |
Add tracker_sparql_connection_get/set_dbus_connection()sam/tracker-sparql-connection-set-dbus-connection
Currently it's only possible to open a TrackerSparqlConnection to
an instance of Tracker that is running on the session-wide message bus.
There are use cases for running the Tracker daemons on a private
session bus though. In fact it's necessary to do this if you want to
set up a custom domain without having to become root and create .service
files in /usr/share/dbus-1/services. It would also be useful for the
functional-tests to be able to use libtracker-sparql instead of having
to talk directly to Tracker's D-Bus API.
Diffstat (limited to 'src/libtracker-sparql/tracker-connection.vala')
-rw-r--r-- | src/libtracker-sparql/tracker-connection.vala | 29 |
1 files changed, 29 insertions, 0 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 (); } |