1
0
mirror of https://github.com/gryf/wicd.git synced 2026-03-16 14:43:33 +01:00

Merged 1.7.1-probably, which contains 14 patches from Debian. Thanks to David Paleino and everyone else who contributed these patches.

This commit is contained in:
Adam Blackburn
2010-05-30 18:03:18 +08:00
13 changed files with 49 additions and 17 deletions

View File

@@ -143,7 +143,7 @@ if options.network_details:
# network properties # network properties
if options.network_property: if options.network_property:
options.network_property = option.network_property.lower() options.network_property = options.network_property.lower()
if options.wireless: if options.wireless:
if options.network >= 0: if options.network >= 0:
is_valid_wireless_network_id(options.network) is_valid_wireless_network_id(options.network)

View File

@@ -1026,7 +1026,7 @@ setup_dbus()
######################################## ########################################
if __name__ == '__main__': if __name__ == '__main__':
try: try:
parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello())) parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello()), prog="wicd-curses")
except Exception, e: except Exception, e:
if "DBus.Error.AccessDenied" in e.get_dbus_name(): if "DBus.Error.AccessDenied" in e.get_dbus_name():
print language['access_denied_wc'].replace('$A','\033[1;34m'+wpath.wicd_group+'\033[0m') print language['access_denied_wc'].replace('$A','\033[1;34m'+wpath.wicd_group+'\033[0m')

View File

@@ -429,7 +429,7 @@ class appGui(object):
gobject.idle_add(self.all_network_list.set_sensitive, True) gobject.idle_add(self.all_network_list.set_sensitive, True)
gobject.idle_add(self.status_area.hide_all) gobject.idle_add(self.status_area.hide_all)
if self.statusID: if self.statusID:
gobject.idle_add(self.status_bar.remove, 1, self.statusID) gobject.idle_add(self.status_bar.remove_message, 1, self.statusID)
def set_connecting_state(self, info): def set_connecting_state(self, info):
if not self.connecting: if not self.connecting:
@@ -444,7 +444,7 @@ class appGui(object):
gobject.idle_add(self.all_network_list.set_sensitive, False) gobject.idle_add(self.all_network_list.set_sensitive, False)
gobject.idle_add(self.status_area.show_all) gobject.idle_add(self.status_area.show_all)
if self.statusID: if self.statusID:
gobject.idle_add(self.status_bar.remove, 1, self.statusID) gobject.idle_add(self.status_bar.remove_message, 1, self.statusID)
if info[0] == "wireless": if info[0] == "wireless":
gobject.idle_add(self.set_status, str(info[1]) + ': ' + gobject.idle_add(self.set_status, str(info[1]) + ': ' +
language[str(wireless.CheckWirelessConnectingMessage())]) language[str(wireless.CheckWirelessConnectingMessage())])
@@ -700,7 +700,7 @@ class appGui(object):
cancel_button.set_sensitive(True) cancel_button.set_sensitive(True)
self.all_network_list.set_sensitive(False) self.all_network_list.set_sensitive(False)
if self.statusID: if self.statusID:
gobject.idle_add(self.status_bar.remove, 1, self.statusID) gobject.idle_add(self.status_bar.remove_message, 1, self.statusID)
gobject.idle_add(self.set_status, language["disconnecting_active"]) gobject.idle_add(self.set_status, language["disconnecting_active"])
gobject.idle_add(self.status_area.show_all) gobject.idle_add(self.status_area.show_all)
self.wait_for_events() self.wait_for_events()
@@ -791,6 +791,7 @@ class appGui(object):
""" """
self.window.present() self.window.present()
self.window.deiconify()
self.wait_for_events() self.wait_for_events()
self.is_visible = True self.is_visible = True
daemon.SetGUIOpen(True) daemon.SetGUIOpen(True)

View File

@@ -550,6 +550,7 @@ class TrayIcon(object):
# Create labels # Create labels
self.label = gtk.Label() self.label = gtk.Label()
self.data = gtk.Label() self.data = gtk.Label()
self.data.set_selectable(True)
self.label.show() self.label.show()
self.data.show() self.data.show()
self.list = [] self.list = []

View File

@@ -118,6 +118,12 @@ This file contains settings related to the wireless interface.
.br .br
See this file's own man page for more information about it. See this file's own man page for more information about it.
.B %ETC%dhclient.conf.template
.br
This is used to replace /etc/dhclient.conf during Wicd activity,
if you're using dhclient(1) as DHCP client. See dhclient.conf(5)
for more information.
.B %ENCRYPTION% .B %ENCRYPTION%
.br .br
This directory contains various templates for encrypted (WEP, WPA, etcetera) This directory contains various templates for encrypted (WEP, WPA, etcetera)
@@ -132,6 +138,12 @@ when the specified event is preformed upon connection or disconnect from
or to any network. Please note that pre/post disconnect scripts may be or to any network. Please note that pre/post disconnect scripts may be
executed multiple times on already-disconnected interfaces. executed multiple times on already-disconnected interfaces.
.br .br
The scripts will be passed different parameters, depending if Wicd is
acting on a wired or a wireless network. In the former case, "wired
wired wired" will be passed (three times, just for compatibility with
the wireless case). If Wicd is acting on a wireless network, it will
pass "wireless ESSID BSSID" to the script.
.br
Available directories are: Available directories are:
.br .br
%SCRIPTS%predisconnect %SCRIPTS%predisconnect
@@ -156,6 +168,7 @@ log if you are having connection or other problems.
.BR wicd-manager-settings.conf (5), .BR wicd-manager-settings.conf (5),
.BR wicd-wired-settings.conf (5), .BR wicd-wired-settings.conf (5),
.BR wicd-wireless-settings.conf (5), .BR wicd-wireless-settings.conf (5),
.BR dhclient.conf (5),
.BR wicd-curses (8), .BR wicd-curses (8),
.BR ifconfig (8), .BR ifconfig (8),
.BR iwconfig (8), .BR iwconfig (8),

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
BOLD=$(tput bold) BOLD=$(tput bold)
BLUE=$(tput setaf 4) BLUE=$(tput setaf 4)
NC=$(tput sgr0) NC=$(tput sgr0)

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
if [ ! -d "$HOME/.wicd" ]; then if [ ! -d "$HOME/.wicd" ]; then
mkdir -p "$HOME/.wicd" mkdir -p "$HOME/.wicd"
fi fi

View File

@@ -1,3 +1,3 @@
#!/bin/bash #!/bin/sh
exec %PYTHON% -O %SHARE%daemon/wicd-daemon.py $@ exec %PYTHON% -O %SHARE%daemon/wicd-daemon.py $@

View File

@@ -436,7 +436,10 @@ class get_translations(Command):
import urllib, shutil import urllib, shutil
if os.path.exists('translations'): if os.path.exists('translations'):
shutil.rmtree('translations/') shutil.rmtree('translations/')
if os.path.exists('po'):
shutil.rmtree('po/')
os.makedirs('translations') os.makedirs('translations')
os.makedirs('po')
filename, headers = urllib.urlretrieve('http://wicd.sourceforge.net/translator/idlist/') filename, headers = urllib.urlretrieve('http://wicd.sourceforge.net/translator/idlist/')
id_file = open(filename, 'r') id_file = open(filename, 'r')
lines = id_file.readlines() lines = id_file.readlines()
@@ -452,11 +455,10 @@ class get_translations(Command):
except: except:
print >> sys.stderr, 'error downloading language %s' % id print >> sys.stderr, 'error downloading language %s' % id
else: else:
shutil.move(pofile, lang_identifier+'.po') shutil.move(pofile, 'po/'+lang_identifier+'.po')
os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES') os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES')
os.system('msgfmt --output-file=translations/' + lang_identifier + os.system('msgfmt --output-file=translations/' + lang_identifier +
'/LC_MESSAGES/wicd.mo ' + lang_identifier + '.po') '/LC_MESSAGES/wicd.mo po/' + lang_identifier + '.po')
os.remove(lang_identifier+'.po')
class uninstall(Command): class uninstall(Command):

View File

@@ -26,7 +26,7 @@ reusable for other purposes as well.
import os, copy import os, copy
from ConfigParser import RawConfigParser from ConfigParser import RawConfigParser, ParsingError
from wicd.misc import Noneify, to_unicode from wicd.misc import Noneify, to_unicode
@@ -39,7 +39,16 @@ class ConfigManager(RawConfigParser):
self.config_file = path self.config_file = path
self.debug = debug self.debug = debug
self.mrk_ws = mark_whitespace self.mrk_ws = mark_whitespace
try:
self.read(path) self.read(path)
except ParsingError, e:
self.write()
try:
self.read(path)
except ParsingError, p:
import sys
print "Could not start wicd: %s" % p.message
sys.exit(1)
def __repr__(self): def __repr__(self):
return self.config_file return self.config_file

View File

@@ -186,6 +186,8 @@ def ExecuteScripts(scripts_dir, verbose=False, extra_parameters=()):
if not os.path.exists(scripts_dir): if not os.path.exists(scripts_dir):
return return
for obj in sorted(os.listdir(scripts_dir)): for obj in sorted(os.listdir(scripts_dir)):
if obj.startswith(".") or obj.endswith(("~", ".new", ".orig")):
continue
obj = os.path.abspath(os.path.join(scripts_dir, obj)) obj = os.path.abspath(os.path.join(scripts_dir, obj))
if os.path.isfile(obj) and os.access(obj, os.X_OK): if os.path.isfile(obj) and os.access(obj, os.X_OK):
ExecuteScript(os.path.abspath(obj), verbose=verbose, ExecuteScript(os.path.abspath(obj), verbose=verbose,

View File

@@ -948,12 +948,14 @@ class WicdDaemon(dbus.service.Object):
os.chmod(app_conf.get_config(), 0600) os.chmod(app_conf.get_config(), 0600)
os.chmod(wireless_conf, 0600) os.chmod(wireless_conf, 0600)
os.chmod(wired_conf, 0600) os.chmod(wired_conf, 0600)
os.chmod(dhclient_conf, 0644)
# Make root own them # Make root own them
print "chowning configuration files root:root..." print "chowning configuration files root:root..."
os.chown(app_conf.get_config(), 0, 0) os.chown(app_conf.get_config(), 0, 0)
os.chown(wireless_conf, 0, 0) os.chown(wireless_conf, 0, 0)
os.chown(wired_conf, 0, 0) os.chown(wired_conf, 0, 0)
os.chown(dhclient_conf, 0, 0)
print "Using wireless interface..." + self.GetWirelessInterface() print "Using wireless interface..." + self.GetWirelessInterface()
print "Using wired interface..." + self.GetWiredInterface() print "Using wired interface..." + self.GetWiredInterface()
@@ -1702,6 +1704,7 @@ def main(argv):
# wicd exploded # wicd exploded
if not os.path.exists(backup_location): if not os.path.exists(backup_location):
shutil.copy2('/etc/resolv.conf', backup_location) shutil.copy2('/etc/resolv.conf', backup_location)
os.chmod(backup_location, 0644)
except IOError: except IOError:
print 'error backing up resolv.conf' print 'error backing up resolv.conf'
@@ -1748,6 +1751,7 @@ def main(argv):
# restore resolv.conf on quit # restore resolv.conf on quit
try: try:
shutil.move(wpath.varlib + 'resolv.conf.orig', '/etc/resolv.conf') shutil.move(wpath.varlib + 'resolv.conf.orig', '/etc/resolv.conf')
os.chmod('/etc/resolv.conf', 0644)
except IOError: except IOError:
print 'error restoring resolv.conf' print 'error restoring resolv.conf'

View File

@@ -325,6 +325,7 @@ class BaseInterface(object):
output_conf.close() output_conf.close()
dhclient_template.close() dhclient_template.close()
os.chmod(dhclient_conf_path, 0644)
if not client_name or not cmd: if not client_name or not cmd:
print "WARNING: Failed to find a valid dhcp client!" print "WARNING: Failed to find a valid dhcp client!"
@@ -619,6 +620,7 @@ class BaseInterface(object):
else: else:
print "ERROR: no dhcp client found" print "ERROR: no dhcp client found"
ret = None ret = None
self.dhcp_object.wait()
return ret return ret
@neediface(False) @neediface(False)
@@ -1088,9 +1090,7 @@ class BaseWirelessInterface(BaseInterface):
bssid -- bssid of the network bssid -- bssid of the network
""" """
cmd = ['iwconfig', self.iface, 'essid', essid] self.SetEssid(essid)
if self.verbose: print str(cmd)
misc.Run(cmd)
base = "iwconfig %s" % self.iface base = "iwconfig %s" % self.iface
if channel and str(channel).isdigit(): if channel and str(channel).isdigit():
cmd = "%s channel %s" % (base, str(channel)) cmd = "%s channel %s" % (base, str(channel))