Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorJames Cameron <quozl@laptop.org>2011-01-21 18:10:34 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2011-02-05 15:25:03 (GMT)
commitcbba08f28bc461f06da56d27bca058900c090139 (patch)
tree03e5a00abeb3be09845833d5e0da9b5191489511 /extensions
parent58af70519711f398c407109cff78066ae54f33ce (diff)
implement discarding network history (SL#1673)
User interface changes: - enable the discard network history button in the network control panel, which also now forces a disconnect, and will be insensitive if there are no networks to be discarded, (rather than the button doing nothing), [split out from larger "fix network disconnect and discard history" patch; replaced count_*() with have_*(); added FIXME] Signed-off-by: Sascha Silbe <silbe@activitycentral.com> Reviewed-by: Sascha Silbe <silbe@activitycentral.com>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/cpsection/network/model.py9
-rw-r--r--extensions/cpsection/network/view.py8
2 files changed, 16 insertions, 1 deletions
diff --git a/extensions/cpsection/network/model.py b/extensions/cpsection/network/model.py
index 8426b7f..916ce8c 100644
--- a/extensions/cpsection/network/model.py
+++ b/extensions/cpsection/network/model.py
@@ -19,6 +19,9 @@ import dbus
from gettext import gettext as _
import gconf
+from jarabe.model import network
+
+
_NM_SERVICE = 'org.freedesktop.NetworkManager'
_NM_PATH = '/org/freedesktop/NetworkManager'
_NM_IFACE = 'org.freedesktop.NetworkManager'
@@ -109,7 +112,11 @@ def clear_registration():
def clear_networks():
"""Clear saved passwords and network configurations.
"""
- pass
+ network.clear_wifi_connections()
+
+
+def have_networks():
+ return network.have_wifi_connections()
def get_publish_information():
diff --git a/extensions/cpsection/network/view.py b/extensions/cpsection/network/view.py
index 9ecc8fd..381dcb6 100644
--- a/extensions/cpsection/network/view.py
+++ b/extensions/cpsection/network/view.py
@@ -106,6 +106,8 @@ class Network(SectionView):
self._clear_history_button = gtk.Button()
self._clear_history_button.set_label(_('Discard network history'))
box_clear_history.pack_start(self._clear_history_button, expand=False)
+ if not self._model.have_networks():
+ self._clear_history_button.set_sensitive(False)
self._clear_history_button.show()
box_wireless.pack_start(box_clear_history, expand=False)
box_clear_history.show()
@@ -220,6 +222,8 @@ class Network(SectionView):
self._radio_valid = False
else:
self._radio_valid = True
+ if self._model.have_networks():
+ self._clear_history_button.set_sensitive(True)
self._validate()
return False
@@ -250,4 +254,8 @@ class Network(SectionView):
return False
def __network_configuration_reset_cb(self, widget):
+ # FIXME: takes effect immediately, not after CP is closed with
+ # confirmation button
self._model.clear_networks()
+ if not self._model.have_networks():
+ self._clear_history_button.set_sensitive(False)