brasero r1611 - in trunk: . src



Author: philippr
Date: Sat Dec  6 14:52:20 2008
New Revision: 1611
URL: http://svn.gnome.org/viewvc/brasero?rev=1611&view=rev

Log:
	Attempt at fixing #559161 â Trying to burn to previously used CDRW does not offer to erase and claims to burn endlessly
	Added an additional debug statement.
	Rewrote brasero_volume_is_mounted ().

	* src/burn-volume-obj.c (brasero_volume_is_mounted),
	(brasero_volume_umount_finish), (brasero_volume_umount):
	* src/burn.c (brasero_burn_record):


Modified:
   trunk/ChangeLog
   trunk/src/burn-volume-obj.c
   trunk/src/burn.c

Modified: trunk/src/burn-volume-obj.c
==============================================================================
--- trunk/src/burn-volume-obj.c	(original)
+++ trunk/src/burn-volume-obj.c	Sat Dec  6 14:52:20 2008
@@ -159,8 +159,12 @@
 gboolean
 brasero_volume_is_mounted (BraseroVolume *self)
 {
-	GMount *mount;
-	GVolume *volume;
+	GList *iter;
+	GList *mounts;
+	gboolean result;
+	BraseroDrive *drive;
+	GVolumeMonitor *monitor;
+	const gchar *volume_path;
 	BraseroVolumePrivate *priv;
 
 	if (!self)
@@ -168,23 +172,42 @@
 
 	priv = BRASERO_VOLUME_PRIVATE (self);
 
-	volume = brasero_volume_get_gvolume (self);
-	if (!volume)
-		return FALSE;
+	drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
 
-	if (!g_volume_can_mount (volume)) {
-		/* if it can't be mounted then it's unmounted ... */
-		g_object_unref (volume);
-		return FALSE;
-	}
+#if defined(HAVE_STRUCT_USCSI_CMD)
+	volume_path = brasero_drive_get_block_device (drive);
+#else
+	volume_path = brasero_drive_get_device (drive);
+#endif
 
-	mount = g_volume_get_mount (volume);
-	g_object_unref (volume);
-	if (!mount)
+	if (!volume_path)
 		return FALSE;
 
-	g_object_unref (mount);
-	return TRUE;
+	monitor = g_volume_monitor_get ();
+	mounts = g_volume_monitor_get_mounts (monitor);
+	g_object_unref (monitor);
+
+	result = FALSE;
+	for (iter = mounts; iter; iter = iter->next) {
+		GMount *mount;
+		GVolume *volume;
+		gchar *device_path;
+
+		mount = iter->data;
+		volume = g_mount_get_volume (mount);
+		device_path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+		if (!device_path)
+			continue;		
+
+		if (!strcmp (device_path, volume_path)) {
+			result = TRUE;
+			break;
+		}
+	}
+	g_list_foreach (mounts, (GFunc) g_object_unref, NULL);
+	g_list_free (mounts);
+
+	return result;
 }
 
 gchar *
@@ -340,6 +363,8 @@
 					       result,
 					       &priv->error);
 
+	BRASERO_BURN_LOG ("Umount operation completed (result = %d)", priv->result);
+
 	if (priv->error) {
 		if (priv->error->code == G_IO_ERROR_FAILED_HANDLED) {
 			/* means we shouldn't display any error message since 
@@ -402,10 +427,10 @@
 		GVolumeMonitor *monitor;
 
 		monitor = g_volume_monitor_get ();
-		umount_sig = g_signal_connect (monitor,
-					       "mount-removed",
-					       G_CALLBACK (brasero_volume_umounted_cb),
-					       self);
+		umount_sig = g_signal_connect_after (monitor,
+						     "mount-removed",
+						     G_CALLBACK (brasero_volume_umounted_cb),
+						     self);
 
 		g_mount_unmount (mount,
 				 G_MOUNT_UNMOUNT_NONE,

Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c	(original)
+++ trunk/src/burn.c	Sat Dec  6 14:52:20 2008
@@ -2608,8 +2608,7 @@
 			goto end;
 	}
 
-	/* burn the session a first time whatever the number of copies required 
-	 * except if dummy session */
+	/* burn the session except if dummy session */
 	result = brasero_burn_record_session (burn, TRUE, error);
 
 end:



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