[tracker/wip/carlosg/tracker-3.0-api-breaks: 27/95] libtracker-bus: Talk to org.freedesktop.Tracker1.Endpoint



commit 2c90a163bdf2e930283acf40ab0ecf8f2a54e70a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 18 15:49:42 2019 +0100

    libtracker-bus: Talk to org.freedesktop.Tracker1.Endpoint
    
    Owners of a TrackerSparqlConnection were already able to to export
    it via DBus through TrackerEndpointDBus. This closes the circle,
    and lets DBus-based TrackerSparqlConnections to talk with these
    endpoints. This works both for direct API calls
    (tracker_sparql_connection_bus_new), and calls to other DBus services
    through the SERVICE{} syntax in SPARQL queries.
    
    One notable thing left out by this circle: Nobody talks anymore
    to tracker-store.

 src/libtracker-bus/tracker-bus.vala                | 20 ++++++--------------
 src/libtracker-sparql-backend/tracker-backend.vala |  2 +-
 2 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index 185368abf..56bfae113 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -21,7 +21,10 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
        DBusConnection bus;
        string dbus_name;
 
-       public Connection (string dbus_name, DBusConnection? dbus_connection, bool start) throws 
Sparql.Error, IOError, DBusError, GLib.Error {
+       private const string ENDPOINT_PATH = "/org/freedesktop/Tracker1/Endpoint";
+       private const string ENDPOINT_IFACE = "org.freedesktop.Tracker1.Endpoint";
+
+       public Connection (string dbus_name, DBusConnection? dbus_connection) throws Sparql.Error, IOError, 
DBusError, GLib.Error {
                this.dbus_name = dbus_name;
 
                if (dbus_connection == null)
@@ -29,17 +32,6 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
                else
                        bus = dbus_connection;
 
-               if (start) {
-                       debug ("Waiting for service to become available...");
-
-                       // do not use proxy to work around race condition in GDBus
-                       // NB#259760
-                       var msg = new DBusMessage.method_call (dbus_name, Tracker.DBUS_OBJECT_STATUS, 
Tracker.DBUS_INTERFACE_STATUS, "Wait");
-                       bus.send_message_with_reply_sync (msg, 0, /* timeout */ int.MAX, null).to_gerror ();
-
-                       debug ("Service is ready");
-               }
-
                // ensure that error domain is registered with GDBus
                new Sparql.Error.INTERNAL ("");
        }
@@ -68,7 +60,7 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
        }
 
        void send_query (string sparql, UnixOutputStream output, Cancellable? cancellable, 
AsyncReadyCallback? callback) throws GLib.IOError, GLib.Error {
-               var message = new DBusMessage.method_call (dbus_name, Tracker.DBUS_OBJECT_STEROIDS, 
Tracker.DBUS_INTERFACE_STEROIDS, "Query");
+               var message = new DBusMessage.method_call (dbus_name, ENDPOINT_PATH, ENDPOINT_IFACE, "Query");
                var fd_list = new UnixFDList ();
                message.set_body (new Variant ("(sh)", sparql, fd_list.append (output.fd)));
                message.set_unix_fd_list (fd_list);
@@ -130,7 +122,7 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
        }
 
        void send_update (string method, UnixInputStream input, Cancellable? cancellable, AsyncReadyCallback? 
callback) throws GLib.Error, GLib.IOError {
-               var message = new DBusMessage.method_call (dbus_name, Tracker.DBUS_OBJECT_STEROIDS, 
Tracker.DBUS_INTERFACE_STEROIDS, method);
+               var message = new DBusMessage.method_call (dbus_name, ENDPOINT_PATH, ENDPOINT_IFACE, method);
                var fd_list = new UnixFDList ();
                message.set_body (new Variant ("(h)", fd_list.append (input.fd)));
                message.set_unix_fd_list (fd_list);
diff --git a/src/libtracker-sparql-backend/tracker-backend.vala 
b/src/libtracker-sparql-backend/tracker-backend.vala
index 195847812..114c22980 100644
--- a/src/libtracker-sparql-backend/tracker-backend.vala
+++ b/src/libtracker-sparql-backend/tracker-backend.vala
@@ -324,7 +324,7 @@ public static Tracker.Sparql.Connection tracker_sparql_connection_remote_new (st
 }
 
 public static Tracker.Sparql.Connection tracker_sparql_connection_bus_new (string service, DBusConnection? 
conn) throws Tracker.Sparql.Error, IOError, DBusError, GLib.Error {
-       return new Tracker.Bus.Connection (service, conn, true);
+       return new Tracker.Bus.Connection (service, conn);
 }
 
 public static Tracker.Sparql.Connection tracker_sparql_connection_new (Tracker.Sparql.ConnectionFlags flags, 
File store, File? ontology, Cancellable? cancellable = null) throws GLib.Error, Tracker.Sparql.Error, IOError 
{


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]