Browse Source

battery-proxy: track bus registration ID

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
bboozzoo/wip
Maciek Borzecki 8 years ago
parent
commit
725eec8214
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/mconnect/battery-proxy.vala

+ 6
- 2
src/mconnect/battery-proxy.vala View File

@ -23,6 +23,7 @@ class BatteryHandlerProxy : Object, PacketHandlerInterfaceProxy {
private Device device = null;
private BatteryHandler battery_handler = null;
private uint register_id = 0;
public BatteryHandlerProxy.for_device_handler(Device dev,
PacketHandlerInterface iface) {
@ -42,12 +43,15 @@ class BatteryHandlerProxy : Object, PacketHandlerInterfaceProxy {
[DBus (visible = false)]
public void bus_register(DBusConnection conn, string path) throws IOError {
conn.register_object(path, this);
if (this.register_id == 0)
this.register_id = conn.register_object(path, this);
}
[DBus (visible = false)]
public void bus_unregister(DBusConnection conn) throws IOError {
//conn.unregister_object(this);
if (this.register_id != 0)
conn.unregister_object(this.register_id);
this.register_id = 0;
}
public signal void battery(uint level, bool charging);

Loading…
Cancel
Save