1
0
mirror of https://github.com/gryf/wicd.git synced 2026-02-25 19:55:58 +01:00

New feature: dialogs to "forget" saved networks

This commit is contained in:
David Paleino
2012-05-06 17:16:15 +02:00
parent 1f9f5596f9
commit 11e8a96677
7 changed files with 188 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ import getopt
import signal
import atexit
from subprocess import Popen
from operator import itemgetter
# DBUS
import gobject
@@ -1306,6 +1307,27 @@ class WirelessDaemon(dbus.service.Object):
''' Returns a list of wireless interfaces on the system. '''
return wnettools.GetWirelessInterfaces()
@dbus.service.method('org.wicd.daemon.wireless')
def GetSavedWirelessNetworks(self):
''' Returns a list of saved wireless networks. '''
ret = []
for section in self.config.sections():
if section.startswith('essid:'):
ret.append((section.replace('essid:', ''), 'None'))
else:
essid = self.config.get(section, 'essid')
ret.append((essid, section))
return sorted(ret, key=itemgetter(0))
@dbus.service.method('org.wicd.daemon.wireless')
def DeleteWirelessNetwork(self, section):
""" Deletes a wireless network section. """
section = misc.to_unicode(section)
print "Deleting wireless settings for %s (%s)" % \
(self.config.get(section, 'essid'), str(section))
self.config.remove_section(section)
self.config.write()
@dbus.service.signal(dbus_interface='org.wicd.daemon.wireless', signature='')
def SendStartScanSignal(self):
""" Emits a signal announcing a scan has started. """