Re: [Utopia] gvm_device_is_writer



On Thu, May 20, 2004 at 08:47:39PM +0200, Frederic Peters wrote:
> I fixed this with:
>         drive_udi = hal_device_get_property_string(hal_ctx, udi,
>                         "info.parent");
> and calling gvm_device_is_writer(drive_udi);.
> 
> This a hal cvs checkout dated 20040515 (debian package) and uptodate
> cvs gnome-volume-manager.
> 
> Trivial patch attached.  Hope it is useful.  Keep up the good work.

You forgot to free the drive_udi string after usage. Attached is a fixed 
version of your patch, which I used in the debian packages for gvm.

  Sjoerd
-- 
Depend on the rabbit's foot if you will, but remember, it didn't help
the rabbit.
		-- R.E. Shay
Index: src/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-volume-manager/src/manager.c,v
retrieving revision 1.22
diff -u -r1.22 manager.c
--- a/src/manager.c	18 May 2004 21:40:33 -0000	1.22
+++ b/src/manager.c	21 May 2004 07:38:16 -0000
@@ -487,6 +487,7 @@
 gvm_cdrom_policy (const char *udi)
 {
 	char *device = NULL;
+	char *drive_udi = NULL;
 	dbus_bool_t has_audio;
 	dbus_bool_t has_data;
 	dbus_bool_t is_blank;
@@ -497,6 +498,8 @@
 						  "volume.disc.has_data");
 	is_blank = hal_device_get_property_bool (hal_ctx, udi,
 						  "volume.disc.is_blank");
+	drive_udi = hal_device_get_property_string(hal_ctx, udi,
+			"info.parent");
 
 	device = hal_device_get_property_string (hal_ctx, udi, "block.device");
 	if (!device) {
@@ -512,7 +515,7 @@
 		if (config.automount_media)
 			gvm_device_mount (device);
 	} else if (is_blank) {
-		if (gvm_device_is_writer (device))
+		if (gvm_device_is_writer (drive_udi))
 			gvm_run_cdburner (device, device);
 	}
 
@@ -520,6 +523,7 @@
 
 out:
 	hal_free_string (device);
+	hal_free_string (drive_udi);
 }
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]