mirror of
https://github.com/gryf/wicd.git
synced 2026-01-10 07:44:19 +01:00
Strip spaces from the IPs in wicd-client.
This commit is contained in:
@@ -579,6 +579,7 @@ class appGui(object):
|
||||
|
||||
# Required entries.
|
||||
for lblent in req_entlist:
|
||||
lblent.set_text(lblent.get_text().strip())
|
||||
if not misc.IsValidIP(lblent.get_text()):
|
||||
error(self.window, language['invalid_address'].
|
||||
replace('$A', lblent.label.get_label()))
|
||||
@@ -586,6 +587,7 @@ class appGui(object):
|
||||
|
||||
# Optional entries, only check for validity if they're entered.
|
||||
for lblent in opt_entlist:
|
||||
lblent.set_text(lblent.get_text().strip())
|
||||
if lblent.get_text() and not misc.IsValidIP(lblent.get_text()):
|
||||
error(self.window, language['invalid_address'].
|
||||
replace('$A', lblent.label.get_label()))
|
||||
|
||||
@@ -118,6 +118,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
|
||||
def set_defaults(self, widget=None, event=None):
|
||||
""" Put some default values into entries to help the user out. """
|
||||
self.txt_ip.set_text(self.txt_ip.get_text().strip())
|
||||
ipAddress = self.txt_ip.get_text() # For easy typing :)
|
||||
netmask = self.txt_netmask
|
||||
gateway = self.txt_gateway
|
||||
@@ -208,6 +209,9 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
def save_settings(self):
|
||||
""" Save settings common to wired and wireless settings dialogs. """
|
||||
if self.chkbox_static_ip.get_active():
|
||||
# for i in [self.txt_ip,self.txt_netmask,self.txt_gateway ]:
|
||||
# i.set_text(i.get_text().strip())
|
||||
|
||||
self.set_net_prop("ip", noneToString(self.txt_ip.get_text()))
|
||||
self.set_net_prop("netmask", noneToString(self.txt_netmask.get_text()))
|
||||
self.set_net_prop("gateway", noneToString(self.txt_gateway.get_text()))
|
||||
@@ -220,6 +224,10 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
not self.chkbox_global_dns.get_active():
|
||||
self.set_net_prop('use_static_dns', True)
|
||||
self.set_net_prop('use_global_dns', False)
|
||||
# Strip whitespace from DNS entries
|
||||
#for i in [self.txt_domain, self.txt_search_dom,self.txt_dns_1,
|
||||
# self.txt_dns2,self.txt_dns3]:
|
||||
# i.set_text(i.get_text().strip())
|
||||
self.set_net_prop('dns_domain', noneToString(self.txt_domain.get_text()))
|
||||
self.set_net_prop("search_domain", noneToString(self.txt_search_dom.get_text()))
|
||||
self.set_net_prop("dns1", noneToString(self.txt_dns_1.get_text()))
|
||||
|
||||
@@ -183,6 +183,10 @@ class PreferencesDialog(object):
|
||||
def save_results(self):
|
||||
""" Pushes the selected settings to the daemon. """
|
||||
daemon.SetUseGlobalDNS(self.useGlobalDNSCheckbox.get_active())
|
||||
# Strip whitespace from DNS entries
|
||||
for i in [self.dns1Entry, self.dns2Entry, self.dns3Entry,
|
||||
self.dnsDomEntry, self.searchDomEntry]:
|
||||
i.set_text(i.get_text().strip())
|
||||
daemon.SetGlobalDNS(self.dns1Entry.get_text(), self.dns2Entry.get_text(),
|
||||
self.dns3Entry.get_text(), self.dnsDomEntry.get_text(),
|
||||
self.searchDomEntry.get_text())
|
||||
|
||||
Reference in New Issue
Block a user