mirror of
https://github.com/gryf/wicd.git
synced 2026-01-06 13:54:17 +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:
@@ -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}
|
||||
|
||||
@@ -290,7 +290,7 @@ def main():
|
||||
"""
|
||||
monitor = ConnectionStatus()
|
||||
if daemon.GetCurrentBackend() == "ioctl":
|
||||
to_time = 2.5
|
||||
to_time = 3
|
||||
else:
|
||||
to_time = 4
|
||||
try:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user