aboutsummaryrefslogtreecommitdiff
path: root/src/bluez.vala
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-12-18 06:56:59 -0600
committerCharles Kerr <charles.kerr@canonical.com>2013-12-18 06:56:59 -0600
commitc2536fe01234b4c7d1755f0806053b4c21a26c71 (patch)
treee72ea137eb67adb0f47c91864303a8cbba430538 /src/bluez.vala
parent33dc5dc1c369eaf6dc53eed4759731441b4618fb (diff)
parenta99685027a4eb04112ca1c27e0c9423d0f9a4518 (diff)
downloadayatana-indicator-bluetooth-c2536fe01234b4c7d1755f0806053b4c21a26c71.tar.gz
ayatana-indicator-bluetooth-c2536fe01234b4c7d1755f0806053b4c21a26c71.tar.bz2
ayatana-indicator-bluetooth-c2536fe01234b4c7d1755f0806053b4c21a26c71.zip
sync with trunk
Diffstat (limited to 'src/bluez.vala')
-rw-r--r--src/bluez.vala23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/bluez.vala b/src/bluez.vala
index 1a1f837..a189a16 100644
--- a/src/bluez.vala
+++ b/src/bluez.vala
@@ -157,6 +157,8 @@ public class Bluez: Bluetooth, Object
critical (@"$(e.message)");
}
+ supported = object_path != null;
+
on_default_adapter_properties_changed ();
}
@@ -414,6 +416,7 @@ public class Bluez: Bluetooth, Object
supports_file_transfer));
devices_changed ();
+ update_connected ();
}
/* update the 'enabled' property by looking at the killswitch state
@@ -424,7 +427,22 @@ public class Bluez: Bluetooth, Object
debug (@"in upate_enabled, powered is $powered, blocked is $blocked");
enabled = powered && !blocked;
}
-
+
+ private bool have_connected_device ()
+ {
+ var devices = get_devices();
+
+ foreach (var device in devices)
+ if (device.is_connected)
+ return true;
+
+ return false;
+ }
+
+ private void update_connected ()
+ {
+ connected = have_connected_device ();
+ }
////
//// Public API
@@ -444,6 +462,8 @@ public class Bluez: Bluetooth, Object
device_connect (proxy);
else
device_disconnect (proxy);
+
+ update_connected ();
}
}
@@ -463,6 +483,7 @@ public class Bluez: Bluetooth, Object
public bool supported { get; protected set; default = false; }
public bool discoverable { get; protected set; default = false; }
public bool enabled { get; protected set; default = false; }
+ public bool connected { get; protected set; default = false; }
public void try_set_enabled (bool b)
{