Ticket #1673: 1673.patch

File 1673.patch, 2.0 KB (added by sascha_silbe, 11 years ago)

restore discard network history function (quozl)

  • extensions/cpsection/network/model.py

    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  
    1717
    1818import dbus
    1919from gettext import gettext as _
     20from jarabe.model import network
    2021import gconf
    2122
    2223_NM_SERVICE = 'org.freedesktop.NetworkManager'
    def clear_registration(): 
    116117def clear_networks():
    117118    """Clear saved passwords and network configurations.
    118119    """
    119     pass
     120    network.clear_networks()
    120121
    121122def get_publish_information():
    122123    client = gconf.client_get_default()
  • src/jarabe/model/network.py

    diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
    index 3a949da..82a7e7d 100644
    a b def load_wifi_connections(): 
    658658            add_connection(uuid, settings, secrets)
    659659
    660660
     661def 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
    661676def load_gsm_connection():
    662677    _BAUD_RATE = 115200
    663678