[brasero] Some more debugging around ejection and unmounting



commit b8b8cb21b8481934ab3dc141e89b7b79e59455e1
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sun Oct 11 19:45:38 2009 +0200

    Some more debugging around ejection and unmounting

 libbrasero-burn/brasero-burn.c           |   28 ++++++++++++++++++++++++----
 libbrasero-media/brasero-drive.c         |   17 ++---------------
 libbrasero-media/brasero-gio-operation.c |    4 +++-
 3 files changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index 54e9146..ecfe138 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -291,6 +291,8 @@ brasero_burn_unmount (BraseroBurn *self,
 
 	/* Retry several times, since sometimes the drives are really busy */
 	while (brasero_volume_is_mounted (BRASERO_VOLUME (medium))) {
+		GError *ret_error;
+
 		counter ++;
 		if (counter > MAX_EJECT_ATTEMPTS) {
 			BRASERO_BURN_LOG ("Max attempts reached at unmounting");
@@ -306,7 +308,14 @@ brasero_burn_unmount (BraseroBurn *self,
 
 		BRASERO_BURN_LOG ("Retrying unmounting");
 
+		ret_error = NULL;
 		brasero_volume_umount (BRASERO_VOLUME (medium), TRUE, NULL);
+
+		if (ret_error) {
+			BRASERO_BURN_LOG ("Ejection error: %s", ret_error->message);
+			g_error_free (ret_error);
+		}
+
 		brasero_burn_sleep (self, 500);
 	}
 
@@ -324,6 +333,8 @@ brasero_burn_eject (BraseroBurn *self,
 
 	/* Retry several times, since sometimes the drives are really busy */
 	while (brasero_drive_get_medium (drive)) {
+		GError *ret_error;
+
 		counter ++;
 		if (counter > MAX_EJECT_ATTEMPTS) {
 			gchar *name;
@@ -344,7 +355,14 @@ brasero_burn_eject (BraseroBurn *self,
 		}
 
 		BRASERO_BURN_LOG ("Retrying ejection");
-		brasero_drive_eject (drive, TRUE, NULL);
+		ret_error = NULL;
+		brasero_drive_eject (drive, TRUE, &ret_error);
+
+		if (ret_error) {
+			BRASERO_BURN_LOG ("Ejection error: %s", ret_error->message);
+			g_error_free (ret_error);
+		}
+
 		brasero_burn_sleep (self, 500);
 	}
 
@@ -367,8 +385,10 @@ brasero_burn_eject_dest_media (BraseroBurn *self,
 		return BRASERO_BURN_OK;
 
 	medium = brasero_drive_get_medium (priv->dest);
-	if (brasero_volume_is_mounted (BRASERO_VOLUME (medium)))
-		brasero_volume_umount (BRASERO_VOLUME (medium), TRUE, NULL);
+
+	result = brasero_burn_unmount (self, medium, error);
+	if (result != BRASERO_BURN_OK)
+		return result;
 
 	if (priv->dest_locked) {
 		priv->dest_locked = 0;
@@ -1182,7 +1202,7 @@ brasero_burn_unlock_dest_media (BraseroBurn *burn,
 			brasero_drive_reprobe (priv->dest);
 	}
 	else
-		brasero_drive_eject (priv->dest, FALSE, error);
+		brasero_burn_eject (burn, priv->dest, error);
 
 	priv->dest = NULL;
 	return BRASERO_BURN_OK;
diff --git a/libbrasero-media/brasero-drive.c b/libbrasero-media/brasero-drive.c
index ac6b1bf..8e4712b 100644
--- a/libbrasero-media/brasero-drive.c
+++ b/libbrasero-media/brasero-drive.c
@@ -224,20 +224,6 @@ brasero_drive_cancel_probing (BraseroDrive *drive)
 		g_source_remove (priv->probe_id);
 		priv->probe_id = 0;
 	}
-
-	if (priv->medium) {
-		BraseroMedium *medium;
-
-		medium = priv->medium;
-		priv->medium = NULL;
-
-		g_signal_emit (drive,
-			       drive_signals [MEDIUM_REMOVED],
-			       0,
-			       medium);
-
-		g_object_unref (medium);
-	}
 }
 
 /**
@@ -297,9 +283,10 @@ brasero_drive_eject (BraseroDrive *drive,
 		g_cancellable_reset (priv->cancel);
 	}
 
-	BRASERO_MEDIA_LOG ("Trying to eject volume");
 	gvolume = brasero_volume_get_gvolume (BRASERO_VOLUME (priv->medium));
 	if (gvolume) {
+		BRASERO_MEDIA_LOG ("Trying to eject volume");
+
 		/* Cancel any ongoing probing as it
 		 * would prevent the door from being
 		 * opened. */
diff --git a/libbrasero-media/brasero-gio-operation.c b/libbrasero-media/brasero-gio-operation.c
index 340cfd3..a9ca2c4 100644
--- a/libbrasero-media/brasero-gio-operation.c
+++ b/libbrasero-media/brasero-gio-operation.c
@@ -390,8 +390,10 @@ brasero_gio_operation_eject_volume (GVolume *gvolume,
 {
 	gboolean result;
 
-	if (!g_volume_can_eject (gvolume))
+	if (!g_volume_can_eject (gvolume)) {
+		BRASERO_MEDIA_LOG ("GVolume cannot be ejected");
 		return FALSE;
+	}
 
 	if (wait) {
 		gulong eject_sig;



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