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

Use dbusmanager in autoconnect.py

This commit is contained in:
Dan O'Reilly
2009-01-15 01:22:40 -05:00
parent d84912aaad
commit fcf01b12b3

View File

@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
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)