better network_manager detection

This commit is contained in:
Yann Leboulanger 2007-06-26 20:59:30 +00:00
parent 161cdf1e49
commit a1bf7363c7
2 changed files with 18 additions and 19 deletions

View File

@ -2370,9 +2370,8 @@ class Interface:
self.remote_ctrl = None
if gajim.config.get('networkmanager_support') and dbus_support.supported:
try:
import network_manager_listener
except:
import network_manager_listener
if not network_manager_listener.supported:
print >> sys.stderr, _('Network Manager support not available')
self.show_vcard_when_connect = []

View File

@ -27,23 +27,23 @@ def device_no_longer_active(self, *args):
'listen_to_network_manager') and connection.connected > 1:
connection._disconnectedReconnCB()
supported = False
from common.dbus_support import system_bus
try:
from common.dbus_support import system_bus
import dbus
import dbus.glib
bus = system_bus.SystemBus()
bus = system_bus.SystemBus()
bus.add_signal_receiver(device_no_longer_active,
'DeviceNoLongerActive',
'org.freedesktop.NetworkManager',
'org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')
bus.add_signal_receiver(device_now_active,
'DeviceNowActive',
'org.freedesktop.NetworkManager',
'org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')
if 'org.freedesktop.NetworkManager' in bus.list_names():
supported = True
bus.add_signal_receiver(device_no_longer_active,
'DeviceNoLongerActive',
'org.freedesktop.NetworkManager',
'org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')
bus.add_signal_receiver(device_now_active,
'DeviceNowActive',
'org.freedesktop.NetworkManager',
'org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')