Add a device-added signal

This commit is contained in:
Marco Pesenti Gritti 2007-02-26 12:26:10 +01:00
parent 89a91954c9
commit fa1d25d441
2 changed files with 6 additions and 1 deletions

View File

@ -335,6 +335,9 @@ class Device(gobject.GObject):
class NMClient(gobject.GObject):
__gsignals__ = {
'device-added' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'device-activated' : (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
@ -386,6 +389,8 @@ class NMClient(gobject.GObject):
dev.connect('init-failed', self._dev_init_failed_cb)
dev.connect('state-changed', self._dev_state_changed_cb)
self.emit('device-added', dev)
def _remove_device(self, dev_op):
if not self._devices.has_key(dev_op):
return

View File

@ -89,7 +89,7 @@ class MeshModel(gobject.GObject):
network_manager = hardwaremanager.get_network_manager()
for nm_device in network_manager.get_devices():
self._add_network_device(nm_device)
network_manager.connect('device-activated',
network_manager.connect('device-added',
self._nm_device_activated_cb)
def _nm_device_activated_cb(self, manager, nm_device):