aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2020-10-25 16:27:45 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-10-26 11:57:18 +0100
commit33860bf0e3eeda568aa9347542947472c53b4d6b (patch)
tree9e8fbabd22c26194ce7b7f72ec7a4856d1ce030f /src
parentfd441718e6d6b561c63f5d71edca7b6370b000fe (diff)
downloadayatana-indicator-bluetooth-33860bf0e3eeda568aa9347542947472c53b4d6b.tar.gz
ayatana-indicator-bluetooth-33860bf0e3eeda568aa9347542947472c53b4d6b.tar.bz2
ayatana-indicator-bluetooth-33860bf0e3eeda568aa9347542947472c53b4d6b.zip
src/*: Switch to new activate state connect approach, rathern than using notify["state"].connect.
Diffstat (limited to 'src')
-rw-r--r--src/desktop.vala18
-rw-r--r--src/profile.vala9
2 files changed, 9 insertions, 18 deletions
diff --git a/src/desktop.vala b/src/desktop.vala
index 6e69bb4..f764290 100644
--- a/src/desktop.vala
+++ b/src/desktop.vala
@@ -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);
@@ -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/profile.vala b/src/profile.vala
index 921b573..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)));