File virtman-detect.diff of Package virt-manager

diff -Nuar virt-manager-0.5.3.orig/src/virtManager/connection.py virt-manager-0.5.3/src/virtManager/connection.py
--- virt-manager-0.5.3.orig/src/virtManager/connection.py	2008-02-12 11:32:25.000000000 -0700
+++ virt-manager-0.5.3/src/virtManager/connection.py	2008-02-12 11:36:04.000000000 -0700
@@ -158,13 +158,17 @@
             hal_object = self.bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager')
             self.hal_iface = dbus.Interface(hal_object, 'org.freedesktop.Hal.Manager')
 
+            # Find info about all current present media
+            for path in self.hal_iface.FindDeviceByCapability("net"):
+                self._device_added(path)
+
+            # Connect to signals AFTER FindDeviceByCapability.  This leaves a small hole
+            # where we could miss a device add, but FindDeviceByCapability takes 
+            # several seconds to execute if the signals are connected in advance...
             # Track device add/removes so we can detect newly inserted CD media
             self.hal_iface.connect_to_signal("DeviceAdded", self._device_added)
             self.hal_iface.connect_to_signal("DeviceRemoved", self._device_removed)
 
-            # Find info about all current present media
-            for path in self.hal_iface.FindDeviceByCapability("net"):
-                self._device_added(path)
         except:
             (type, value, stacktrace) = sys.exc_info ()
             logging.error("Unable to connect to HAL to list network devices: '%s'" + \
openSUSE Build Service is sponsored by