1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 21:08:06 +01:00

Fixed asynchronous Autoconnect calls so that they actually work properly

This commit is contained in:
imdano
2008-03-14 19:16:18 +00:00
parent 9d495370d0
commit 18f9638e3d
2 changed files with 13 additions and 5 deletions

View File

@@ -19,20 +19,26 @@
import dbus
import time
import gobject
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
def reply_handle(r):
pass
def reply_handle():
loop.quit()
def error_handle(e):
pass
loop.quit()
print daemon.Hello()
time.sleep(3)
daemon.SetSuspend(False)
daemon.SetForcedDisconnect(False)
if not daemon.CheckIfConnecting():
print daemon.AutoConnect(True, reply_handler=reply_handle,
error_handler=error_handle)
daemon.SetForcedDisconnect(False)
loop = gobject.MainLoop()
loop.run()