[patch] Do callout when optical device is removed

Sjoerd Simons sjoerd at luon.net
Wed May 12 11:14:10 PDT 2004


Hi,

  The device removed callout isn't called when an optical device is
  removed. little patch attached to fix this.

  Sjoerd
-- 
"The four building blocks of the universe are fire, water, gravel and vinyl."
		-- Dave Barry
-------------- next part --------------
Index: hald/linux/block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.20
diff -u -r1.20 block_class_device.c
--- hald/linux/block_class_device.c	5 May 2004 20:46:34 -0000	1.20
+++ hald/linux/block_class_device.c	12 May 2004 18:12:59 -0000
@@ -377,6 +377,15 @@
 					      user_data);
 }
 
+static void
+disc_remove_from_gdl (HalDevice *device, gpointer user_data)
+{
+	hal_device_store_remove (hald_get_gdl (), device);
+	g_signal_handlers_disconnect_by_func (device, disc_remove_from_gdl, 
+					      user_data);
+  g_object_unref(device);
+}
+
 /** Check for media on a block device that is not a volume
  *
  *  @param  d                   Device to inspect; can be any device, but
@@ -467,8 +476,9 @@
 
 			if (child != NULL) {
 				HAL_INFO (("Removing volume for optical device %s", device_file));
-				hal_device_store_remove (hald_get_gdl (), child);
-				g_object_unref (child);
+			  g_signal_connect (child, "callouts_finished",
+			  		  G_CALLBACK (disc_remove_from_gdl), NULL);
+				hal_callout_device (child, FALSE);
 
 				close (fd);
 
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list