diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-10-26 11:57:56 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-10-26 11:57:56 +0100 |
commit | 3404e45c63664ee59a645062326a7ee53ad6968e (patch) | |
tree | 9e8fbabd22c26194ce7b7f72ec7a4856d1ce030f | |
parent | d0974811c803891aff5562fc8c4d18ea36d3f3a7 (diff) | |
parent | 33860bf0e3eeda568aa9347542947472c53b4d6b (diff) | |
download | ayatana-indicator-bluetooth-3404e45c63664ee59a645062326a7ee53ad6968e.tar.gz ayatana-indicator-bluetooth-3404e45c63664ee59a645062326a7ee53ad6968e.tar.bz2 ayatana-indicator-bluetooth-3404e45c63664ee59a645062326a7ee53ad6968e.zip |
Merge branch 'sunweaver-pr/indicator-specific-fixes'
Attributes GH PR #7: https://github.com/AyatanaIndicators/ayatana-indicator-bluetooth/pull/7
-rw-r--r-- | src/bluez.vala | 2 | ||||
-rw-r--r-- | src/desktop.vala | 22 | ||||
-rw-r--r-- | src/main.vala | 2 | ||||
-rw-r--r-- | src/profile.vala | 10 | ||||
-rw-r--r-- | src/service.vala | 2 |
5 files changed, 15 insertions, 23 deletions
diff --git a/src/bluez.vala b/src/bluez.vala index b74b53a..353a3af 100644 --- a/src/bluez.vala +++ b/src/bluez.vala @@ -27,7 +27,7 @@ public class Bluez: Bluetooth, Object uint name_watch_id = 0; uint next_device_id = 1; ObjectManager manager; - static const string BLUEZ_BUSNAME = "org.bluez"; + const string BLUEZ_BUSNAME = "org.bluez"; private bool _powered = false; diff --git a/src/desktop.vala b/src/desktop.vala index 5791e90..f764290 100644 --- a/src/desktop.vala +++ b/src/desktop.vala @@ -30,7 +30,7 @@ class Desktop: Profile { if (idle_rebuild_id != 0) { - Source.remove (idle_rebuild_id); + Source.remove (idle_rebuild_id); idle_rebuild_id = 0; } @@ -102,14 +102,11 @@ class Desktop: Profile { debug (@"creating action for $action_name"); var a = new SimpleAction.stateful (action_name, - null, + VariantType.BOOLEAN, new Variant.boolean (device.is_connected)); - a.activate.connect (() - => a.set_state (new Variant.boolean (!a.get_state().get_boolean()))); - - a.notify["state"].connect (() - => bluetooth.set_device_connected (id, a.get_state().get_boolean())); + a.activate.connect ((action, state) + => bluetooth.set_device_connected (id, state.get_boolean())); connect_actions.insert (device.id, a); action_group.add_action (a); @@ -139,7 +136,7 @@ class Desktop: Profile /* There is no working backend that can be used there, disable the action until that situation gets sorted out see http://launchpad.net/bugs/1562822 - + if (device.supports_browsing) submenu.append (_("Browse files…"), @"indicator.desktop-browse-files::$(device.address)"); @@ -255,14 +252,11 @@ class Desktop: Profile Action create_discoverable_action (Bluetooth bluetooth) { var action = new SimpleAction.stateful ("desktop-discoverable", - null, + VariantType.BOOLEAN, new Variant.boolean (bluetooth.discoverable)); - action.activate.connect (() - => action.set_state (new Variant.boolean (!action.get_state().get_boolean()))); - - action.notify["state"].connect (() - => bluetooth.try_set_discoverable (action.get_state().get_boolean())); + action.activate.connect ((action, state) + => bluetooth.try_set_discoverable (state.get_boolean())); bluetooth.notify["discoverable"].connect (() => action.set_state (new Variant.boolean (bluetooth.discoverable))); diff --git a/src/main.vala b/src/main.vala index be02a67..2b0c39b 100644 --- a/src/main.vala +++ b/src/main.vala @@ -27,7 +27,7 @@ public static int main (string[] args) // create the backend var bluetooth = new Bluez (null); - + // start the service var service = new Service (bluetooth); return service.run (); diff --git a/src/profile.vala b/src/profile.vala index 767a5cd..c52481f 100644 --- a/src/profile.vala +++ b/src/profile.vala @@ -123,14 +123,11 @@ class Profile: Object protected Action create_enabled_action (Bluetooth bluetooth) { var action = new SimpleAction.stateful ("bluetooth-enabled", - null, + VariantType.BOOLEAN, new Variant.boolean (bluetooth.enabled)); - action.activate.connect (() - => action.change_state (new Variant.boolean (!action.get_state().get_boolean()))); - - action.change_state.connect ((action, requestedValue) - => bluetooth.try_set_enabled (requestedValue.get_boolean())); + action.activate.connect ((action, state) + => bluetooth.try_set_enabled (state.get_boolean())); bluetooth.notify["enabled"].connect (() => action.set_state (new Variant.boolean (bluetooth.enabled))); @@ -170,6 +167,7 @@ class Profile: Object 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 (); } } diff --git a/src/service.vala b/src/service.vala index 4df3590..480834d 100644 --- a/src/service.vala +++ b/src/service.vala @@ -21,7 +21,7 @@ /** * Boilerplate class to own the name on the bus, * to create the profiles, and to export them on the bus. - */ + */ public class Service: Object { private MainLoop loop; |