From: Radek Vykydal <rvykydal(a)redhat.com>
---
pyanaconda/ui/gui/spokes/network.py | 44 ++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index c8ae679..cd765ba 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -513,11 +513,10 @@ def on_device_added(self, client, device, *args):
def on_device_removed(self, client, device, *args):
self.remove_device(device)
- def _find_first_ap_setting_uuid(self, device, ap):
- uuid = None
+ def _find_first_ap_setting(self, device, ap):
for con in device.filter_connections(self.client.get_connections()):
if con.get_setting_wireless().get_ssid().get_data() ==
ap.get_ssid().get_data():
- return con.get_uuid()
+ return con
def on_edit_connection(self, *args):
dev_cfg = self.selected_dev_cfg()
@@ -525,6 +524,8 @@ def on_edit_connection(self, *args):
return
devname = dev_cfg.get_iface()
+ device = dev_cfg.device
+ con = dev_cfg.con
activate = None
ssid = ""
@@ -532,32 +533,29 @@ def on_edit_connection(self, *args):
if not self.selected_ap:
return
ssid = self.selected_ap.get_ssid().get_data()
- uuid = self._find_first_ap_setting_uuid(dev_cfg.device, self.selected_ap)
- if uuid:
- # 871132 auto activate wireless connection after editing if it is not
- # already activated (assume entering secrets)
- # TODONM check ssid instead of ap?, is it needed at all?
- condition = lambda: self.selected_ap !=
dev_cfg.device.get_active_access_point()
- activate = (uuid, devname, condition)
- else:
+ con = self._find_first_ap_setting(device, self.selected_ap)
+ if not con:
log.debug("network: on_edit_connection: connection for ap %s not
found", self.selected_ap)
return
+ # 871132 auto activate wireless connection after editing if it is not
+ # already activated (assume entering secrets)
+ condition = lambda: self.selected_ap != device.get_active_access_point()
+ activate = (con, device, condition)
else:
- uuid = dev_cfg.get_uuid()
- if not uuid:
- log.debug("network: on_edit_connection: connection for device %s not
found", devname)
+ if not con:
+ log.debug("network: on_edit_connection: connection for device %s not
found", dev_cfg.get_iface())
return
if devname in nm.nm_activated_devices():
# Reactivate the connection after configuring it (if it changed)
- settings = nm.nm_get_settings(uuid, "connection",
"uuid")
- settings_changed = lambda: settings != nm.nm_get_settings(uuid,
"connection", "uuid")
- activate = (uuid, devname, settings_changed)
+ settings = con.to_dbus(NM.ConnectionSerializationFlags.ALL)
+ settings_changed = lambda: settings !=
con.to_dbus(NM.ConnectionSerializationFlags.ALL)
+ activate = (con, device, settings_changed)
log.info("network: configuring connection %s device %s ssid %s",
- uuid, devname, ssid)
+ con.get_uuid(), dev_cfg.get_iface(), ssid)
self.kill_nmce(msg="Configure button clicked")
- proc = startProgram(["nm-connection-editor", "--edit",
"%s" % uuid], reset_lang=False)
+ proc = startProgram(["nm-connection-editor", "--edit",
"%s" % con.get_uuid()], reset_lang=False)
self._running_nmce = proc
GLib.child_watch_add(proc.pid, self.on_nmce_exited, activate)
@@ -580,13 +578,13 @@ def on_nmce_exited(self, pid, condition, activate=None):
if condition == 0:
if activate:
# The default of None confuses pylint
- uuid, devname, activate_condition = activate # pylint:
disable=unpacking-non-sequence
+ con, device, activate_condition = activate # pylint:
disable=unpacking-non-sequence
if activate_condition():
- gtk_call_once(self._activate_connection_cb, uuid, devname)
+ gtk_call_once(self._activate_connection_cb, con, device)
network.logIfcfgFiles("nm-c-e run")
- def _activate_connection_cb(self, uuid, devname):
- nm.nm_activate_device_connection(devname, uuid)
+ def _activate_connection_cb(self, con, device):
+ self.client.activate_connection_async(con, device, None, None,
self.added_con_cb)
def on_wireless_enabled(self, *args):
switch = self.builder.get_object("device_wireless_off_switch")
--
To view this commit on github, visit
https://github.com/rhinstaller/anaconda/commit/ea2776bd688d0dd3f8f451d259...