diff options
author | Philip Van Hoof <philip@codeminded.be> | 2017-01-29 10:14:15 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-06-28 23:55:22 +0200 |
commit | 1753b8b9a0ab201bb051f2bf3c1b65e587987713 (patch) | |
tree | 9c2f504da978440282f2d5e2e32e36ebc1c78cb4 /src/tracker-store/tracker-dbus.vala | |
parent | 434841a73b5d17f03ecc44cc237e7dd5dc21debd (diff) | |
download | tracker-1753b8b9a0ab201bb051f2bf3c1b65e587987713.tar.gz |
Allow loading domain ontology from .desktop file
Diffstat (limited to 'src/tracker-store/tracker-dbus.vala')
-rw-r--r-- | src/tracker-store/tracker-dbus.vala | 104 |
1 files changed, 65 insertions, 39 deletions
diff --git a/src/tracker-store/tracker-dbus.vala b/src/tracker-store/tracker-dbus.vala index 6eb5faf51..dd9b66527 100644 --- a/src/tracker-store/tracker-dbus.vala +++ b/src/tracker-store/tracker-dbus.vala @@ -77,7 +77,7 @@ public class Tracker.DBus { } } - public static bool register_names (string? domain, string? ontology_name) { + public static bool register_names (string? domain, string? dbus_path, string? ontology_name) { /* Register the service name for org.freedesktop.Tracker */ if (domain != null) { @@ -126,10 +126,10 @@ public class Tracker.DBus { } } - static void set_available (bool available, string? domain, string? ontology_name) { + static void set_available (bool available, string? domain, string? dbus_path, string? ontology_name) { if (available) { if (resources_id == 0) { - register_objects (domain, ontology_name); + register_objects (domain, dbus_path, ontology_name); } } else { if (resources_id != 0) { @@ -147,8 +147,8 @@ public class Tracker.DBus { } } - public static void shutdown (string? domain, string? ontology_name) { - set_available (false, domain, ontology_name); + public static void shutdown (string? domain, string? dbus_path, string? ontology_name) { + set_available (false, domain, dbus_path, ontology_name); 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? ontology_name) { + public static Tracker.Status? register_notifier (string? domain, string? dbus_path, string? ontology_name) { if (connection == null) { critical ("D-Bus support must be initialized before registering objects!"); return null; @@ -178,18 +178,23 @@ public class Tracker.DBus { return null; } - if (domain != null) - if (ontology_name != null) - notifier_id = register_object (connection, notifier, "/"+domain+"/"+ontology_name+"/Status"); - else - notifier_id = register_object (connection, notifier, "/"+domain+"/Status"); - else + 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); + } return notifier; } - public static bool register_objects (string? domain, string? ontology_name) { + public static bool register_objects (string? domain, string? dbus_path, string? ontology_name) { //gpointer object, resources; if (connection == null) { @@ -204,14 +209,19 @@ public class Tracker.DBus { return false; } - if (domain != null) - if (ontology_name != null) - notifier_id = register_object (connection, notifier, "/"+domain+"/"+ontology_name+"/Statistics"); - else - notifier_id = register_object (connection, notifier, "/"+domain+"/Statistics"); - else + 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); - + } + /* Add org.freedesktop.Tracker1.Resources */ resources = new Tracker.Resources (connection, config); if (resources == null) { @@ -226,13 +236,18 @@ public class Tracker.DBus { 0, name_owner_changed_cb); - if (domain != null) - if (ontology_name != null) - notifier_id = register_object (connection, notifier, "/"+domain+"/"+ontology_name+"/Resources"); - else - notifier_id = register_object (connection, notifier, "/"+domain+"/Resources"); - else + 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); + } /* Add org.freedesktop.Tracker1.Steroids */ steroids = new Tracker.Steroids (); @@ -241,13 +256,18 @@ public class Tracker.DBus { return false; } - if (domain != null) - if (ontology_name != null) - notifier_id = register_object (connection, notifier, "/"+domain+"/"+ontology_name+"/Steroids"); - else - notifier_id = register_object (connection, notifier, "/"+domain+"/Steroids"); - else + 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); + } if (backup == null) { /* Add org.freedesktop.Tracker1.Backup */ @@ -257,13 +277,19 @@ public class Tracker.DBus { return false; } - if (domain != null) - if (ontology_name != null) - notifier_id = register_object (connection, notifier, "/"+domain+"/"+ontology_name+"/Backup"); - else - notifier_id = register_object (connection, notifier, "/"+domain+"/Backup"); - else - backup_id = register_object (connection, backup, Tracker.Backup.PATH); + + 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); + } } return true; |