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 self.remote_ctrl = None
if gajim.config.get('networkmanager_support') and dbus_support.supported: if gajim.config.get('networkmanager_support') and dbus_support.supported:
try: import network_manager_listener
import network_manager_listener if not network_manager_listener.supported:
except:
print >> sys.stderr, _('Network Manager support not available') print >> sys.stderr, _('Network Manager support not available')
self.show_vcard_when_connect = [] 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: 'listen_to_network_manager') and connection.connected > 1:
connection._disconnectedReconnCB() connection._disconnectedReconnCB()
supported = False
from common.dbus_support import system_bus try:
from common.dbus_support import system_bus
import dbus bus = system_bus.SystemBus()
import dbus.glib
bus = system_bus.SystemBus() if 'org.freedesktop.NetworkManager' in bus.list_names():
supported = True
bus.add_signal_receiver(device_no_longer_active, bus.add_signal_receiver(device_no_longer_active,
'DeviceNoLongerActive', 'DeviceNoLongerActive',
'org.freedesktop.NetworkManager', 'org.freedesktop.NetworkManager',
'org.freedesktop.NetworkManager', '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')
bus.add_signal_receiver(device_now_active,
'DeviceNowActive',
'org.freedesktop.NetworkManager',
'org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')