diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-06-26 06:54:13 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-06-26 06:54:13 +0200 |
commit | 4048650f387384c0f49b8ed7962a932de60bd2f2 (patch) | |
tree | 2f8e2ce3b443fd95338e2bb9628055503523e2b7 /src | |
parent | 1e922c24bd09ee216fb7ef9093ffecbd59d1670d (diff) | |
parent | b3adf1f4e9c406a7e3416259a9fa989f330f4942 (diff) | |
download | ayatana-indicator-bluetooth-4048650f387384c0f49b8ed7962a932de60bd2f2.tar.gz ayatana-indicator-bluetooth-4048650f387384c0f49b8ed7962a932de60bd2f2.tar.bz2 ayatana-indicator-bluetooth-4048650f387384c0f49b8ed7962a932de60bd2f2.zip |
Merge branch 'peat-psuwit-qmenumodel-compat'
Attributes GH PR #40: https://github.com/AyatanaIndicators/ayatana-indicator-bluetooth/pull/40
Diffstat (limited to 'src')
-rw-r--r-- | src/desktop.vala | 18 | ||||
-rw-r--r-- | src/profile.vala | 9 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/desktop.vala b/src/desktop.vala index ae9b0db..c70d49a 100644 --- a/src/desktop.vala +++ b/src/desktop.vala @@ -106,7 +106,7 @@ class Desktop: Profile var id = device.id; var action_name = @"desktop-device-$(id)-connected"; - var item = new MenuItem (_("Connection"), @"indicator.$action_name"); + var item = new MenuItem (_("Connection"), @"indicator.$(action_name)(true)"); item.set_attribute ("x-ayatana-type", "s", "org.ayatana.indicator.switch"); @@ -118,8 +118,11 @@ class Desktop: Profile VariantType.BOOLEAN, new Variant.boolean (device.is_connected)); - a.activate.connect ((action, state) - => bluetooth.set_device_connected (id, state.get_boolean())); + a.activate.connect ((action, param) + => a.change_state (param)); + + a.change_state.connect ((action, requestedValue) + => bluetooth.set_device_connected (id, requestedValue.get_boolean())); connect_actions.insert (device.id, a); action_group.add_action (a); @@ -223,7 +226,7 @@ class Desktop: Profile // quick toggles section section = new Menu (); section.append_item (create_enabled_menuitem ()); - item = new MenuItem (_("Visible"), "indicator.desktop-discoverable"); + item = new MenuItem (_("Visible"), "indicator.desktop-discoverable(true)"); item.set_attribute ("x-ayatana-type", "s", "org.ayatana.indicator.switch"); section.append_item (item); @@ -271,8 +274,11 @@ class Desktop: Profile VariantType.BOOLEAN, new Variant.boolean (bluetooth.discoverable)); - action.activate.connect ((action, state) - => bluetooth.try_set_discoverable (state.get_boolean())); + action.activate.connect ((action, param) + => action.change_state (param)); + + action.change_state.connect ((action, requestedValue) + => bluetooth.try_set_discoverable (requestedValue.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 708a3f0..69de0c5 100644 --- a/src/profile.vala +++ b/src/profile.vala @@ -86,7 +86,7 @@ class Profile: Object protected MenuItem create_enabled_menuitem () { - var item = new MenuItem (_("Bluetooth"), "indicator.bluetooth-enabled"); + var item = new MenuItem (_("Bluetooth"), "indicator.bluetooth-enabled(true)"); item.set_attribute ("x-ayatana-type", "s", "org.ayatana.indicator.switch"); @@ -126,8 +126,11 @@ class Profile: Object VariantType.BOOLEAN, new Variant.boolean (bluetooth.enabled)); - action.activate.connect ((action, state) - => bluetooth.try_set_enabled (state.get_boolean())); + action.activate.connect ((action, param) + => action.change_state (param)); + + action.change_state.connect ((action, requestedValue) + => bluetooth.try_set_enabled (requestedValue.get_boolean())); bluetooth.notify["enabled"].connect (() => action.set_state (new Variant.boolean (bluetooth.enabled))); |