/usr/share/pyshared/wicd/dbusmanager.py is in python-wicd 1.7.2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | #!/usr/bin/env python
""" The wicd DBus Manager.
A module for managing wicd's dbus interfaces.
"""
#
# Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2008-2009 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
if getattr(dbus, "version", (0, 0, 0)) < (0, 80, 0):
import dbus.glib
else:
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
DBUS_MANAGER = None
def get_dbus_ifaces():
return DBUS_MANAGER.get_dbus_ifaces()
def get_interface(iface):
return DBUS_MANAGER.get_interface(iface)
def get_bus():
return DBUS_MANAGER.get_bus()
def set_mainloop():
return DBUS_MANAGER.set_mainloop()
def connect_to_dbus():
return DBUS_MANAGER.connect_to_dbus()
def threads_init():
dbus.mainloop.glib.threads_init()
class DBusManager(object):
""" Manages the DBus objects used by wicd. """
def __init__(self):
self._bus = dbus.SystemBus()
self._dbus_ifaces = {}
def get_dbus_ifaces(self):
""" Returns a dict of dbus interfaces. """
if not self._dbus_ifaces: connect_to_dbus()
return self._dbus_ifaces
def get_interface(self, iface):
""" Returns a DBus Interface. """
if not self._dbus_ifaces: connect_to_dbus()
return self._dbus_ifaces[iface]
def get_bus(self):
""" Returns the loaded SystemBus. """
return self._bus
def set_mainloop(self, loop):
dbus.set_default_main_loop(loop)
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}
DBUS_MANAGER = DBusManager()
|