mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-21 22:09:23 +01:00
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).
This commit is contained in:
parent
fb4b7e7a0b
commit
4315461a6c
@ -1116,7 +1116,7 @@ class WFDSource(Gtk.Window):
|
|||||||
dev_str = self.get_dev_string(path)
|
dev_str = self.get_dev_string(path)
|
||||||
name = str(device.props['Name'])
|
name = str(device.props['Name'])
|
||||||
label.set_markup(dev_str + '\n<small>' + ('Local name: ' + name + '\n' if dev_str != name else '') + 'State: ' + state + '</small>')
|
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):
|
def update_peer_props(self, dev_path, path):
|
||||||
device = self.devices[dev_path]
|
device = self.devices[dev_path]
|
||||||
@ -1560,7 +1560,6 @@ class WFDSource(Gtk.Window):
|
|||||||
device = self.devices[path]
|
device = self.devices[path]
|
||||||
if device.props['Enabled'] == state:
|
if device.props['Enabled'] == state:
|
||||||
return
|
return
|
||||||
device.props['Enabled'] = state
|
|
||||||
device.props_proxy.Set(DEVICE_IF, 'Enabled', state)
|
device.props_proxy.Set(DEVICE_IF, 'Enabled', state)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user