[brasero] When copying a disc make sure very early that the newly inserted disc is big enough



commit 951c40c72ab2dc41d4688cd0194e8c4c895bc5dc
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sat Sep 5 15:49:39 2009 +0200

    When copying a disc make sure very early that the newly inserted disc is big enough

 libbrasero-burn/brasero-burn.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index 60a9ff3..390f45f 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -872,6 +872,29 @@ brasero_burn_lock_dest_media (BraseroBurn *burn,
 	brasero_burn_session_get_input_type (priv->session, input);
 	flags = brasero_burn_session_get_flags (priv->session);
 
+	if (brasero_track_type_get_has_image (input)) {
+		goffset medium_sec = 0;
+		goffset session_sec = 0;
+
+		/* This test is only valid when it's an image
+		 * as input which comes handy when copying
+		 * from the same drive as we're sure we do 
+		 * have an image. */
+		brasero_medium_get_capacity (medium,
+		                             NULL,
+		                             &medium_sec);
+		brasero_burn_session_get_size (priv->session,
+		                               &session_sec,
+		                               NULL);
+
+		if (session_sec > medium_sec) {
+			BRASERO_BURN_LOG ("Not enough space for image %"G_GOFFSET_FORMAT"/%"G_GOFFSET_FORMAT);
+			berror = BRASERO_BURN_ERROR_MEDIUM_SPACE;
+			result = BRASERO_BURN_NEED_RELOAD;
+			goto end;
+		}
+	}
+
 	if (must_blank) {
 		/* There is an error if APPEND was set since this disc is not
 		 * supported without a prior blanking. */



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