From fcf01b12b3cf3034714176cbfd261bb6905a7c04 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Thu, 15 Jan 2009 01:22:40 -0500 Subject: [PATCH] Use dbusmanager in autoconnect.py --- wicd/autoconnect.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wicd/autoconnect.py b/wicd/autoconnect.py index 787aae5..a8443cd 100755 --- a/wicd/autoconnect.py +++ b/wicd/autoconnect.py @@ -17,6 +17,8 @@ # along with this program. If not, see . # +from wicd import dbusmanager + import dbus import time import gobject @@ -29,9 +31,9 @@ else: DBusGMainLoop(set_as_default=True) try: - bus = dbus.SystemBus() - proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon') - daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon') + dbusmanager.connect_to_dbus() + daemon = dbusmanager.get_interface('daemon') + wireless = dbusmanager.get_interface('wireless') except Exception, e: print>>sys.stderr, "Exception caught: %s" % str(e) print>>sys.stderr, 'Could not connect to daemon.' @@ -46,10 +48,10 @@ def error_handler(*args): if __name__ == '__main__': try: - time.sleep(3) + time.sleep(2) + wireless.Scan() daemon.SetSuspend(False) if not daemon.CheckIfConnecting(): - daemon.SetForcedDisconnect(False) daemon.AutoConnect(True, reply_handler=handler, error_handler=handler) except Exception, e: print>>sys.stderr, "Exception caught: %s" % str(e)