Hi, <br><br>I press "discard history" and shell.logs shows: <br><br><div style="margin-left: 40px;">/usr/lib/python2.6/site-packages/dbus/connection.py:242: DeprecationWarning: object.__init__() takes no parameters<br>
  super(Connection, self).__init__(*args, **kwargs)<br>Traceback (most recent call last):<br>  File "/usr/share/sugar/extensions/cpsection/network/view.py", line 254, in __network_configuration_reset_cb<br>    self._model.clear_networks()<br>
  File "/usr/share/sugar/extensions/cpsection/network/model.py", line 120, in clear_networks<br>    network.clear_wifi_connections()<br>  File "/usr/lib/python2.6/site-packages/jarabe/model/network.py", line 934, in clear_wifi_connections<br>
    _nm_settings.clear_wifi_connections()<br>  File "/usr/lib/python2.6/site-packages/jarabe/model/network.py", line 506, in clear_wifi_connections<br><b>    if conn.type == NM_CONNECTION_TYPE_802_11_WIRELESS:</b><br>
<b>AttributeError: 'NMSettingsConnection' object has no attribute 'type'</b><br></div><br>If I switch "<b>conn.type</b>" to "<b>conn._settings.connection</b>" runs ok.<br><br><br><div class="gmail_quote">
2010/5/25 James Cameron <span dir="ltr"><<a href="mailto:quozl@laptop.org">quozl@laptop.org</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
User interface changes:<br>
<br>
- enable the disconnect button on the access point menu in the<br>
  neighbourhood view, (rather than the button doing nothing),<br>
<br>
- fix the disconnect button on the wireless device icon in the frame<br>
  so that the disconnection remains effective, (rather than<br>
  disconnecting and then reconnecting automatically),<br>
<br>
- enable the discard network history button in the network control<br>
  panel, which also now forces a disconnect, and will be insensitive<br>
  if there are no networks to be discarded, (rather than the button<br>
  doing nothing),<br>
<br>
- enforce consistency between the neighbourhood view, the frame, and<br>
  the control panel, with respect to how the access point is shown.<br>
<br>
References:<br>
<br>
    <a href="http://dev.laptop.org/ticket/9977" target="_blank">http://dev.laptop.org/ticket/9977</a> (fixes a workaround)<br>
    <a href="http://bugs.sugarlabs.org/ticket/1673" target="_blank">http://bugs.sugarlabs.org/ticket/1673</a><br>
    <a href="http://bugs.sugarlabs.org/ticket/1802" target="_blank">http://bugs.sugarlabs.org/ticket/1802</a><br>
    <a href="http://bugs.sugarlabs.org/ticket/1737" target="_blank">http://bugs.sugarlabs.org/ticket/1737</a><br>
    <a href="http://bugs.sugarlabs.org/ticket/1736" target="_blank">http://bugs.sugarlabs.org/ticket/1736</a><br>
    <a href="http://bugs.sugarlabs.org/ticket/1608" target="_blank">http://bugs.sugarlabs.org/ticket/1608</a><br>
    <a href="http://dev.laptop.org/ticket/9788" target="_blank">http://dev.laptop.org/ticket/9788</a><br>
---<br>
 extensions/cpsection/network/model.py |   12 ++++--<br>
 extensions/cpsection/network/view.py  |    8 ++++-<br>
 extensions/deviceicon/network.py      |   37 ++++++++++---------<br>
 src/jarabe/desktop/meshbox.py         |   61 +++++++++++++++++++++----------<br>
 src/jarabe/model/network.py           |   62 ++++++++++++++++++++++++++------<br>
 5 files changed, 125 insertions(+), 55 deletions(-)<br>
<br>
diff --git a/extensions/cpsection/network/model.py b/extensions/cpsection/network/model.py<br>
index e1c3dab..2bc5e3a 100644<br>
--- a/extensions/cpsection/network/model.py<br>
+++ b/extensions/cpsection/network/model.py<br>
@@ -17,6 +17,7 @@<br>
<br>
 import dbus<br>
 from gettext import gettext as _<br>
+from jarabe.model import network<br>
 import gconf<br>
<br>
 _NM_SERVICE = 'org.freedesktop.NetworkManager'<br>
@@ -68,7 +69,7 @@ def get_radio():<br>
     try:<br>
         bus = dbus.SystemBus()<br>
         obj = bus.get_object(_NM_SERVICE, _NM_PATH)<br>
-        nm_props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+        nm_props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
     except dbus.DBusException:<br>
         raise ReadError('%s service not available' % _NM_SERVICE)<br>
<br>
@@ -89,7 +90,7 @@ def set_radio(state):<br>
         try:<br>
             bus = dbus.SystemBus()<br>
             obj = bus.get_object(_NM_SERVICE, _NM_PATH)<br>
-            nm_props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+            nm_props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
         except dbus.DBusException:<br>
             raise ReadError('%s service not available' % _NM_SERVICE)<br>
         nm_props.Set(_NM_IFACE, 'WirelessEnabled', True)<br>
@@ -97,7 +98,7 @@ def set_radio(state):<br>
         try:<br>
             bus = dbus.SystemBus()<br>
             obj = bus.get_object(_NM_SERVICE, _NM_PATH)<br>
-            nm_props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+            nm_props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
         except dbus.DBusException:<br>
             raise ReadError('%s service not available' % _NM_SERVICE)<br>
         nm_props.Set(_NM_IFACE, 'WirelessEnabled', False)<br>
@@ -116,7 +117,10 @@ def clear_registration():<br>
 def clear_networks():<br>
     """Clear saved passwords and network configurations.<br>
     """<br>
-    pass<br>
+    network.clear_wifi_connections()<br>
+<br>
+def count_networks():<br>
+    return network.count_wifi_connections()<br>
<br>
 def get_publish_information():<br>
     client = gconf.client_get_default()<br>
diff --git a/extensions/cpsection/network/view.py b/extensions/cpsection/network/view.py<br>
index 588daeb..b0f1336 100644<br>
--- a/extensions/cpsection/network/view.py<br>
+++ b/extensions/cpsection/network/view.py<br>
@@ -104,6 +104,8 @@ class Network(SectionView):<br>
         self._clear_history_button = gtk.Button()<br>
         self._clear_history_button.set_label(_('Discard network history'))<br>
         box_clear_history.pack_start(self._clear_history_button, expand=False)<br>
+        if self._model.count_networks() == 0:<br>
+            self._clear_history_button.set_sensitive(False)<br>
         self._clear_history_button.show()<br>
         box_wireless.pack_start(box_clear_history, expand=False)<br>
         box_clear_history.show()<br>
@@ -217,7 +219,9 @@ class Network(SectionView):<br>
             self._radio_alert.props.msg = detail<br>
             self._radio_valid = False<br>
         else:<br>
-            self._radio_valid = True<br>
+            self._radio_valid = True<br>
+            if self._model.count_networks() != 0:<br>
+                self._clear_history_button.set_sensitive(True)<br>
<br>
         self._validate()<br>
         return False<br>
@@ -248,3 +252,5 @@ class Network(SectionView):<br>
<br>
     def __network_configuration_reset_cb(self, widget):<br>
         self._model.clear_networks()<br>
+        if self._model.count_networks() == 0:<br>
+            self._clear_history_button.set_sensitive(False)<br>
diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py<br>
index 94a4293..a828497 100644<br>
--- a/extensions/deviceicon/network.py<br>
+++ b/extensions/deviceicon/network.py<br>
@@ -352,8 +352,7 @@ class WirelessDeviceView(ToolButton):<br>
         self.set_palette(self._palette)<br>
         self._palette.set_group_id('frame')<br>
<br>
-        self._device_props = dbus.Interface(self._device,<br>
-                                            'org.freedesktop.DBus.Properties')<br>
+        self._device_props = dbus.Interface(self._device, dbus.PROPERTIES_IFACE)<br>
         self._device_props.GetAll(_NM_DEVICE_IFACE, byte_arrays=True,<br>
                               reply_handler=self.__get_device_props_reply_cb,<br>
                               error_handler=self.__get_device_props_error_cb)<br>
@@ -394,7 +393,7 @@ class WirelessDeviceView(ToolButton):<br>
                 return<br>
             self._active_ap_op = active_ap_op<br>
             active_ap = self._bus.get_object(_NM_SERVICE, active_ap_op)<br>
-            props = dbus.Interface(active_ap, 'org.freedesktop.DBus.Properties')<br>
+            props = dbus.Interface(active_ap, dbus.PROPERTIES_IFACE)<br>
<br>
             props.GetAll(_NM_ACCESSPOINT_IFACE, byte_arrays=True,<br>
                          reply_handler=self.__get_all_ap_props_reply_cb,<br>
@@ -508,17 +507,21 @@ class WirelessDeviceView(ToolButton):<br>
         self._icon.props.base_color = self._color<br>
<br>
     def __deactivate_connection_cb(self, palette, data=None):<br>
+        connection = network.find_connection_by_ssid(self._name)<br>
+        if connection:<br>
+            if self._mode == network.NM_802_11_MODE_INFRA:<br>
+                connection.set_disconnected()<br>
+<br>
         if self._active_ap_op is not None:<br>
             obj = self._bus.get_object(_NM_SERVICE, _NM_PATH)<br>
             netmgr = dbus.Interface(obj, _NM_IFACE)<br>
-            netmgr_props = dbus.Interface(<br>
-                netmgr, 'org.freedesktop.DBus.Properties')<br>
+            netmgr_props = dbus.Interface(netmgr, dbus.PROPERTIES_IFACE)<br>
             active_connections_o = netmgr_props.Get(_NM_IFACE,<br>
                                                     'ActiveConnections')<br>
<br>
             for conn_o in active_connections_o:<br>
                 obj = self._bus.get_object(_NM_IFACE, conn_o)<br>
-                props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+                props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
                 ap_op = props.Get(_NM_ACTIVE_CONN_IFACE, 'SpecificObject')<br>
                 if ap_op == self._active_ap_op:<br>
                     netmgr.DeactivateConnection(conn_o)<br>
@@ -608,8 +611,7 @@ class OlpcMeshDeviceView(ToolButton):<br>
         self.set_palette(self._palette)<br>
         self._palette.set_group_id('frame')<br>
<br>
-        self._device_props = dbus.Interface(self._device,<br>
-                                            'org.freedesktop.DBus.Properties')<br>
+        self._device_props = dbus.Interface(self._device, dbus.PROPERTIES_IFACE)<br>
         self._device_props.GetAll(_NM_DEVICE_IFACE, byte_arrays=True,<br>
                               reply_handler=self.__get_device_props_reply_cb,<br>
                               error_handler=self.__get_device_props_error_cb)<br>
@@ -681,19 +683,19 @@ class OlpcMeshDeviceView(ToolButton):<br>
     def __deactivate_connection(self, palette, data=None):<br>
         obj = self._bus.get_object(_NM_SERVICE, _NM_PATH)<br>
         netmgr = dbus.Interface(obj, _NM_IFACE)<br>
-        netmgr_props = dbus.Interface(netmgr, 'org.freedesktop.DBus.Properties')<br>
+        netmgr_props = dbus.Interface(netmgr, dbus.PROPERTIES_IFACE)<br>
         active_connections_o = netmgr_props.Get(_NM_IFACE,<br>
                                                 'ActiveConnections')<br>
<br>
         for conn_o in active_connections_o:<br>
             # The connection path for a mesh connection is the device itself.<br>
             obj = self._bus.get_object(_NM_IFACE, conn_o)<br>
-            props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+            props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
             ap_op = props.Get(_NM_ACTIVE_CONN_IFACE, 'SpecificObject')<br>
<br>
             try:<br>
                 obj = self._bus.get_object(_NM_IFACE, ap_op)<br>
-                props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+                props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
                 type = props.Get(_NM_DEVICE_IFACE, 'DeviceType')<br>
                 if type == network.DEVICE_TYPE_802_11_OLPC_MESH:<br>
                     netmgr.DeactivateConnection(conn_o)<br>
@@ -756,7 +758,7 @@ class GsmDeviceView(TrayIcon):<br>
<br>
         self._palette = palette<br>
<br>
-        props = dbus.Interface(self._device, 'org.freedesktop.DBus.Properties')<br>
+        props = dbus.Interface(self._device, dbus.PROPERTIES_IFACE)<br>
         props.GetAll(_NM_DEVICE_IFACE, byte_arrays=True,<br>
                      reply_handler=self.__current_state_check_cb,<br>
                      error_handler=self.__current_state_check_error_cb)<br>
@@ -785,12 +787,12 @@ class GsmDeviceView(TrayIcon):<br>
     def __gsm_disconnect_cb(self, palette, data=None):<br>
         obj = self._bus.get_object(_NM_SERVICE, _NM_PATH)<br>
         netmgr = dbus.Interface(obj, _NM_IFACE)<br>
-        netmgr_props = dbus.Interface(netmgr, 'org.freedesktop.DBus.Properties')<br>
+        netmgr_props = dbus.Interface(netmgr, dbus.PROPERTIES_IFACE)<br>
         active_connections_o = netmgr_props.Get(_NM_IFACE, 'ActiveConnections')<br>
<br>
         for conn_o in active_connections_o:<br>
             obj = self._bus.get_object(_NM_IFACE, conn_o)<br>
-            props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+            props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
             devices = props.Get(_NM_ACTIVE_CONN_IFACE, 'Devices')<br>
             if self._device.object_path in devices:<br>
                 netmgr.DeactivateConnection(<br>
@@ -910,7 +912,7 @@ class WiredDeviceObserver(object):<br>
         self._device_view = None<br>
         self._tray = tray<br>
<br>
-        props = dbus.Interface(self._device, 'org.freedesktop.DBus.Properties')<br>
+        props = dbus.Interface(self._device, dbus.PROPERTIES_IFACE)<br>
         props.GetAll(_NM_DEVICE_IFACE, byte_arrays=True,<br>
                      reply_handler=self.__get_device_props_reply_cb,<br>
                      error_handler=self.__get_device_props_error_cb)<br>
@@ -938,8 +940,7 @@ class WiredDeviceObserver(object):<br>
<br>
     def _update_state(self, state):<br>
         if state == network.DEVICE_STATE_ACTIVATED:<br>
-            props = dbus.Interface(self._device,<br>
-                                   'org.freedesktop.DBus.Properties')<br>
+            props = dbus.Interface(self._device, dbus.PROPERTIES_IFACE)<br>
             address = props.Get(_NM_DEVICE_IFACE, 'Ip4Address')<br>
             speed = props.Get(_NM_WIRED_IFACE, 'Speed')<br>
             self._device_view = WiredDeviceView(speed, address)<br>
@@ -997,7 +998,7 @@ class NetworkManagerObserver(object):<br>
<br>
     def _check_device(self, device_op):<br>
         nm_device = self._bus.get_object(_NM_SERVICE, device_op)<br>
-        props = dbus.Interface(nm_device, 'org.freedesktop.DBus.Properties')<br>
+        props = dbus.Interface(nm_device, dbus.PROPERTIES_IFACE)<br>
<br>
         device_type = props.Get(_NM_DEVICE_IFACE, 'DeviceType')<br>
         if device_type == network.DEVICE_TYPE_802_3_ETHERNET:<br>
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py<br>
index a04922b..280adb9 100644<br>
--- a/src/jarabe/desktop/meshbox.py<br>
+++ b/src/jarabe/desktop/meshbox.py<br>
@@ -86,7 +86,6 @@ class WirelessNetworkView(CanvasPulsingIcon):<br>
         self._rsn_flags = initial_ap.rsn_flags<br>
         self._device_caps = 0<br>
         self._device_state = None<br>
-        self._connection = None<br>
         self._color = None<br>
<br>
         if self._mode == network.NM_802_11_MODE_ADHOC \<br>
@@ -115,18 +114,9 @@ class WirelessNetworkView(CanvasPulsingIcon):<br>
         self.set_palette(self._palette)<br>
         self._palette_icon.props.xo_color = self._color<br>
<br>
-        if network.find_connection_by_ssid(self._name) is not None:<br>
-            self.props.badge_name = "emblem-favorite"<br>
-            self._palette_icon.props.badge_name = "emblem-favorite"<br>
-        elif initial_ap.flags == network.NM_802_11_AP_FLAGS_PRIVACY:<br>
-            self.props.badge_name = "emblem-locked"<br>
-            self._palette_icon.props.badge_name = "emblem-locked"<br>
-        else:<br>
-            self.props.badge_name = None<br>
-            self._palette_icon.props.badge_name = None<br>
+        self._update_badge()<br>
<br>
-        interface_props = dbus.Interface(self._device,<br>
-                                         'org.freedesktop.DBus.Properties')<br>
+        interface_props = dbus.Interface(self._device, dbus.PROPERTIES_IFACE)<br>
         interface_props.Get(_NM_DEVICE_IFACE, 'State',<br>
                             reply_handler=self.__get_device_state_reply_cb,<br>
                             error_handler=self.__get_device_state_error_cb)<br>
@@ -174,6 +164,7 @@ class WirelessNetworkView(CanvasPulsingIcon):<br>
     def __device_state_changed_cb(self, new_state, old_state, reason):<br>
         self._device_state = new_state<br>
         self._update_state()<br>
+        self._update_badge()<br>
<br>
     def __update_active_ap(self, ap_path):<br>
         if ap_path in self._access_points:<br>
@@ -214,6 +205,7 @@ class WirelessNetworkView(CanvasPulsingIcon):<br>
     def _update(self):<br>
         self._update_state()<br>
         self._update_color()<br>
+        self._update_badge()<br>
<br>
     def _update_state(self):<br>
         if self._active_ap is not None:<br>
@@ -266,8 +258,40 @@ class WirelessNetworkView(CanvasPulsingIcon):<br>
         else:<br>
             self.props.base_color = self._color<br>
<br>
+    def _update_badge(self):<br>
+        if network.find_connection_by_ssid(self._name) is not None:<br>
+            self.props.badge_name = "emblem-favorite"<br>
+            self._palette_icon.props.badge_name = "emblem-favorite"<br>
+        elif self._flags == network.NM_802_11_AP_FLAGS_PRIVACY:<br>
+            self.props.badge_name = "emblem-locked"<br>
+            self._palette_icon.props.badge_name = "emblem-locked"<br>
+        else:<br>
+            self.props.badge_name = None<br>
+            self._palette_icon.props.badge_name = None<br>
+<br>
     def _disconnect_activate_cb(self, item):<br>
-        pass<br>
+        connection = network.find_connection_by_ssid(self._name)<br>
+        if connection:<br>
+            if self._mode == network.NM_802_11_MODE_INFRA:<br>
+                connection.set_disconnected()<br>
+<br>
+        obj = self._bus.get_object(_NM_SERVICE, _NM_PATH)<br>
+        netmgr = dbus.Interface(obj, _NM_IFACE)<br>
+<br>
+        netmgr_props = dbus.Interface(netmgr, dbus.PROPERTIES_IFACE)<br>
+        active_connections_o = netmgr_props.Get(_NM_IFACE, 'ActiveConnections')<br>
+<br>
+        for conn_o in active_connections_o:<br>
+            obj = self._bus.get_object(_NM_IFACE, conn_o)<br>
+            props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
+            state = props.Get(_NM_ACTIVE_CONN_IFACE, 'State')<br>
+            if state == network.NM_ACTIVE_CONNECTION_STATE_ACTIVATED:<br>
+                ap_o = props.Get(_NM_ACTIVE_CONN_IFACE, 'SpecificObject')<br>
+                if ap_o != '/' and self.find_ap(ap_o) is not None:<br>
+                    netmgr.DeactivateConnection(conn_o)<br>
+                else:<br>
+                    logging.error('Could not determine AP for'<br>
+                                  ' specific object %s' % conn_o)<br>
<br>
     def _add_ciphers_from_flags(self, flags, pairwise):<br>
         ciphers = []<br>
@@ -456,14 +480,12 @@ class OlpcMeshView(CanvasPulsingIcon):<br>
         self._greyed_out = False<br>
         self._name = ''<br>
         self._device_state = None<br>
-        self._connection = None<br>
         self._active = False<br>
         device = mesh_mgr.mesh_device<br>
<br>
         self.connect('button-release-event', self.__button_release_event_cb)<br>
<br>
-        interface_props = dbus.Interface(device,<br>
-                                         'org.freedesktop.DBus.Properties')<br>
+        interface_props = dbus.Interface(device, dbus.PROPERTIES_IFACE)<br>
         interface_props.Get(_NM_DEVICE_IFACE, 'State',<br>
                             reply_handler=self.__get_device_state_reply_cb,<br>
                             error_handler=self.__get_device_state_error_cb)<br>
@@ -849,13 +871,12 @@ class NetworkManagerObserver(object):<br>
         # FIXME It would be better to do all of this async, but I cannot think<br>
         # of a good way to. NM could really use some love here.<br>
<br>
-        netmgr_props = dbus.Interface(<br>
-                            self._netmgr, 'org.freedesktop.DBus.Properties')<br>
+        netmgr_props = dbus.Interface(self._netmgr, dbus.PROPERTIES_IFACE)<br>
         active_connections_o = netmgr_props.Get(_NM_IFACE, 'ActiveConnections')<br>
<br>
         for conn_o in active_connections_o:<br>
             obj = self._bus.get_object(_NM_IFACE, conn_o)<br>
-            props = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')<br>
+            props = dbus.Interface(obj, dbus.PROPERTIES_IFACE)<br>
             state = props.Get(_NM_ACTIVE_CONN_IFACE, 'State')<br>
             if state == network.NM_ACTIVE_CONNECTION_STATE_ACTIVATING:<br>
                 ap_o = props.Get(_NM_ACTIVE_CONN_IFACE, 'SpecificObject')<br>
@@ -879,7 +900,7 @@ class NetworkManagerObserver(object):<br>
<br>
     def _check_device(self, device_o):<br>
         device = self._bus.get_object(_NM_SERVICE, device_o)<br>
-        props = dbus.Interface(device, 'org.freedesktop.DBus.Properties')<br>
+        props = dbus.Interface(device, dbus.PROPERTIES_IFACE)<br>
<br>
         device_type = props.Get(_NM_DEVICE_IFACE, 'DeviceType')<br>
         if device_type == network.DEVICE_TYPE_802_11_WIRELESS:<br>
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py<br>
index 3a949da..33088c4 100644<br>
--- a/src/jarabe/model/network.py<br>
+++ b/src/jarabe/model/network.py<br>
@@ -330,6 +330,13 @@ class NMSettings(dbus.service.Object):<br>
         self.secrets_request.send(self, connection=sender,<br>
                                   response=kwargs['response'])<br>
<br>
+    def clear_wifi_connections(self):<br>
+        for uuid in self.connections.keys():<br>
+            conn = self.connections[uuid]<br>
+            if conn.type == NM_CONNECTION_TYPE_802_11_WIRELESS:<br>
+                conn.Removed()<br>
+                self.connections.pop(uuid)<br>
+<br>
 class SecretsResponse(object):<br>
     ''' Intermediate object to report the secrets from the dialog<br>
     back to the connection object and which will inform NM<br>
@@ -358,6 +365,16 @@ class NMSettingsConnection(dbus.service.Object):<br>
         self._settings = settings<br>
         self._secrets = secrets<br>
<br>
+    @dbus.service.signal(dbus_interface=NM_CONNECTION_IFACE,<br>
+                         signature='')<br>
+    def Removed(self):<br>
+        pass<br>
+<br>
+    @dbus.service.signal(dbus_interface=NM_CONNECTION_IFACE,<br>
+                         signature='a{sa{sv}}')<br>
+    def Updated(self, settings):<br>
+        pass<br>
+<br>
     def set_connected(self):<br>
         if self._settings.connection.type == NM_CONNECTION_TYPE_GSM:<br>
             self._settings.connection.timestamp = int(time.time())<br>
@@ -366,8 +383,17 @@ class NMSettingsConnection(dbus.service.Object):<br>
                 self._settings.connection.autoconnect = True<br>
                 self._settings.connection.timestamp = int(time.time())<br>
                 if self._settings.connection.type == NM_CONNECTION_TYPE_802_11_WIRELESS:<br>
+                    self.Updated(self._settings.get_dict())<br>
                     self.save()<br>
<br>
+    def set_disconnected(self):<br>
+        if self._settings.connection.type != NM_CONNECTION_TYPE_GSM and \<br>
+               self._settings.connection.autoconnect:<br>
+            self._settings.connection.autoconnect = False<br>
+            self._settings.connection.timestamp = None<br>
+            self.Updated(self._settings.get_dict())<br>
+            self.save()<br>
+<br>
     def set_secrets(self, secrets):<br>
         self._secrets = secrets<br>
         if self._settings.connection.type == NM_CONNECTION_TYPE_802_11_WIRELESS:<br>
@@ -377,8 +403,7 @@ class NMSettingsConnection(dbus.service.Object):<br>
         return self._settings<br>
<br>
     def save(self):<br>
-        profile_path = env.get_profile_path()<br>
-        config_path = os.path.join(profile_path, 'nm', 'connections.cfg')<br>
+        config_path = _get_wifi_connections_path()<br>
<br>
         config = ConfigParser.ConfigParser()<br>
         try:<br>
@@ -477,8 +502,7 @@ class AccessPoint(gobject.GObject):<br>
         self.mode = 0<br>
<br>
     def initialize(self):<br>
-        model_props = dbus.Interface(self.model,<br>
-            'org.freedesktop.DBus.Properties')<br>
+        model_props = dbus.Interface(self.model, dbus.PROPERTIES_IFACE)<br>
         model_props.GetAll(NM_ACCESSPOINT_IFACE, byte_arrays=True,<br>
                            reply_handler=self._ap_properties_changed_cb,<br>
                            error_handler=self._get_all_props_error_cb)<br>
@@ -590,19 +614,23 @@ def add_connection(uuid, settings, secrets=None):<br>
     _nm_settings.add_connection(uuid, conn)<br>
     return conn<br>
<br>
-def load_wifi_connections():<br>
+def _get_wifi_connections_path():<br>
     profile_path = env.get_profile_path()<br>
-    config_path = os.path.join(profile_path, 'nm', 'connections.cfg')<br>
+    return os.path.join(profile_path, 'nm', 'connections.cfg')<br>
<br>
-    config = ConfigParser.ConfigParser()<br>
+def _create_wifi_connections(config_path):<br>
+    if not os.path.exists(os.path.dirname(config_path)):<br>
+        os.makedirs(os.path.dirname(config_path), 0755)<br>
+    f = open(config_path, 'w')<br>
+    f.close()<br>
+<br>
+def load_wifi_connections():<br>
+    config_path = _get_wifi_connections_path()<br>
<br>
     if not os.path.exists(config_path):<br>
-        if not os.path.exists(os.path.dirname(config_path)):<br>
-            os.makedirs(os.path.dirname(config_path), 0755)<br>
-        f = open(config_path, 'w')<br>
-        config.write(f)<br>
-        f.close()<br>
+        _create_wifi_connections(config_path)<br>
<br>
+    config = ConfigParser.ConfigParser()<br>
     try:<br>
         if not config.read(config_path):<br>
             logging.error('Error reading the nm config file')<br>
@@ -708,3 +736,13 @@ def find_gsm_connection():<br>
<br>
     logging.debug('There is no gsm connection in the NMSettings.')<br>
     return None<br>
+<br>
+def count_wifi_connections():<br>
+    return len(get_settings().connections)<br>
+<br>
+def clear_wifi_connections():<br>
+    if _nm_settings is not None:<br>
+        _nm_settings.clear_wifi_connections()<br>
+<br>
+    config_path = _get_wifi_connections_path()<br>
+    _create_wifi_connections(config_path)<br>
<font color="#888888">--<br>
1.7.1<br>
<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>    Esteban Arias<br>    Investigación y Desarrollo - Plan Ceibal<br>    Avda. Italia 6201<br>    Montevideo - Uruguay.<br>    Tel.: 2601.57.73 Interno 2228<br>    E-mail : <a href="mailto:earias@plan.ceibal.edu.uy" target="_blank">earias@plan.ceibal.edu.uy</a><br>
<br>