[PATCH master] Fix configuration of protected wireless connections (#855526).

Radek Vykydal rvykydal at redhat.com
Thu Oct 11 08:14:54 UTC 2012


F18 Beta blocker.

With this fix, wireless secrets can be set in nm-c-e with [Configure]
button.

I am planning to use secret agent for wireless secrets (either nm-applet                                                                                                           or our own). Currently NM requires running session for secret agent                                                                                                                which is very hard to achieve in Anaconda. Dan Williams is working
on support for private dbus socket where session will not be required
for the agent.

---
 pyanaconda/ui/gui/spokes/network.py |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 39b320e..27266ff 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -280,6 +280,7 @@ class NetworkControlBox():
         model = combobox.get_model()
         model.set_sort_column_id(2, Gtk.SortType.ASCENDING)
         combobox.connect("changed", self.on_wireless_ap_changed_cb)
+        self.selected_ssid = None
 
         # NM Client
         self.client.connect("device-added", self.on_device_added)
@@ -386,6 +387,7 @@ class NetworkControlBox():
 
         device = self.selected_device()
         ap_obj_path, ssid_target = combobox.get_model().get(iter, 0, 1)
+        self.selected_ssid = ssid_target
         if ap_obj_path == "ap-other...":
             return
 
@@ -416,14 +418,10 @@ class NetworkControlBox():
 
         con = self.find_active_connection_for_device(device)
         if not con and configuration_of_disconnected_devices_allowed:
+            ssid = None
             if device.get_device_type() == NetworkManager.DeviceType.WIFI:
-                combobox = self.builder.get_object("combobox_wireless_network_name")
-                iter = combobox.get_active_iter()
-                if not iter:
-                    return
-                ap_obj_path, ssid = combobox.get_model().get(iter, 0, 1)
-
-            con = self.find_connection_for_device(device, ssid=None)
+                ssid = self.selected_ssid
+            con = self.find_connection_for_device(device, ssid)
 
         if con:
             uuid = con.get_uuid()
@@ -693,6 +691,16 @@ class NetworkControlBox():
                 active = active_ap and active_ap.get_path() == ap.get_path()
                 self._add_ap(ap, active)
             # TODO: add access point other...
+            if active_ap:
+                combobox = self.builder.get_object("combobox_wireless_network_name")
+                store = combobox.get_model()
+                i = store.get_iter_first()
+                while i:
+                    if store[i][1] == active_ap.get_ssid():
+                        combobox.set_active_iter(i)
+                        self.selected_ssid = active_ap.get_ssid()
+                        break
+                    i = store.iter_next(i)
             self._updating_device = False
 
     def _refresh_speed_hwaddr(self, device):
-- 
1.7.4



More information about the anaconda-patches mailing list