From 8589f25e379723a90d8c168181456ea3ba92062c Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 09 Jul 2009 11:32:06 +0000 Subject: Serialize adhoc wireless settings --- diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py index 0abf25e..91de9f2 100644 --- a/extensions/deviceicon/network.py +++ b/extensions/deviceicon/network.py @@ -394,9 +394,8 @@ class WirelessDeviceView(ToolButton): settings.connection.id = 'Auto ' + connection_name settings.connection.uuid = unique_id() settings.connection.type = '802-11-wireless' - settings.connection.mode = 'adhoc' settings.wireless.ssid = dbus.ByteArray(connection_name) - settings.wireless.channel = 'bg' + settings.wireless.band = 'bg' settings.wireless.mode = 'adhoc' settings.ip4_config = IP4Config() diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py index bff5197..1876f97 100644 --- a/src/jarabe/model/network.py +++ b/src/jarabe/model/network.py @@ -103,7 +103,7 @@ class Wireless(object): self.ssid = None self.security = None self.mode = None - self.channel = None + self.band = None def get_dict(self): wireless = {'ssid': self.ssid} @@ -111,8 +111,8 @@ class Wireless(object): wireless['security'] = self.security if self.mode: wireless['mode'] = self.mode - if self.channel: - wireless['channel'] = self.channel + if self.band: + wireless['band'] = self.band return wireless class Connection(object): @@ -138,7 +138,6 @@ class IP4Config(object): def get_dict(self): ip4_config = {} - print self.method if self.method is not None: ip4_config['method'] = self.method return ip4_config @@ -264,12 +263,15 @@ class NMSettingsConnection(dbus.service.Object): config.set(identifier, 'type', self._settings.connection.type) config.set(identifier, 'ssid', self._settings.wireless.ssid) config.set(identifier, 'uuid', self._settings.connection.uuid) + config.set(identifier, 'mode', self._settings.wireless.mode) config.set(identifier, 'autoconnect', self._settings.connection.autoconnect) if self._settings.connection.timestamp is not None: config.set(identifier, 'timestamp', self._settings.connection.timestamp) - + if self._settings.wireless.band is not None: + config.set(identifier, 'band', + self._settings.wireless.band) if self._settings.wireless_security is not None: if self._settings.wireless_security.key_mgmt is not None: config.set(identifier, 'key-mgmt', @@ -286,6 +288,10 @@ class NMSettingsConnection(dbus.service.Object): if self._settings.wireless.security is not None: config.set(identifier, 'security', self._settings.wireless.security) + if self._settings.ip4_config is not None: + if self._settings.ip4_config.method is not None: + config.set(identifier, 'method', + self._settings.ip4_config.method) if self._secrets is not None: if self._settings.wireless_security.key_mgmt == 'none': config.set(identifier, 'key', self._secrets.wep_key) @@ -382,6 +388,8 @@ def load_connections(): settings.connection.uuid = uuid nmtype = config.get(section, 'type') settings.connection.type = nmtype + mode = config.get(section, 'mode') + settings.wireless.mode = mode autoconnect = bool(config.get(section, 'autoconnect')) settings.connection.autoconnect = autoconnect @@ -389,6 +397,15 @@ def load_connections(): timestamp = int(config.get(section, 'timestamp')) settings.connection.timestamp = timestamp + if config.has_option(section, 'band'): + band = config.get(section, 'band') + settings.wireless.band = band + + if config.has_option(section, 'method'): + method = config.get(section, 'method') + settings.ip4_config = IP4Config() + settings.ip4_config.method = method + secrets = None if config.has_option(section, 'key-mgmt'): secrets = Secrets() -- cgit v0.9.1