aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-10-10 14:58:46 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-10-10 14:58:46 -0500
commit0932c83d16f55832d52e06b48f40d3acd3a83692 (patch)
tree66b1fcec7959fce24c4f2fafa935a02f34bac312 /src
parent5165b13efd79ac2fc5bb6aa902b3ecedf84634f0 (diff)
downloadayatana-indicator-bluetooth-0932c83d16f55832d52e06b48f40d3acd3a83692.tar.gz
ayatana-indicator-bluetooth-0932c83d16f55832d52e06b48f40d3acd3a83692.tar.bz2
ayatana-indicator-bluetooth-0932c83d16f55832d52e06b48f40d3acd3a83692.zip
add an action whose state shows whether or not bluetooth is supported by the hardware, used by ubuntu-system-settings
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth.vala5
-rw-r--r--src/bluez.vala2
-rw-r--r--src/desktop.vala1
-rw-r--r--src/phone.vala1
-rw-r--r--src/profile.vala12
5 files changed, 21 insertions, 0 deletions
diff --git a/src/bluetooth.vala b/src/bluetooth.vala
index 98464a4..100bdf2 100644
--- a/src/bluetooth.vala
+++ b/src/bluetooth.vala
@@ -23,6 +23,10 @@
*/
public interface Bluetooth: Object
{
+ /* True if there are any bluetooth adapters on this system.
+ This work as a proxy for "does this hardware support bluetooth?" */
+ public abstract bool supported { get; protected set; }
+
/* True if there are any bluetooth adapters powered up on the system.
In short, whether or not this system's bluetooth is "on". */
public abstract bool powered { get; protected set; }
@@ -68,6 +72,7 @@ public abstract class KillswitchBluetooth: Object, Bluetooth
killswitch.notify["blocked"].connect (() => blocked = killswitch.blocked );
}
+ public bool supported { get; protected set; default = false; }
public bool powered { get; protected set; default = false; }
public bool discoverable { get; protected set; default = false; }
public bool blocked { get; protected set; default = true; }
diff --git a/src/bluez.vala b/src/bluez.vala
index 9baacd5..8c8c1b6 100644
--- a/src/bluez.vala
+++ b/src/bluez.vala
@@ -70,6 +70,8 @@ public class Bluez: KillswitchBluetooth
private void on_default_adapter_changed (string? object_path)
{
+ supported = object_path != null;
+
if (object_path != null) try
{
debug (@"using default adapter at $object_path");
diff --git a/src/desktop.vala b/src/desktop.vala
index 17d7cb6..7c99a45 100644
--- a/src/desktop.vala
+++ b/src/desktop.vala
@@ -52,6 +52,7 @@ class Desktop: Profile
// build the static actions
Action[] actions = {};
actions += root_action;
+ actions += create_supported_action (bluetooth);
actions += create_enabled_action (bluetooth);
actions += create_discoverable_action (bluetooth);
actions += create_wizard_action ();
diff --git a/src/phone.vala b/src/phone.vala
index 820b9f4..18c698c 100644
--- a/src/phone.vala
+++ b/src/phone.vala
@@ -32,6 +32,7 @@ class Phone: Profile
// build the static actions
Action[] actions = {};
actions += root_action;
+ actions += create_supported_action (bluetooth);
actions += create_enabled_action (bluetooth);
actions += create_settings_action ();
foreach (var a in actions)
diff --git a/src/profile.vala b/src/profile.vala
index cfe85e3..c32e46b 100644
--- a/src/profile.vala
+++ b/src/profile.vala
@@ -107,6 +107,18 @@ class Profile: Object
/// Actions
///
+ protected Action create_supported_action (Bluetooth bluetooth)
+ {
+ var action = new SimpleAction.stateful ("bluetooth-supported",
+ null,
+ bluetooth.supported);
+
+ bluetooth.notify["supported"].connect (()
+ => action.set_state (bluetooth.supported));
+
+ return action;
+ }
+
protected Action create_enabled_action (Bluetooth bluetooth)
{
var action = new SimpleAction.stateful ("bluetooth-enabled",