[tracker/wip/carlosg/domain-ontologies: 81/116] tracker-store: Register all objects with default DBus paths



commit bdcbb5efcaa9eec225007ac5a4db15be090d45d6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jun 18 23:25:50 2017 +0200

    tracker-store: Register all objects with default DBus paths
    
    Let's make the DBus name customizable, but making the DBus paths
    customizable too seems a bit overkill. It is fine to have multiple
    services implementing /org/freedesktop/Tracker1/* objects

 src/tracker-store/tracker-dbus.vala |   81 ++++++-----------------------------
 src/tracker-store/tracker-main.vala |    6 +-
 2 files changed, 16 insertions(+), 71 deletions(-)
---
diff --git a/src/tracker-store/tracker-dbus.vala b/src/tracker-store/tracker-dbus.vala
index dd9b665..d96473d 100644
--- a/src/tracker-store/tracker-dbus.vala
+++ b/src/tracker-store/tracker-dbus.vala
@@ -126,10 +126,10 @@ public class Tracker.DBus {
                }
        }
 
-       static void set_available (bool available, string? domain, string? dbus_path, string? ontology_name) {
+       static void set_available (bool available) {
                if (available) {
                        if (resources_id == 0) {
-                               register_objects (domain, dbus_path, ontology_name);
+                               register_objects ();
                        }
                } else {
                        if (resources_id != 0) {
@@ -147,8 +147,8 @@ public class Tracker.DBus {
                }
        }
 
-       public static void shutdown (string? domain, string? dbus_path, string? ontology_name) {
-               set_available (false, domain, dbus_path, ontology_name);
+       public static void shutdown () {
+               set_available (false);
 
                if (backup != null) {
                        connection.unregister_object (backup_id);
@@ -165,7 +165,7 @@ public class Tracker.DBus {
                connection = null;
        }
 
-       public static Tracker.Status? register_notifier (string? domain, string? dbus_path, string? 
ontology_name) {
+       public static Tracker.Status? register_notifier () {
                if (connection == null) {
                        critical ("D-Bus support must be initialized before registering objects!");
                        return null;
@@ -177,24 +177,13 @@ public class Tracker.DBus {
                        critical ("Could not create TrackerStatus object to register");
                        return null;
                }
-               
-               if (domain != null) {
-                       if (dbus_path != null ) {
-                               notifier_id = register_object (connection, notifier, dbus_path+"/Status");
-                       } else {
-                               if (ontology_name != null)
-                                       notifier_id = register_object (connection, notifier, 
"/"+domain+"/"+ontology_name+"/Status");
-                               else
-                                       notifier_id = register_object (connection, notifier, 
"/"+domain+"/Status");
-                       }
-               } else {
-                       notifier_id = register_object (connection, notifier, Tracker.Status.PATH);
-               }
+
+               notifier_id = register_object (connection, notifier, Tracker.Status.PATH);
 
                return notifier;
        }
 
-       public static bool register_objects (string? domain, string? dbus_path, string? ontology_name) {
+       public static bool register_objects () {
                //gpointer object, resources;
 
                if (connection == null) {
@@ -209,19 +198,8 @@ public class Tracker.DBus {
                        return false;
                }
 
-               if (domain != null) {
-                       if (dbus_path != null ) {
-                               statistics_id = register_object (connection, notifier, 
dbus_path+"/Statistics");
-                       } else {
-                               if (ontology_name != null)
-                                       statistics_id = register_object (connection, notifier, 
"/"+domain+"/"+ontology_name+"/Statistics");
-                               else
-                                       statistics_id = register_object (connection, notifier, 
"/"+domain+"/Statistics");
-                       }
-               } else {
-                       statistics_id = register_object (connection, statistics, Tracker.Statistics.PATH);
-               }
-               
+               statistics_id = register_object (connection, statistics, Tracker.Statistics.PATH);
+
                /* Add org.freedesktop.Tracker1.Resources */
                resources = new Tracker.Resources (connection, config);
                if (resources == null) {
@@ -236,18 +214,7 @@ public class Tracker.DBus {
                        0,
                        name_owner_changed_cb);
 
-               if (domain != null) {
-                       if (dbus_path != null ) {
-                               resources_id = register_object (connection, notifier, dbus_path+"/Resources");
-                       } else {
-                               if (ontology_name != null)
-                                       resources_id = register_object (connection, notifier, 
"/"+domain+"/"+ontology_name+"/Resources");
-                               else
-                                       resources_id = register_object (connection, notifier, 
"/"+domain+"/Resources");
-                       }
-               } else {
-                       resources_id = register_object (connection, resources, Tracker.Resources.PATH);
-               }
+               resources_id = register_object (connection, resources, Tracker.Resources.PATH);
 
                /* Add org.freedesktop.Tracker1.Steroids */
                steroids = new Tracker.Steroids ();
@@ -256,18 +223,7 @@ public class Tracker.DBus {
                        return false;
                }
 
-               if (domain != null) {
-                       if (dbus_path != null ) {
-                               steroids_id = register_object (connection, notifier, dbus_path+"/Steroids");
-                       } else {
-                               if (ontology_name != null)
-                                       steroids_id = register_object (connection, notifier, 
"/"+domain+"/"+ontology_name+"/Steroids");
-                               else
-                                       steroids_id = register_object (connection, notifier, 
"/"+domain+"/Steroids");
-                       }
-               } else {
-                       steroids_id = register_object (connection, steroids, Tracker.Steroids.PATH);
-               }
+               steroids_id = register_object (connection, steroids, Tracker.Steroids.PATH);
 
                if (backup == null) {
                        /* Add org.freedesktop.Tracker1.Backup */
@@ -278,18 +234,7 @@ public class Tracker.DBus {
                        }
 
 
-                       if (domain != null) {
-                               if (dbus_path != null ) {
-                                       backup_id = register_object (connection, notifier, 
dbus_path+"/Backup");
-                               } else {
-                                       if (ontology_name != null)
-                                               backup_id = register_object (connection, notifier, 
"/"+domain+"/"+ontology_name+"/Backup");
-                                       else
-                                               backup_id = register_object (connection, notifier, 
"/"+domain+"/Backup");
-                               }
-                       } else {
-                               backup_id = register_object (connection, backup, Tracker.Backup.PATH);
-                       }
+                       backup_id = register_object (connection, backup, Tracker.Backup.PATH);
                }
 
                return true;
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index bbb96ac..92415f9 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -305,12 +305,12 @@ License which can be viewed at:
                        flags |= DBManagerFlags.FORCE_REINDEX;
                }
 
-               var notifier = Tracker.DBus.register_notifier (domain, dbus_path, ontology_name);
+               var notifier = Tracker.DBus.register_notifier ();
 
                Tracker.Store.init ();
 
                /* Make Tracker available for introspection */
-               if (!Tracker.DBus.register_objects (domain, dbus_path, ontology_name)) {
+               if (!Tracker.DBus.register_objects ()) {
                        return 1;
                }
 
@@ -416,7 +416,7 @@ License which can be viewed at:
                Tracker.Events.shutdown ();
 
                data_manager = null;
-               Tracker.DBus.shutdown (domain, dbus_path, ontology_name);
+               Tracker.DBus.shutdown ();
                Tracker.Log.shutdown ();
 
                config.disconnect (config_verbosity_id);


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