Add a device-added signal
This commit is contained in:
parent
89a91954c9
commit
fa1d25d441
@ -335,6 +335,9 @@ class Device(gobject.GObject):
|
|||||||
|
|
||||||
class NMClient(gobject.GObject):
|
class NMClient(gobject.GObject):
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
|
'device-added' : (gobject.SIGNAL_RUN_FIRST,
|
||||||
|
gobject.TYPE_NONE,
|
||||||
|
([gobject.TYPE_PYOBJECT])),
|
||||||
'device-activated' : (gobject.SIGNAL_RUN_FIRST,
|
'device-activated' : (gobject.SIGNAL_RUN_FIRST,
|
||||||
gobject.TYPE_NONE,
|
gobject.TYPE_NONE,
|
||||||
([gobject.TYPE_PYOBJECT])),
|
([gobject.TYPE_PYOBJECT])),
|
||||||
@ -386,6 +389,8 @@ class NMClient(gobject.GObject):
|
|||||||
dev.connect('init-failed', self._dev_init_failed_cb)
|
dev.connect('init-failed', self._dev_init_failed_cb)
|
||||||
dev.connect('state-changed', self._dev_state_changed_cb)
|
dev.connect('state-changed', self._dev_state_changed_cb)
|
||||||
|
|
||||||
|
self.emit('device-added', dev)
|
||||||
|
|
||||||
def _remove_device(self, dev_op):
|
def _remove_device(self, dev_op):
|
||||||
if not self._devices.has_key(dev_op):
|
if not self._devices.has_key(dev_op):
|
||||||
return
|
return
|
||||||
|
@ -89,7 +89,7 @@ class MeshModel(gobject.GObject):
|
|||||||
network_manager = hardwaremanager.get_network_manager()
|
network_manager = hardwaremanager.get_network_manager()
|
||||||
for nm_device in network_manager.get_devices():
|
for nm_device in network_manager.get_devices():
|
||||||
self._add_network_device(nm_device)
|
self._add_network_device(nm_device)
|
||||||
network_manager.connect('device-activated',
|
network_manager.connect('device-added',
|
||||||
self._nm_device_activated_cb)
|
self._nm_device_activated_cb)
|
||||||
|
|
||||||
def _nm_device_activated_cb(self, manager, nm_device):
|
def _nm_device_activated_cb(self, manager, nm_device):
|
||||||
|
Loading…
Reference in New Issue
Block a user