1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-28 09:22:36 +01:00

Merged autoconnect.py and suspend.py changes from trunk (fixes for

the pm-utils sleep hook usage).
This commit is contained in:
Robby Workman
2008-12-28 00:19:25 -06:00
parent f35e5513ca
commit da5fc2dfdf
2 changed files with 41 additions and 20 deletions

View File

@@ -2,14 +2,14 @@
""" Suspends the wicd daemon.
Sets a flag in the daemon that will stop it from monitoring network status.
Sets a flag in the daemon that will stop it from monitoring networkg status.
Used for when a laptop enters hibernation/suspension.
"""
#
# Copyright (C) 2007 Adam Blackburn
# Copyright (C) 2007 Dan O'Reilly
# Copyright (C) 2007 - 2008 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as
@@ -26,13 +26,17 @@ Used for when a laptop enters hibernation/suspension.
import dbus
import dbus.service
import sys
try:
bus = dbus.SystemBus()
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
except Exception, e:
print "Exception caught: %s" % str(e)
print>>sys.stderr, "Exception caught: %s" % str(e)
print>>sys.stderr, 'Could not connect to daemon.'
sys.exit(1)
if __name__ == '__main__':
@@ -41,5 +45,7 @@ if __name__ == '__main__':
daemon.SetForcedDisconnect(False)
daemon.SetSuspend(True)
except Exception, e:
print "Exception caught: %s" % str(e)
print>>sys.stderr, "Exception caught: %s" % str(e)
print>>sys.stderr, 'Error setting suspend.'
sys.exit(2)