diff options
-rw-r--r-- | src/bluez.vala | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/bluez.vala b/src/bluez.vala index 3e9df06..b74b53a 100644 --- a/src/bluez.vala +++ b/src/bluez.vala @@ -57,6 +57,8 @@ public class Bluez: Bluetooth, Object public Bluez (KillSwitch? killswitch) { + init_bluez_state_vars (); + if ((killswitch != null) && (killswitch.is_valid())) { this.killswitch = killswitch; @@ -82,7 +84,7 @@ public class Bluez: Bluetooth, Object bus = connection; - reset_bluez_lookup_vars(); + init_bluez_state_vars(); reset_manager(); } @@ -90,15 +92,10 @@ public class Bluez: Bluetooth, Object { debug(@"$name vanished from the bus"); - reset_bluez_lookup_vars(); - - devices_changed (); - update_combined_adapter_state (); - update_connected (); - update_enabled (); + reset_bluez(); } - private void reset_bluez_lookup_vars () + private void init_bluez_state_vars () { id_to_path = new HashTable<uint,ObjectPath> (direct_hash, direct_equal); id_to_device = new HashTable<uint,Device> (direct_hash, direct_equal); @@ -107,6 +104,16 @@ public class Bluez: Bluetooth, Object path_to_device_proxy = new HashTable<ObjectPath,BluezDevice> (str_hash, str_equal); } + private void reset_bluez () + { + init_bluez_state_vars (); + + devices_changed (); + update_combined_adapter_state (); + update_connected (); + update_enabled (); + } + private void reset_manager() { try |