[brasero/gnome-2-28] Don't tell the user we are blanking formatting (which we actually are) his disc when we start record



commit 7b718b42d225852800b5e3cbf1edc063c55fce4e
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Fri Oct 2 22:22:38 2009 +0200

    Don't tell the user we are blanking formatting (which we actually are) his disc when we start recording a DVD+RW with libburn to avoid scaring him

 plugins/libburnia/burn-libburn-common.c |   14 ++++++++++++--
 plugins/libburnia/burn-libburn-common.h |    6 ++++--
 plugins/libburnia/burn-libburn.c        |   10 ++++++++--
 plugins/libburnia/burn-libisofs.c       |    2 +-
 4 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/plugins/libburnia/burn-libburn-common.c b/plugins/libburnia/burn-libburn-common.c
index 097696c..3ceaa48 100644
--- a/plugins/libburnia/burn-libburn-common.c
+++ b/plugins/libburnia/burn-libburn-common.c
@@ -142,6 +142,7 @@ brasero_libburn_common_ctx_free (BraseroLibburnCtx *ctx)
 
 BraseroLibburnCtx *
 brasero_libburn_common_ctx_new (BraseroJob *job,
+                                gboolean is_burning,
 				GError **error)
 {
 	gchar libburn_device [BURN_DRIVE_ADR_LEN];
@@ -174,6 +175,7 @@ brasero_libburn_common_ctx_new (BraseroJob *job,
 	}
 
 	ctx = g_new0 (BraseroLibburnCtx, 1);
+	ctx->is_burning = is_burning;
 	res = burn_drive_scan_and_grab (&ctx->drive_info, libburn_device, 0);
 	BRASERO_JOB_LOG (job, "Drive (%s) init result = %d", libburn_device, res);
 	if (res <= 0) {
@@ -274,8 +276,16 @@ brasero_libburn_common_status_changed (BraseroJob *self,
 		case BURN_DRIVE_ERASING:
 		case BURN_DRIVE_FORMATTING:
 			BRASERO_JOB_LOG (self, "Blanking/Formatting");
-			action = BRASERO_BURN_ACTION_BLANKING;
-			brasero_job_set_dangerous (BRASERO_JOB (self), TRUE);
+			if (!ctx->is_burning) {
+				action = BRASERO_BURN_ACTION_BLANKING;
+				brasero_job_set_dangerous (BRASERO_JOB (self), TRUE);
+			}
+			else {
+				/* DVD+RW need a preformatting before being written.
+				 * Adapt the message to "start recording". */
+				action = BRASERO_BURN_ACTION_START_RECORDING;
+				brasero_job_set_dangerous (BRASERO_JOB (self), FALSE);
+			}
 			break;
 
 		case BURN_DRIVE_IDLE:
diff --git a/plugins/libburnia/burn-libburn-common.h b/plugins/libburnia/burn-libburn-common.h
index 5f3d2cd..41a2968 100644
--- a/plugins/libburnia/burn-libburn-common.h
+++ b/plugins/libburnia/burn-libburn-common.h
@@ -55,14 +55,16 @@ struct _BraseroLibburnCtx {
 	gint64 cur_sector;
 	gint64 track_sectors;
 
-	gint has_leadin;
-
 	GTimer *op_start;
+
+	guint is_burning:1;
+	guint has_leadin:1;
 };
 typedef struct _BraseroLibburnCtx BraseroLibburnCtx;
 
 BraseroLibburnCtx *
 brasero_libburn_common_ctx_new (BraseroJob *job,
+                                gboolean is_burning,
 				GError **error);
 
 void
diff --git a/plugins/libburnia/burn-libburn.c b/plugins/libburnia/burn-libburn.c
index fa1ff67..788e4ce 100644
--- a/plugins/libburnia/burn-libburn.c
+++ b/plugins/libburnia/burn-libburn.c
@@ -733,7 +733,13 @@ brasero_libburn_start (BraseroJob *job,
 	if (action == BRASERO_JOB_ACTION_RECORD) {
 		GError *ret_error = NULL;
 
-		priv->ctx = brasero_libburn_common_ctx_new (job, &ret_error);
+		/* TRUE is a context that helps to adapt action
+		 * messages like for DVD+RW which need a
+		 * pre-formatting before actually writing
+		 * and without this we would not know if
+		 * we are actually formatting or just pre-
+		 * formatting == starting to record */
+		priv->ctx = brasero_libburn_common_ctx_new (job, TRUE, &ret_error);
 		if (!priv->ctx) {
 			if (ret_error && ret_error->code == BRASERO_BURN_ERROR_DRIVE_BUSY) {
 				g_propagate_error (error, ret_error);
@@ -757,7 +763,7 @@ brasero_libburn_start (BraseroJob *job,
 	else if (action == BRASERO_JOB_ACTION_ERASE) {
 		GError *ret_error = NULL;
 
-		priv->ctx = brasero_libburn_common_ctx_new (job, &ret_error);
+		priv->ctx = brasero_libburn_common_ctx_new (job, FALSE, &ret_error);
 		if (!priv->ctx) {
 			if (ret_error && ret_error->code == BRASERO_BURN_ERROR_DRIVE_BUSY) {
 				g_propagate_error (error, ret_error);
diff --git a/plugins/libburnia/burn-libisofs.c b/plugins/libburnia/burn-libisofs.c
index b6715c3..af7a8a8 100644
--- a/plugins/libburnia/burn-libisofs.c
+++ b/plugins/libburnia/burn-libisofs.c
@@ -449,7 +449,7 @@ brasero_libisofs_import_last_session (BraseroLibisofs *self,
 
 	priv = BRASERO_LIBISOFS_PRIVATE (self);
 
-	priv->ctx = brasero_libburn_common_ctx_new (BRASERO_JOB (self), error);
+	priv->ctx = brasero_libburn_common_ctx_new (BRASERO_JOB (self), FALSE, error);
 	if (!priv->ctx)
 		return BRASERO_BURN_ERR;
 



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