From 7a814ffdc480278af5521ddfda213c34dd99d598 Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Thu, 1 Jun 2017 08:40:52 +0200 Subject: [PATCH] application: DBus registration, register manager object --- src/mconnect/application.vala | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/mconnect/application.vala b/src/mconnect/application.vala index 254ce4b..5e1aa6c 100644 --- a/src/mconnect/application.vala +++ b/src/mconnect/application.vala @@ -31,12 +31,20 @@ namespace Mconn { {null} }; + private Discovery discovery = null; + private DeviceManager manager = null; + public Application() { - Object(application_id: "org.bboozzoo.mconnect"); + Object(application_id: "org.mconnect"); add_main_option_entries(options); + + discovery = new Discovery(); + manager = new DeviceManager(); } protected override void startup() { + debug("startup"); + base.startup(); if (log_debug == true) @@ -51,9 +59,6 @@ namespace Mconn { Notify.init("mconnect"); - var discovery = new Discovery(); - var manager = new DeviceManager(); - discovery.device_found.connect((disc, dev) => { manager.found_device(dev); }); @@ -65,7 +70,21 @@ namespace Mconn { } protected override void activate() { + debug("activate"); hold(); } + + public override bool dbus_register(DBusConnection conn, string object_path) throws Error { + base.dbus_register(conn, object_path); + debug("dbus register, path %s", object_path); + + conn.register_object("/org/mconnect/manager", manager); + return true; + } + + public override void dbus_unregister(DBusConnection conn, string object_path) { + base.dbus_unregister(conn, object_path); + debug("dbus unregister, path %s", object_path); + } } } \ No newline at end of file