1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-24 15:12:31 +01:00

Merged with r260 of the mainline 1.6 branch.

This commit is contained in:
Andrew Psaltis
2009-01-25 23:07:47 -05:00
5 changed files with 583 additions and 583 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -536,10 +536,13 @@ def get_language_list_gui():
language['bad_pass'] = _('Connection Failed: Could not authenticate (bad password?)')
language['done'] = _('Done connecting...')
language['scanning'] = _('Scanning')
language['scanning_stand_by'] = _('Scanning networks... stand by...')
language['cannot_start_daemon'] = _("Unable to connect to wicd daemon DBus interface. " + \
"This typically means there was a problem starting the daemon. " + \
"Check the wicd log for more info")
language['lost_dbus'] = _("The wicd daemon has shut down, the UI will not function properly until it is restarted.")
language['configuring_wireless'] = ("Configuring preferences for wireless network \"$A\" ($B)")
language['configuring_wired'] = ("Configuring preferences for wired profile \"$A\"")
return language

View File

@@ -551,21 +551,7 @@ class WiredNetworkEntry(NetworkEntry):
self.button_delete = gtk.Button(stock=gtk.STOCK_DELETE)
self.profile_help = gtk.Label(language['wired_network_instructions'])
self.chkbox_default_profile = gtk.CheckButton(language['default_wired'])
# Build the profile list.
self.combo_profile_names = gtk.combo_box_new_text()
self.profile_list = wired.GetWiredProfileList()
default_prof = wired.GetDefaultWiredNetwork()
if self.profile_list:
starting_index = 0
for x, prof in enumerate(self.profile_list):
self.combo_profile_names.append_text(prof)
if default_prof == prof:
starting_index = x
self.combo_profile_names.set_active(starting_index)
else:
print "no wired profiles found"
self.profile_help.show()
# Format the profile help label.
self.profile_help.set_justify(gtk.JUSTIFY_LEFT)
@@ -588,11 +574,26 @@ class WiredNetworkEntry(NetworkEntry):
self.chkbox_default_profile.connect("toggled",
self.toggle_default_profile)
self.combo_profile_names.connect("changed", self.change_profile)
# Build profile list.
self.profile_list = wired.GetWiredProfileList()
default_prof = wired.GetDefaultWiredNetwork()
if self.profile_list:
starting_index = 0
for x, prof in enumerate(self.profile_list):
self.combo_profile_names.append_text(prof)
if default_prof == prof:
starting_index = x
self.combo_profile_names.set_active(starting_index)
else:
print "no wired profiles found"
self.profile_help.show()
self.advanced_dialog = WiredSettingsDialog(self.combo_profile_names.get_active_text())
# Show everything, but hide the profile help label.
self.show_all()
self.profile_help.hide()
self.advanced_dialog = WiredSettingsDialog(self.combo_profile_names.get_active_text())
# Toggle the default profile checkbox to the correct state.
if to_bool(wired.GetWiredProperty("default")):
@@ -700,17 +701,12 @@ class WiredNetworkEntry(NetworkEntry):
return
profile_name = self.combo_profile_names.get_active_text()
self.advanced_dialog.prof_name = profile_name
wired.ReadWiredNetworkProfile(profile_name)
self.advanced_dialog.txt_ip.set_text(self.format_entry("ip"))
self.advanced_dialog.txt_netmask.set_text(self.format_entry("netmask"))
self.advanced_dialog.txt_gateway.set_text(self.format_entry("gateway"))
self.advanced_dialog.txt_dns_1.set_text(self.format_entry("dns1"))
self.advanced_dialog.txt_dns_2.set_text(self.format_entry("dns2"))
self.advanced_dialog.txt_dns_3.set_text(self.format_entry("dns3"))
self.advanced_dialog.prof_name = profile_name
if hasattr(self, 'advanced_dialog'):
self.advanced_dialog.prof_name = profile_name
self.advanced_dialog.set_values()
is_default = wired.GetWiredProperty("default")
self.chkbox_default_profile.set_active(to_bool(is_default))

View File

@@ -44,6 +44,7 @@ import os
import pango
import time
import atexit
from dbus import DBusException
# Wicd specific imports
from wicd import wpath

View File

@@ -1147,7 +1147,7 @@ class WirelessDaemon(dbus.service.Object):
# Read the essid because we need to name those hidden
# wireless networks now - but only read it if it is hidden.
if cur_network["hidden"]:
cur_network["essid"] = config.get(section, x)
cur_network["essid"] = self.config.get(section, "essid")
if cur_network["essid"] in ["", "Hidden", "<hidden>"]:
cur_network["essid"] = "<hidden>"
for x in self.config.options(section):
@@ -1416,8 +1416,9 @@ class WiredDaemon(dbus.service.Object):
if self.config.has_section(profilename):
return False
for option in ["ip", "broadcast", "netmask","gateway", "dns1", "dns2",
"dns3", "beforescript", "afterscript", "disconnectscript"]:
for option in ["ip", "broadcast", "netmask","gateway", "search_domain",
"dns_domain", "dns1", "dns2", "dns3", "beforescript",
"afterscript", "disconnectscript"]:
self.config.set(profilename, option, None)
self.config.set(profilename, "default", default)
self.config.write()
@@ -1428,29 +1429,24 @@ class WiredDaemon(dbus.service.Object):
""" Finds the previous lastused network, and sets lastused to False. """
profileList = self.config.sections()
for profile in profileList:
if self.config.has_option(profile, "lastused"):
if misc.to_bool(self.config.get(profile, "lastused")):
self.config.set(profile, "lastused", False)
self.SaveWiredNetworkProfile(profile)
if misc.to_bool(self.config.get(profile, "lastused")):
self.config.set(profile, "lastused", False, write=True)
@dbus.service.method('org.wicd.daemon.wired')
def UnsetWiredDefault(self):
""" Unsets the default option in the current default wired profile. """
profileList = self.config.sections()
for profile in profileList:
if self.config.has_option(profile, "default"):
if misc.to_bool(self.config.get(profile, "default")):
self.config.set(profile, "default", False)
self.SaveWiredNetworkProfile(profile)
if misc.to_bool(self.config.get(profile, "default")):
self.config.set(profile, "default", False, write=True)
@dbus.service.method('org.wicd.daemon.wired')
def GetDefaultWiredNetwork(self):
""" Returns the current default wired network. """
profileList = self.config.sections()
for profile in profileList:
if self.config.has_option(profile, "default"):
if misc.to_bool(self.config.get(profile, "default")):
return profile
if misc.to_bool(self.config.get(profile, "default")):
return profile
return None
@dbus.service.method('org.wicd.daemon.wired')
@@ -1458,9 +1454,8 @@ class WiredDaemon(dbus.service.Object):
""" Returns the profile of the last used wired network. """
profileList = self.config.sections()
for profile in profileList:
if self.config.has_option(profile, "lastused"):
if misc.to_bool(self.config.get(profile, "lastused")):
return profile
if misc.to_bool(self.config.get(profile, "lastused")):
return profile
return None
@dbus.service.method('org.wicd.daemon.wired')
@@ -1481,6 +1476,8 @@ class WiredDaemon(dbus.service.Object):
if profilename == "":
self.config.write()
return "500: Bad Profile name"
if self.debug_mode:
print "saving wired profile %s" % profilename
profilename = misc.to_unicode(profilename)
self.config.remove_section(profilename)
self.config.add_section(profilename)
@@ -1499,6 +1496,8 @@ class WiredDaemon(dbus.service.Object):
profile = {}
profilename = misc.to_unicode(profilename)
if self.config.has_section(profilename):
if self.debug_mode:
print "Reading wired profile %s" % profilename
for x in self.config.options(profilename):
profile[x] = misc.Noneify(self.config.get(profilename, x))
profile['use_global_dns'] = bool(profile.get('use_global_dns'))