From 3989159ee65ba89af49c4669fb840786a9aaadb5 Mon Sep 17 00:00:00 2001 From: imdano <> Date: Sat, 13 Sep 2008 21:39:20 +0000 Subject: [PATCH] experimental: - Merge missing dbusmanager changes from pluggablebackends - Merge a change from trunk for --no-autoconnect mode - Make monitor timeout_add_seconds time an integer --- wicd/dbusmanager.py | 55 +++++++++++++++++++++++++++++++++++++++++++++ wicd/monitor.py | 2 +- wicd/wicd-daemon.py | 4 ++-- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/wicd/dbusmanager.py b/wicd/dbusmanager.py index e69de29..e45a025 100644 --- a/wicd/dbusmanager.py +++ b/wicd/dbusmanager.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +""" The wicd DBus Manager. + +A module for storing wicd's dbus interfaces. + +""" + +# +# Copyright (C) 2007 Adam Blackburn +# Copyright (C) 2007 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 +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import dbus + +class DBusManager(object): + def __init__(self): + self._bus = dbus.SystemBus() + self._dbus_ifaces = {} + + def get_dbus_ifaces(self): + """ Returns a dict of dbus interfaces. """ + return self._dbus_ifaces + + def get_bus(self): + """ Returns the loaded SystemBus. """ + return self._bus + + def connect_to_dbus(self): + """ Connects to wicd's dbus interfaces and loads them into a dict. """ + proxy_obj = self._bus.get_object("org.wicd.daemon", '/org/wicd/daemon') + daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon') + + proxy_obj = self._bus.get_object("org.wicd.daemon", + '/org/wicd/daemon/wireless') + wireless = dbus.Interface(proxy_obj, 'org.wicd.daemon.wireless') + + proxy_obj = self._bus.get_object("org.wicd.daemon", + '/org/wicd/daemon/wired') + wired = dbus.Interface(proxy_obj, 'org.wicd.daemon.wired') + + self._dbus_ifaces = {"daemon" : daemon, "wireless" : wireless, + "wired" : wired} diff --git a/wicd/monitor.py b/wicd/monitor.py index d0b009a..fbc4449 100755 --- a/wicd/monitor.py +++ b/wicd/monitor.py @@ -290,7 +290,7 @@ def main(): """ monitor = ConnectionStatus() if daemon.GetCurrentBackend() == "ioctl": - to_time = 2.5 + to_time = 3 else: to_time = 4 try: diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 9cd2112..87e7a60 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -111,8 +111,8 @@ class WicdDaemon(dbus.service.Object): self.AutoConnect(True) else: self.wireless_bus.Scan() - #self.SetForcedDisconnect(True) - print "--no-scan detected, not autoconnecting..." + self.SetForcedDisconnect(True) + print "--no-autoconnect detected, not autoconnecting..." @dbus.service.method('org.wicd.daemon') def Hello(self):