From fa1d25d4411b3392b5ae0ddb50958e27c9299599 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 26 Feb 2007 12:26:10 +0100 Subject: [PATCH] Add a device-added signal --- shell/hardware/nmclient.py | 5 +++++ shell/model/MeshModel.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/hardware/nmclient.py b/shell/hardware/nmclient.py index 61685cf8..fa763ab6 100644 --- a/shell/hardware/nmclient.py +++ b/shell/hardware/nmclient.py @@ -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 diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py index 199dd837..c6247a89 100644 --- a/shell/model/MeshModel.py +++ b/shell/model/MeshModel.py @@ -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):