1
0
mirror of https://github.com/gryf/wicd.git synced 2026-03-07 01:55:49 +01:00

merged latest 1.6

This commit is contained in:
Adam Blackburn
2009-08-09 18:07:22 -05:00
18 changed files with 302 additions and 155 deletions

View File

@@ -84,7 +84,7 @@ class WicdDaemon(dbus.service.Object):
self._debug_mode = bool(self.config.get("Settings", "debug_mode"))
self.wifi = networking.Wireless(debug=self._debug_mode)
self.wired = networking.Wired(debug=self._debug_mode)
self.wired_bus= WiredDaemon(bus_name, self, wired=self.wired)
self.wired_bus = WiredDaemon(bus_name, self, wired=self.wired)
self.wireless_bus = WirelessDaemon(bus_name, self, wifi=self.wifi)
self.forced_disconnect = False
self.need_profile_chooser = False
@@ -518,7 +518,7 @@ class WicdDaemon(dbus.service.Object):
# 1 = default profile
# 2 = show list
# 3 = last used profile
self.config.set("Settings","wired_connect_mode", int(method),
self.config.set("Settings", "wired_connect_mode", int(method),
write=True)
self.wired_connect_mode = int(method)
self.wired_bus.connect_mode = int(method)
@@ -856,7 +856,7 @@ class WicdDaemon(dbus.service.Object):
"""
b_wired = self.wired_bus
b_wifi = self.wireless_bus
app_conf= self.config
app_conf = self.config
# Load the backend.
be_def = 'external'
self.SetBackend(app_conf.get("Settings", "backend", default=be_def))
@@ -880,7 +880,7 @@ class WicdDaemon(dbus.service.Object):
dns1 = app_conf.get("Settings", "global_dns_1", default='None')
dns2 = app_conf.get("Settings", "global_dns_2", default='None')
dns3 = app_conf.get("Settings", "global_dns_3", default='None')
dns_dom =app_conf.get("Settings", "global_dns_dom", default='None')
dns_dom = app_conf.get("Settings", "global_dns_dom", default='None')
search_dom = app_conf.get("Settings", "global_search_dom", default='None')
self.SetGlobalDNS(dns1, dns2, dns3, dns_dom, search_dom)
self.SetAutoReconnect(app_conf.get("Settings", "auto_reconnect",
@@ -1055,14 +1055,14 @@ class WirelessDaemon(dbus.service.Object):
return value
@dbus.service.method('org.wicd.daemon.wireless')
def SetWirelessProperty(self, networkid, property, value):
def SetWirelessProperty(self, netid, prop, value):
""" Sets property to value in network specified. """
# We don't write script settings here.
if (property.strip()).endswith("script"):
if (prop.strip()).endswith("script"):
print "Setting script properties through the daemon is not" \
+ " permitted."
return False
self.LastScan[networkid][property] = misc.Noneify(value)
self.LastScan[netid][prop] = misc.to_unicode(misc.Noneify(value))
@dbus.service.method('org.wicd.daemon.wireless')
def DetectWirelessInterface(self):
@@ -1201,6 +1201,8 @@ class WirelessDaemon(dbus.service.Object):
if cur_network["hidden"]:
if cur_network.get("essid") in ["", "Hidden", "<hidden>", None]:
cur_network["essid"] = "<hidden>"
else:
cur_network['essid'] = self.config.get(section, 'essid')
return "100: Loaded Profile"
@dbus.service.method('org.wicd.daemon.wireless')
@@ -1373,7 +1375,7 @@ class WiredDaemon(dbus.service.Object):
print "Setting script properties through the daemon" \
+ " is not permitted."
return False
self.WiredNetwork[property] = misc.Noneify(value)
self.WiredNetwork[property] = misc.to_unicode(misc.Noneify(value))
return True
else:
print 'SetWiredProperty: WiredNetwork does not exist'
@@ -1448,7 +1450,7 @@ class WiredDaemon(dbus.service.Object):
if self.config.has_section(profilename):
return False
for option in ["ip", "broadcast", "netmask","gateway", "search_domain",
for option in ["ip", "broadcast", "netmask", "gateway", "search_domain",
"dns_domain", "dns1", "dns2", "dns3", "beforescript",
"afterscript", "predisconnectscript",
"postdisconnectscript"]:
@@ -1506,8 +1508,10 @@ class WiredDaemon(dbus.service.Object):
if not self.config.has_option(prof, script):
self.config.set(prof, script, None)
if profilename == "":
profilename = profilename.strip()
if not profilename:
self.config.write()
print "Warning: Bad wired profile name given, ignoring."
return "500: Bad Profile name"
if self.debug_mode:
print "saving wired profile %s" % profilename