commit 4315461a6c356da07e304b2bab63bd1c966d45df
parent fb4b7e7a0bb9a09f97d226b50479fe496baf70f1
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Tue, 4 Aug 2020 16:52:59 +0200
wfd-source: Update the switch state using set_state
The Gtk.Switch representing the p2p.Device's Enabled property should use
the "delayed state change" logic as described in Gtk.Switch docs, i.e.
we need to use .set_state() instead of .set_active() when we get
confirmation of the property having changed its value in the
PropertiesChanged handler. The ::active property is automatically
changed by Gtk.Switch on user input.
This way the UI gives visual feedback of when the device enable/disable
op starts and ends (or fails).
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/test/wfd-source b/test/wfd-source
@@ -1116,7 +1116,7 @@ class WFDSource(Gtk.Window):
dev_str = self.get_dev_string(path)
name = str(device.props['Name'])
label.set_markup(dev_str + '\n<small>' + ('Local name: ' + name + '\n' if dev_str != name else '') + 'State: ' + state + '</small>')
- switch.set_active(device.props['Enabled'])
+ switch.set_state(device.props['Enabled'])
def update_peer_props(self, dev_path, path):
device = self.devices[dev_path]
@@ -1560,7 +1560,6 @@ class WFDSource(Gtk.Window):
device = self.devices[path]
if device.props['Enabled'] == state:
return
- device.props['Enabled'] = state
device.props_proxy.Set(DEVICE_IF, 'Enabled', state)
return True