From e23af9b41388b14d38aefd95d2919a35208aff8d Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Mon, 2 Feb 2009 23:47:54 -0500 Subject: [PATCH] Make GetWirelessInterfaces() return a list instead of the first interface. Also make the networking.py layer pull the first entry from the list. Some documentation cleanup. --- wicd/backends/be-external.py | 2 -- wicd/backends/be-ioctl.py | 2 -- wicd/networking.py | 6 +++++- wicd/wnettools.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wicd/backends/be-external.py b/wicd/backends/be-external.py index d6b891c..b96880c 100644 --- a/wicd/backends/be-external.py +++ b/wicd/backends/be-external.py @@ -6,8 +6,6 @@ This module implements functions to control and obtain information from network interfaces. -def SetDNS() -- Set the DNS servers of the system. -def GetWirelessInterfaces() -- Get the wireless interfaces available. class Interface() -- Control a network interface. class WiredInterface() -- Control a wired network interface. class WirelessInterface() -- Control a wireless network interface. diff --git a/wicd/backends/be-ioctl.py b/wicd/backends/be-ioctl.py index b930688..b43f6d6 100644 --- a/wicd/backends/be-ioctl.py +++ b/wicd/backends/be-ioctl.py @@ -6,8 +6,6 @@ This module implements functions to control and obtain information from network interfaces. It utilizes ioctl calls and python modules to obtain this information whenever possible. -def SetDNS() -- Set the DNS servers of the system. -def GetWirelessInterfaces() -- Get the wireless interfaces available. class Interface() -- Control a network interface. class WiredInterface() -- Control a wired network interface. class WirelessInterface() -- Control a wireless network interface. diff --git a/wicd/networking.py b/wicd/networking.py index cc6a118..5ee9d05 100644 --- a/wicd/networking.py +++ b/wicd/networking.py @@ -668,7 +668,11 @@ class Wireless(Controller): The first available wireless interface. """ - return BACKEND.GetWirelessInterfaces() + ifaces = BACKEND.GetWirelessInterfaces() + if ifaces: + return ifaces[0] + else: + return None def GetKillSwitchStatus(self): """ Get the current status of the Killswitch. diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 7d6dbe4..b4bb5f6 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -127,7 +127,7 @@ def GetWirelessInterfaces(): ifnames = [iface for iface in os.listdir(dev_dir) if os.path.isdir(dev_dir + iface) and 'wireless' in os.listdir(dev_dir + iface)] - return bool(ifnames) and ifnames[0] or None + return ifnames def GetWiredInterfaces(): """ Returns a list of wired interfaces on the system. """