From: Sascha Silbe <sascha-pgp@silbe.org>
Subject: [PATCH] restore discard network history function (quozl) (SL#1673)
Original patch by James Cameron <quozl@laptop.org>.
- clears the current network configuration (_nm_settings),
- creates an empty connections.cfg file.
Tested on XO-1 with two access points (one using WPA2, one unsecured).
Remaining issues: Icon badges in Neighborhood not updated.
Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
---
extensions/cpsection/network/model.py | 3 ++-
src/jarabe/model/network.py | 15 +++++++++++++++
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/extensions/cpsection/network/model.py b/extensions/cpsection/network/model.py
index e1c3dab..38bcdf2 100644
a
|
b
|
|
17 | 17 | |
18 | 18 | import dbus |
19 | 19 | from gettext import gettext as _ |
| 20 | from jarabe.model import network |
20 | 21 | import gconf |
21 | 22 | |
22 | 23 | _NM_SERVICE = 'org.freedesktop.NetworkManager' |
… |
… |
def clear_registration(): |
116 | 117 | def clear_networks(): |
117 | 118 | """Clear saved passwords and network configurations. |
118 | 119 | """ |
119 | | pass |
| 120 | network.clear_networks() |
120 | 121 | |
121 | 122 | def get_publish_information(): |
122 | 123 | client = gconf.client_get_default() |
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 3a949da..82a7e7d 100644
a
|
b
|
def load_wifi_connections(): |
658 | 658 | add_connection(uuid, settings, secrets) |
659 | 659 | |
660 | 660 | |
| 661 | def clear_networks(): |
| 662 | global _nm_settings |
| 663 | _nm_settings = None |
| 664 | |
| 665 | profile_path = env.get_profile_path() |
| 666 | config_path = os.path.join(profile_path, 'nm', 'connections.cfg') |
| 667 | config = ConfigParser.ConfigParser() |
| 668 | |
| 669 | if not os.path.exists(os.path.dirname(config_path)): |
| 670 | os.makedirs(os.path.dirname(config_path), 0755) |
| 671 | f = open(config_path, 'w') |
| 672 | config.write(f) |
| 673 | f.close() |
| 674 | |
| 675 | |
661 | 676 | def load_gsm_connection(): |
662 | 677 | _BAUD_RATE = 115200 |
663 | 678 | |