hal/hald callout.c,1.10,1.11

Joe Shaw joe at pdx.freedesktop.org
Mon Apr 26 13:42:15 PDT 2004


Update of /cvs/hal/hal/hald
In directory pdx:/tmp/cvs-serv22484/hald

Modified Files:
	callout.c 
Log Message:
2004-04-26  Joe Shaw  <joe at ximian.com>

	* hald/callout.c (hal_callout_device): We still need to emit the
	callouts_finished signal even if we have no callouts.  Whoops.

	* hald/bus_device.c (bus_device_got_parent): We don't need to ref
	the device being added, since it's no longer unconditionally being
	unreffed immediately afterward.

	* hald/class_device.c (class_device_final): Ditto.

	* hald/common.c (device_move_from_tdl_to_gdl): Remove the ref note
	in the comment, and call g_object_ref() at the top of the
	function.

Index: callout.c
===================================================================
RCS file: /cvs/hal/hal/hald/callout.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- a/callout.c	26 Apr 2004 20:08:58 -0000	1.10
+++ b/callout.c	26 Apr 2004 20:42:13 -0000	1.11
@@ -263,11 +263,12 @@
 	GDir *dir;
 	GError *err = NULL;
 	const char *filename;
+	gboolean any_callouts = FALSE;
 
 	/* Directory doesn't exist.  This isn't an error, just exit
 	 * quietly. */
 	if (!g_file_test (DEVICE_CALLOUT_DIR, G_FILE_TEST_EXISTS))
-		return;
+		goto finish;
 
 	dir = g_dir_open (DEVICE_CALLOUT_DIR, 0, &err);
 
@@ -275,7 +276,7 @@
 		HAL_WARNING (("Unable to open device callout directory: %s",
 			      err->message));
 		g_error_free (err);
-		return;
+		goto finish;
 	}
 
 	while ((filename = g_dir_read_name (dir)) != NULL) {
@@ -308,12 +309,23 @@
 		callout->envp[0] = g_strdup_printf ("UDI=%s",
 						    hal_device_get_udi (device));
 		add_pending_callout (callout->device, callout);
+
+		any_callouts = TRUE;
 	}
 
 	g_dir_close (dir);
 
 	if (!processing_callouts)
 		g_idle_add (process_callouts_idle, NULL);
+
+finish:
+	/*
+	 * If we're not executing any callouts for this device, go ahead
+	 * and emit the "callouts_finished" signal.
+	 */
+	if (!any_callouts)
+		hal_device_callouts_finished (device);
+		
 }
 
 void





More information about the hal-commit mailing list