1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-31 04:55:52 +01:00

experimental:

- Merge missing dbusmanager changes from pluggablebackends
- Merge a change from trunk for --no-autoconnect mode
- Make monitor timeout_add_seconds time an integer
This commit is contained in:
imdano
2008-09-13 21:39:20 +00:00
parent bbfcae834e
commit 3989159ee6
3 changed files with 58 additions and 3 deletions

View File

@@ -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 <http://www.gnu.org/licenses/>.
#
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}