aboutsummaryrefslogtreecommitdiff
path: root/src/profile.vala
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2022-08-01 20:32:52 +0200
committerRobert Tari <robert@tari.in>2022-08-01 20:32:52 +0200
commit5ebb1a368c658d014a37c7558a71d9bab7b4a8b0 (patch)
treed0f419602d28e49f9c9fec8a1d63e74d0a167bf8 /src/profile.vala
parented77cff40121e046cba4352e9e32060872f716b4 (diff)
downloadayatana-indicator-bluetooth-5ebb1a368c658d014a37c7558a71d9bab7b4a8b0.tar.gz
ayatana-indicator-bluetooth-5ebb1a368c658d014a37c7558a71d9bab7b4a8b0.tar.bz2
ayatana-indicator-bluetooth-5ebb1a368c658d014a37c7558a71d9bab7b4a8b0.zip
Hide bluetooth icon on hardware without bluetooth support
fixes https://github.com/AyatanaIndicators/ayatana-indicator-bluetooth/issues/42
Diffstat (limited to 'src/profile.vala')
-rw-r--r--src/profile.vala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/profile.vala b/src/profile.vala
index 69de0c5..4590e7c 100644
--- a/src/profile.vala
+++ b/src/profile.vala
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2022 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
class Profile: Object
@@ -167,8 +169,13 @@ class Profile: Object
var icon = new ThemedIcon.with_default_fallbacks (icon_name);
var builder = new VariantBuilder (new VariantType ("a{sv}"));
builder.add ("{sv}", "visible", new Variant.boolean (visible));
- builder.add ("{sv}", "accessible-desc", new Variant.string (a11y));
- builder.add ("{sv}", "icon", icon.serialize());
+
+ if (bluetooth.supported && visible)
+ {
+ builder.add ("{sv}", "accessible-desc", new Variant.string (a11y));
+ builder.add ("{sv}", "icon", icon.serialize());
+ }
+
builder.add ("{sv}", "title", new Variant.string (_("Bluetooth")));
return builder.end ();