[brasero/gnome-2-28] Don't blank before when the user asked to merge



commit 086efc7f489a8717d126606facf78afb66d734ac
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Fri Sep 25 22:36:06 2009 +0200

    Don't blank before when the user asked to merge

 libbrasero-burn/brasero-caps-session.c |   52 ++++++++++++++++++++-----------
 libbrasero-burn/brasero-session-cfg.c  |    2 +-
 plugins/cdrtools/burn-cdrecord.c       |    2 +-
 3 files changed, 35 insertions(+), 21 deletions(-)
---
diff --git a/libbrasero-burn/brasero-caps-session.c b/libbrasero-burn/brasero-caps-session.c
index 907e6e1..c40c7ba 100644
--- a/libbrasero-burn/brasero-caps-session.c
+++ b/libbrasero-burn/brasero-caps-session.c
@@ -1488,6 +1488,7 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
 					BraseroBurnFlag *compulsory_flags)
 {
 	BraseroBurnResult result;
+	gboolean can_blank = FALSE;
 
 	/* See if medium is supported out of the box */
 	result = brasero_caps_get_flags_for_disc (self,
@@ -1501,17 +1502,15 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
 	 * - media can be blanked, it has audio or data and we're not merging
 	 * - media is not formatted and it can be blanked/formatted */
 	if (brasero_burn_caps_can_blank_real (self, media, session_flags) == BRASERO_BURN_OK)
-		(*supported_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
+		can_blank = TRUE;
 	else if (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
 		return BRASERO_BURN_NOT_SUPPORTED;
 
-	if (((*supported_flags) & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) != 0) {
+	if (can_blank) {
+		gboolean first_success;
 		BraseroBurnFlag blank_compulsory = BRASERO_BURN_FLAG_NONE;
 		BraseroBurnFlag blank_supported = BRASERO_BURN_FLAG_NONE;
 
-		/* If BLANK flag is supported then MERGE/APPEND can't be compulsory */
-		(*compulsory_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
-
 		/* we reached this point in two cases:
 		 * - if the disc cannot be handled
 		 * - if some flags are not handled
@@ -1531,8 +1530,7 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
 
 		/* result here is the result of the first operation, so if it
 		 * failed, BLANK before becomes compulsory. */
-		if (result != BRASERO_BURN_OK)
-			(*compulsory_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
+		first_success = (result == BRASERO_BURN_OK);
 
 		/* pretends it is blank and formatted to see if it would work.
 		 * If it works then that means that the BLANK_BEFORE_WRITE flag
@@ -1551,18 +1549,34 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
 							  compulsory_flags);
 
 		/* if both attempts failed, drop it */
-		if (result != BRASERO_BURN_OK
-		&& (((*compulsory_flags) & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)))
-			return result;
-
-		/* need to add blanking flags */
-		brasero_burn_caps_get_blanking_flags_real (self,
-							   media,
-							   session_flags,
-							   &blank_supported,
-							   &blank_compulsory);
-		(*supported_flags) |= blank_supported;
-		(*compulsory_flags) |= blank_compulsory;
+		if (result != BRASERO_BURN_OK) {
+			/* See if we entirely failed */
+			if (!first_success)
+				return result;
+
+			/* we tried with a blank medium but did not 
+			 * succeed. So that means the flags BLANK.
+			 * is not supported */
+		}
+		else {
+			(*supported_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
+
+			if (!first_success)
+				(*compulsory_flags) |= BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
+
+			/* If BLANK flag is supported then MERGE/APPEND can't be compulsory */
+			(*compulsory_flags) &= ~(BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND);
+
+			/* need to add blanking flags */
+			brasero_burn_caps_get_blanking_flags_real (self,
+								   media,
+								   session_flags,
+								   &blank_supported,
+								   &blank_compulsory);
+			(*supported_flags) |= blank_supported;
+			(*compulsory_flags) |= blank_compulsory;
+		}
+		
 	}
 	else if (result != BRASERO_BURN_OK)
 		return result;
diff --git a/libbrasero-burn/brasero-session-cfg.c b/libbrasero-burn/brasero-session-cfg.c
index 6050e73..79e2361 100644
--- a/libbrasero-burn/brasero-session-cfg.c
+++ b/libbrasero-burn/brasero-session-cfg.c
@@ -708,7 +708,7 @@ brasero_session_cfg_set_drive_properties_flags (BraseroSessionCfg *self,
 
 	for (flag = BRASERO_BURN_FLAG_EJECT; flag < BRASERO_BURN_FLAG_LAST; flag <<= 1) {
 		/* see if this flag was originally set */
-		if (!(flags & flag))
+		if ((flags & flag) == 0)
 			continue;
 
 		/* Don't set write modes now in this case */
diff --git a/plugins/cdrtools/burn-cdrecord.c b/plugins/cdrtools/burn-cdrecord.c
index d3f8b6b..ee5e108 100644
--- a/plugins/cdrtools/burn-cdrecord.c
+++ b/plugins/cdrtools/burn-cdrecord.c
@@ -1255,7 +1255,7 @@ brasero_cdrecord_export_caps (BraseroPlugin *plugin, gchar **error)
 				  BRASERO_BURN_FLAG_NOGRACE,
 				  BRASERO_BURN_FLAG_NONE);
 
-	/* This is a CDR with data data can be merged or at least appended */
+	/* This is a CDR with data; data can be merged or at least appended */
 	brasero_plugin_set_flags (plugin,
 				  BRASERO_MEDIUM_CD|
 				  BRASERO_MEDIUM_WRITABLE|



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