brasero r1363 - trunk/src



Author: philippr
Date: Fri Oct 10 17:51:24 2008
New Revision: 1363
URL: http://svn.gnome.org/viewvc/brasero?rev=1363&view=rev

Log:
Forgotten files

Added:
   trunk/src/burn-media.c
   trunk/src/burn-media.h
Modified:
   trunk/src/burn-job.c
   trunk/src/burn-session.c

Modified: trunk/src/burn-job.c
==============================================================================
--- trunk/src/burn-job.c	(original)
+++ trunk/src/burn-job.c	Fri Oct 10 17:51:24 2008
@@ -546,24 +546,83 @@
 
 		/* check if that's the last task */
 		format = brasero_burn_session_get_output_format (session);
-		if (priv->type.subtype.img_format == format)
+		if (priv->type.subtype.img_format == format) {
+			BraseroTrackType input = { 0, };
+
 			result = brasero_burn_session_get_output (session,
 								  &image,
 								  &toc,
 								  error);
-		else
+
+			/* check paths are set */
+			if (!image
+			|| (priv->type.subtype.img_format != BRASERO_IMAGE_FORMAT_BIN && !toc)) {
+				g_set_error (error,
+					     BRASERO_BURN_ERROR,
+					     BRASERO_BURN_ERROR_GENERAL,
+					     _("no path"));
+				return BRASERO_BURN_ERR;
+			}
+
+			brasero_burn_session_get_input_type (session,
+							     &input);
+
+			/* if input is the same as output, then that's a
+			 * processing task and there's no need to check if the
+			 * output already exists since it will (but that's OK) */
+			if (input.type == BRASERO_TRACK_TYPE_IMAGE
+			&&  input.subtype.img_format == priv->type.subtype.img_format) {
+				BRASERO_BURN_LOG ("Processing task, skipping check size");
+				priv->output = g_new0 (BraseroJobOutput, 1);
+				priv->output->image = image;
+				priv->output->toc = toc;
+				return BRASERO_BURN_OK;
+			}
+
+			/* There must be an image at least */
+			if ((flags & BRASERO_BURN_FLAG_DONT_OVERWRITE)
+			&&   g_file_test (image, G_FILE_TEST_EXISTS)) {
+				BRASERO_BURN_LOG ("Problem with image existence");
+				g_set_error (error,
+					     BRASERO_BURN_ERROR,
+					     BRASERO_BURN_ERROR_GENERAL,
+					     _("%s already exists"),
+					     image);
+				g_free (toc);
+				g_free (image);
+				return BRASERO_BURN_ERR;
+			}
+
+			if (priv->type.subtype.img_format != BRASERO_IMAGE_FORMAT_BIN) {
+				/* There must a toc file in this case */
+				if ((flags & BRASERO_BURN_FLAG_DONT_OVERWRITE)
+				&&   g_file_test (toc, G_FILE_TEST_EXISTS)) {
+					BRASERO_BURN_LOG ("Problem with toc existence");
+					g_set_error (error,
+						     BRASERO_BURN_ERROR,
+						     BRASERO_BURN_ERROR_GENERAL,
+						     _("%s already exists"),
+						     toc);
+					g_free (toc);
+					g_free (image);
+					return BRASERO_BURN_ERR;
+				}
+			}
+		}
+		else {
+			/* NOTE: no need to check for the existence here */
 			result = brasero_burn_session_get_tmp_image (session,
 								     priv->type.subtype.img_format,
 								     &image,
 								     &toc,
 								     error);
-
-		if (result != BRASERO_BURN_OK)
-			return result;
+			if (result != BRASERO_BURN_OK)
+				return result;
+		}
 
 		BRASERO_JOB_LOG (self, "output set (IMAGE) image = %s toc = %s",
 				 image,
-		    toc ? toc : "nil");
+				 toc ? toc : "nil");
 	}
 	else if (priv->type.type == BRASERO_TRACK_TYPE_AUDIO) {
 		/* NOTE: this one can only a temporary file */
@@ -571,8 +630,7 @@
 							    ".cdr",
 							    &image,
 							    error);
-		BRASERO_JOB_LOG (self, "Output set (AUDIO) image = %s",
-				 image);
+		BRASERO_JOB_LOG (self, "Output set (AUDIO) image = %s", image);
 	}
 	else /* other types don't need an output */
 		return BRASERO_BURN_OK;

Added: trunk/src/burn-media.c
==============================================================================
--- (empty file)
+++ trunk/src/burn-media.c	Fri Oct 10 17:51:24 2008
@@ -0,0 +1,270 @@
+/***************************************************************************
+ *            burn-media.c
+ *
+ *  Wed Oct  8 16:40:48 2008
+ *  Copyright  2008  ykw
+ *  <ykw localhost localdomain>
+ ****************************************************************************/
+
+/*
+ *  Brasero is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Brasero is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <glib.h>
+
+#include "burn-media.h"
+
+static GSList *
+brasero_media_add_to_list (GSList *retval,
+			   BraseroMedia media)
+{
+	retval = g_slist_prepend (retval, GINT_TO_POINTER (media));
+	return retval;
+}
+
+static GSList *
+brasero_media_new_status (GSList *retval,
+			  BraseroMedia media,
+			  BraseroMedia type)
+{
+	if ((type & BRASERO_MEDIUM_BLANK)
+	&& !(media & BRASERO_MEDIUM_ROM)) {
+		/* If media is blank there is no other possible property.
+		 * BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED)
+		 * condition is checked but in fact it's never valid since
+		 * such a medium cannot exist if it hasn't been formatted before
+		 * which is in contradiction with the fact is unformatted. */
+		if (BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS)
+		||  BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED)
+		||  BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW)
+		||  BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS_DL)) {
+			/* This is only for above types */
+			retval = brasero_media_add_to_list (retval,
+							    media|
+							    BRASERO_MEDIUM_BLANK);
+			if (type & BRASERO_MEDIUM_UNFORMATTED)
+				retval = brasero_media_add_to_list (retval,
+								    media|
+								    BRASERO_MEDIUM_BLANK|
+								    BRASERO_MEDIUM_UNFORMATTED);
+		}
+		else
+			retval = brasero_media_add_to_list (retval,
+							    media|
+							    BRASERO_MEDIUM_BLANK);
+	}
+
+	if (type & BRASERO_MEDIUM_CLOSED) {
+		if (media & (BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_DVD_DL))
+			retval = brasero_media_add_to_list (retval,
+							    media|
+							    BRASERO_MEDIUM_CLOSED|
+							    (type & BRASERO_MEDIUM_HAS_DATA)|
+							    (type & BRASERO_MEDIUM_PROTECTED));
+		else {
+			if (type & BRASERO_MEDIUM_HAS_AUDIO)
+				retval = brasero_media_add_to_list (retval,
+								    media|
+								    BRASERO_MEDIUM_CLOSED|
+								    BRASERO_MEDIUM_HAS_AUDIO);
+			if (type & BRASERO_MEDIUM_HAS_DATA)
+				retval = brasero_media_add_to_list (retval,
+								    media|
+								    BRASERO_MEDIUM_CLOSED|
+								    BRASERO_MEDIUM_HAS_DATA);
+			if (BRASERO_MEDIUM_IS (type, BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA))
+				retval = brasero_media_add_to_list (retval,
+								    media|
+								    BRASERO_MEDIUM_CLOSED|
+								    BRASERO_MEDIUM_HAS_DATA|
+								    BRASERO_MEDIUM_HAS_AUDIO);
+		}
+	}
+
+	if ((type & BRASERO_MEDIUM_APPENDABLE)
+	&& !(media & BRASERO_MEDIUM_ROM)
+	&& !(media & BRASERO_MEDIUM_RESTRICTED)
+	&& ! BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVD|BRASERO_MEDIUM_PLUS|BRASERO_MEDIUM_REWRITABLE)
+	&& ! BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVD_DL|BRASERO_MEDIUM_PLUS|BRASERO_MEDIUM_REWRITABLE)) {
+		if (media & BRASERO_MEDIUM_DVD)
+			retval = brasero_media_add_to_list (retval,
+							    media|
+							    BRASERO_MEDIUM_APPENDABLE|
+							    BRASERO_MEDIUM_HAS_DATA);
+		else {
+			if (type & BRASERO_MEDIUM_HAS_AUDIO)
+				retval = brasero_media_add_to_list (retval,
+								    media|
+								    BRASERO_MEDIUM_APPENDABLE|
+								    BRASERO_MEDIUM_HAS_AUDIO);
+			if (type & BRASERO_MEDIUM_HAS_DATA)
+				retval = brasero_media_add_to_list (retval,
+								    media|
+								    BRASERO_MEDIUM_APPENDABLE|
+								    BRASERO_MEDIUM_HAS_DATA);
+			if (BRASERO_MEDIUM_IS (type, BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA))
+				retval = brasero_media_add_to_list (retval,
+								    media|
+								    BRASERO_MEDIUM_HAS_DATA|
+								    BRASERO_MEDIUM_APPENDABLE|
+								    BRASERO_MEDIUM_HAS_AUDIO);
+		}
+	}
+
+	return retval;
+}
+
+static GSList *
+brasero_media_new_attribute (GSList *retval,
+			     BraseroMedia media,
+			     BraseroMedia type)
+{
+	if (type & BRASERO_MEDIUM_REWRITABLE) {
+		/* Always true for + media there are both single and dual layer */
+		if (media & BRASERO_MEDIUM_PLUS)
+			retval = brasero_media_new_status (retval,
+							   media|BRASERO_MEDIUM_REWRITABLE,
+							   type);
+		/* There is no dual layer DVD-RW */
+		else if (!(media & BRASERO_MEDIUM_DVD_DL))
+			retval = brasero_media_new_status (retval,
+							   media|BRASERO_MEDIUM_REWRITABLE,
+							   type);
+	}
+
+	if ((type & BRASERO_MEDIUM_WRITABLE)
+	&& !(media & BRASERO_MEDIUM_RESTRICTED))
+		retval = brasero_media_new_status (retval,
+						   media|BRASERO_MEDIUM_WRITABLE,
+						   type);
+
+	if (type & BRASERO_MEDIUM_ROM)
+		retval = brasero_media_new_status (retval,
+						   media|BRASERO_MEDIUM_ROM,
+						   type);
+
+	return retval;
+}
+
+static GSList *
+brasero_media_new_subtype (GSList *retval,
+			   BraseroMedia media,
+			   BraseroMedia type)
+{
+	if (media & BRASERO_MEDIUM_BD) {
+		if (type & BRASERO_MEDIUM_RANDOM)
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_RANDOM,
+							      type);
+		if (type & BRASERO_MEDIUM_SRM)
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_SRM,
+							      type);
+		if (type & BRASERO_MEDIUM_POW)
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_POW,
+							      type);
+	}
+
+	if (media & BRASERO_MEDIUM_DVD) {
+		if (type & BRASERO_MEDIUM_SEQUENTIAL)
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_SEQUENTIAL,
+							      type);
+
+		if (type & BRASERO_MEDIUM_RESTRICTED)
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_RESTRICTED,
+							      type);
+
+		if (type & BRASERO_MEDIUM_PLUS)
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_PLUS,
+							      type);
+		if (type & BRASERO_MEDIUM_ROM)
+			retval = brasero_media_new_status (retval,
+							   media|BRASERO_MEDIUM_ROM,
+							   type);
+	}
+
+	if (media & BRASERO_MEDIUM_DVD_DL) {
+		/* There is no such thing as DVD-RW DL */
+		if ((type & BRASERO_MEDIUM_SEQUENTIAL) && !(type & BRASERO_MEDIUM_REWRITABLE))
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_SEQUENTIAL,
+							      type);
+
+		if ((type & BRASERO_MEDIUM_JUMP) && !(type & BRASERO_MEDIUM_REWRITABLE))
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_JUMP,
+							      type);
+
+		if (type & BRASERO_MEDIUM_PLUS)
+			retval = brasero_media_new_attribute (retval,
+							      media|BRASERO_MEDIUM_PLUS,
+							      type);
+
+		if (type & BRASERO_MEDIUM_ROM)
+			retval = brasero_media_new_status (retval,
+							   media|BRASERO_MEDIUM_ROM,
+							   type);
+	}
+
+	return retval;
+}
+
+GSList *
+brasero_media_get_all_list (BraseroMedia type)
+{
+	GSList *retval = NULL;
+
+	if (type & BRASERO_MEDIUM_FILE)
+		retval = brasero_media_add_to_list (retval, BRASERO_MEDIUM_FILE);					       
+
+	if (type & BRASERO_MEDIUM_CD)
+		retval = brasero_media_new_attribute (retval,
+						      BRASERO_MEDIUM_CD,
+						      type);
+
+	if (type & BRASERO_MEDIUM_DVD)
+		retval = brasero_media_new_subtype (retval,
+						    BRASERO_MEDIUM_DVD,
+						    type);
+
+	if (type & BRASERO_MEDIUM_DVD_DL)
+		retval = brasero_media_new_subtype (retval,
+						    BRASERO_MEDIUM_DVD_DL,
+						    type);
+
+	/* RAM media are always rewritable */
+	if (type & BRASERO_MEDIUM_RAM)
+		retval = brasero_media_new_status (retval,
+						   BRASERO_MEDIUM_RAM|
+						   BRASERO_MEDIUM_REWRITABLE,
+						   type);
+
+	if (type & BRASERO_MEDIUM_BD)
+		retval = brasero_media_new_subtype (retval,
+						    BRASERO_MEDIUM_BD,
+						    type);
+
+	return retval;
+}

Added: trunk/src/burn-media.h
==============================================================================
--- (empty file)
+++ trunk/src/burn-media.h	Fri Oct 10 17:51:24 2008
@@ -0,0 +1,169 @@
+/***************************************************************************
+ *            burn-media.h
+ *
+ *  Wed Oct  8 16:42:17 2008
+ *  Copyright  2008  ykw
+ *  <ykw localhost localdomain>
+ ****************************************************************************/
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+ 
+#ifndef _BURN_MEDIA_H
+#define _BURN_MEDIA_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+	BRASERO_MEDIUM_UNSUPPORTED		= -2,
+	BRASERO_MEDIUM_BUSY			= -1,
+	BRASERO_MEDIUM_NONE			= 0,
+
+	/* types */
+	BRASERO_MEDIUM_FILE			= 1,
+
+	BRASERO_MEDIUM_CD			= 1 << 1,
+
+	BRASERO_MEDIUM_DVD			= 1 << 2,
+
+	BRASERO_MEDIUM_DVD_DL			= 1 << 3,
+
+	BRASERO_MEDIUM_RAM			= 1 << 4,
+
+	BRASERO_MEDIUM_BD			= 1 << 5,
+
+	/* DVD and DVD DL subtypes */
+	BRASERO_MEDIUM_PLUS			= 1 << 6,
+	BRASERO_MEDIUM_SEQUENTIAL		= 1 << 7,
+	BRASERO_MEDIUM_RESTRICTED		= 1 << 8,	/* DVD only */
+
+	/* DVD dual layer only subtype */
+	BRASERO_MEDIUM_JUMP			= 1 << 9,
+
+	/* BD subtypes */
+	BRASERO_MEDIUM_RANDOM			= 1 << 10,
+	BRASERO_MEDIUM_SRM			= 1 << 11,
+	BRASERO_MEDIUM_POW			= 1 << 12,	/* This is Pseudo OverWrite */
+
+	/* discs attributes */
+	BRASERO_MEDIUM_REWRITABLE		= 1 << 14,
+	BRASERO_MEDIUM_WRITABLE			= 1 << 15,
+	BRASERO_MEDIUM_ROM			= 1 << 16,
+
+	/* status of the disc */
+	BRASERO_MEDIUM_BLANK			= 1 << 17,
+	BRASERO_MEDIUM_CLOSED			= 1 << 18,
+	BRASERO_MEDIUM_APPENDABLE		= 1 << 19,
+
+	/* Only used for DVD+RW, DVD-RW restricted */
+	BRASERO_MEDIUM_UNFORMATTED		= 1 << 20,
+
+	BRASERO_MEDIUM_PROTECTED		= 1 << 21,
+	BRASERO_MEDIUM_HAS_DATA			= 1 << 22,
+	BRASERO_MEDIUM_HAS_AUDIO		= 1 << 23,
+} BraseroMedia;
+
+#define BRASERO_MEDIUM_CDROM		(BRASERO_MEDIUM_CD|		\
+					 BRASERO_MEDIUM_ROM)
+#define BRASERO_MEDIUM_CDR		(BRASERO_MEDIUM_CD|		\
+					 BRASERO_MEDIUM_WRITABLE)
+#define BRASERO_MEDIUM_CDRW		(BRASERO_MEDIUM_CD|		\
+					 BRASERO_MEDIUM_REWRITABLE)
+#define BRASERO_MEDIUM_DVD_ROM		(BRASERO_MEDIUM_DVD|		\
+					 BRASERO_MEDIUM_ROM)
+#define BRASERO_MEDIUM_DVDR		(BRASERO_MEDIUM_DVD|		\
+					 BRASERO_MEDIUM_SEQUENTIAL|	\
+					 BRASERO_MEDIUM_WRITABLE)
+#define BRASERO_MEDIUM_DVDRW		(BRASERO_MEDIUM_DVD|		\
+					 BRASERO_MEDIUM_SEQUENTIAL|	\
+					 BRASERO_MEDIUM_REWRITABLE)
+#define BRASERO_MEDIUM_DVDRW_RESTRICTED	(BRASERO_MEDIUM_DVD|		\
+					 BRASERO_MEDIUM_REWRITABLE|	\
+					 BRASERO_MEDIUM_RESTRICTED)
+#define BRASERO_MEDIUM_DVDR_DL		(BRASERO_MEDIUM_DVD_DL|		\
+					 BRASERO_MEDIUM_WRITABLE|	\
+					 BRASERO_MEDIUM_SEQUENTIAL)
+#define BRASERO_MEDIUM_DVDR_JUMP_DL	(BRASERO_MEDIUM_DVD_DL|		\
+					 BRASERO_MEDIUM_WRITABLE|	\
+					 BRASERO_MEDIUM_JUMP)
+#define BRASERO_MEDIUM_DVDR_PLUS	(BRASERO_MEDIUM_DVD|		\
+					 BRASERO_MEDIUM_WRITABLE|	\
+					 BRASERO_MEDIUM_PLUS)
+#define BRASERO_MEDIUM_DVDRW_PLUS	(BRASERO_MEDIUM_DVD|		\
+					 BRASERO_MEDIUM_REWRITABLE|	\
+					 BRASERO_MEDIUM_PLUS)
+#define BRASERO_MEDIUM_DVDR_PLUS_DL	(BRASERO_MEDIUM_DVD_DL|		\
+					 BRASERO_MEDIUM_WRITABLE|	\
+					 BRASERO_MEDIUM_PLUS)
+#define BRASERO_MEDIUM_DVDRW_PLUS_DL	(BRASERO_MEDIUM_DVD_DL|		\
+					 BRASERO_MEDIUM_REWRITABLE|	\
+					 BRASERO_MEDIUM_PLUS)
+
+#define BRASERO_MEDIUM_DVD_RAM		(BRASERO_MEDIUM_DVD|		\
+					 BRASERO_MEDIUM_RAM)
+
+/* BD types all exist in BD-R(E) DL as well */
+#define BRASERO_MEDIUM_BD_ROM		(BRASERO_MEDIUM_BD|		\
+					 BRASERO_MEDIUM_ROM)
+#define BRASERO_MEDIUM_BDR_SRM		(BRASERO_MEDIUM_BD|		\
+					 BRASERO_MEDIUM_SRM|		\
+					 BRASERO_MEDIUM_WRITABLE)
+#define BRASERO_MEDIUM_BDR_SRM_POW	(BRASERO_MEDIUM_BD|		\
+					 BRASERO_MEDIUM_POW|		\
+					 BRASERO_MEDIUM_SRM|		\
+					 BRASERO_MEDIUM_WRITABLE)
+
+/* This seems to be a really rare mode for BD-R */
+#define BRASERO_MEDIUM_BDR_RANDOM	(BRASERO_MEDIUM_BD|		\
+					 BRASERO_MEDIUM_WRITABLE|	\
+					 BRASERO_MEDIUM_RANDOM)
+/* This is always RANDOM write */
+#define BRASERO_MEDIUM_BDRE		(BRASERO_MEDIUM_BD|		\
+					 BRASERO_MEDIUM_REWRITABLE)
+
+
+
+#define BRASERO_MEDIUM_VALID(media)	((media) != BRASERO_MEDIUM_NONE	&&	\
+					 (media) != BRASERO_MEDIUM_BUSY	&&	\
+					 (media) != BRASERO_MEDIUM_UNSUPPORTED)
+
+
+#define BRASERO_MEDIUM_TYPE(media)	((media) & 0x003F)
+#define BRASERO_MEDIUM_ATTR(media)	((media) & 0x1C000)
+#define BRASERO_MEDIUM_STATUS(media)	((media) & 0xE0000)
+#define BRASERO_MEDIUM_SUBTYPE(media)	((media) & 0x1FC0)
+#define BRASERO_MEDIUM_INFO(media)	((media) & 0xFE0000)
+
+#define BRASERO_MEDIUM_IS(media, type)	(((media)&(type))==(type))
+
+#define BRASERO_MEDIUM_RANDOM_WRITABLE(media)					\
+	(BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_PLUS) ||		\
+	 BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVDRW_RESTRICTED) ||		\
+	 BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_DVD_RAM) || 			\
+	 BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_BDR_RANDOM) ||		\
+	 BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_BDR_SRM_POW) ||		\
+	 BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_BDRE))
+
+GSList *
+brasero_media_get_all_list (BraseroMedia type);
+
+G_END_DECLS
+
+#endif /* _BURN_MEDIA_H */
+
+ 

Modified: trunk/src/burn-session.c
==============================================================================
--- trunk/src/burn-session.c	(original)
+++ trunk/src/burn-session.c	Fri Oct 10 17:51:24 2008
@@ -532,7 +532,7 @@
 	priv = BRASERO_BURN_SESSION_PRIVATE (self);
 
 	if (format == BRASERO_IMAGE_FORMAT_CLONE)
-			retval = g_strdup_printf ("%s.toc", path);
+		retval = g_strdup_printf ("%s.toc", path);
 	else if (format == BRASERO_IMAGE_FORMAT_CUE) {
 		if (g_str_has_suffix (path, ".bin"))
 			retval = g_strdup_printf ("%.*scue",
@@ -556,38 +556,6 @@
 }
 
 static BraseroBurnResult
-brasero_burn_session_file_test (BraseroBurnSession *self,
-				const gchar *path,
-				GError **error)
-{
-	BraseroBurnSessionPrivate *priv;
-
-	priv = BRASERO_BURN_SESSION_PRIVATE (self);
-
-	if (!path) {
-		g_set_error (error,
-			     BRASERO_BURN_ERROR,
-			     BRASERO_BURN_ERROR_GENERAL,
-			     _("no path"));
-		return BRASERO_BURN_ERR;
-	}
-
-	if (!g_file_test (path, G_FILE_TEST_EXISTS))
-		return BRASERO_BURN_OK;
-	
-	if (priv->settings->flags & BRASERO_BURN_FLAG_DONT_OVERWRITE) {
-		g_set_error (error,
-			     BRASERO_BURN_ERROR,
-			     BRASERO_BURN_ERROR_GENERAL,
-			     _("%s already exists"),
-			     path);
-		return BRASERO_BURN_ERR;
-	}
-
-	return BRASERO_BURN_OK;
-}
-
-static BraseroBurnResult
 brasero_burn_session_set_image_output_retval (BraseroBurnSession *self,
 					      BraseroImageFormat format,
 					      gchar **image,
@@ -676,23 +644,8 @@
 		return BRASERO_BURN_ERR;
 
 	if (image_ret) {
-		BraseroBurnResult result;
-
 		/* output paths were set so test them and returns them if OK */
-		if (image) {
-			result = brasero_burn_session_file_test (self,
-								 image,
-								 error);
-			if (result != BRASERO_BURN_OK) {
-				BRASERO_BURN_LOG ("Problem with image existence");
-				g_free (image);
-				g_free (toc);
-				return result;
-			}
-
-			*image_ret = image;
-		}
-		else if (toc) {
+		if (!image && toc) {
 			gchar *complement;
 			BraseroImageFormat format;
 
@@ -711,18 +664,10 @@
 				return BRASERO_BURN_ERR;
 			}
 
-			result = brasero_burn_session_file_test (self,
-								 complement,
-								 error);
-			if (result != BRASERO_BURN_OK) {
-				BRASERO_BURN_LOG ("Problem with image existence");
-				g_free (complement);
-				g_free (toc);
-				return result;
-			}
-
 			*image_ret = complement;
 		}
+		else if (image)
+			*image_ret = image;
 		else {
 			BRASERO_BURN_LOG ("no output specified");
 
@@ -736,21 +681,8 @@
 	else
 		g_free (image);
 
-	if (toc_ret) {
-		if (toc) {
-			BraseroBurnResult result;
-
-			result = brasero_burn_session_file_test (self,
-								 toc,
-								 error);
-			if (result != BRASERO_BURN_OK) {
-				BRASERO_BURN_LOG ("Problem with toc existence");
-				return result;
-			}
-		}
-
+	if (toc_ret)
 		*toc_ret = toc;
-	}
 	else
 		g_free (toc);
 
@@ -990,7 +922,10 @@
 	priv = BRASERO_BURN_SESSION_PRIVATE (self);
 
 	/* Image tmp file */
-	result = brasero_burn_session_get_tmp_file (self, NULL, &path, error);
+	result = brasero_burn_session_get_tmp_file (self,
+						    NULL,
+						    &path,
+						    error);
 	if (result != BRASERO_BURN_OK)
 		return result;
 
@@ -998,10 +933,8 @@
 		/* toc tmp file */
 		complement = brasero_burn_session_get_image_complement (self, format, path);
 		if (complement) {
-			result = brasero_burn_session_file_test (self,
-								 complement,
-								 error);
-			if (result != BRASERO_BURN_OK) {
+			/* That shouldn't happen ... */
+			if (g_file_test (path, G_FILE_TEST_EXISTS)) {
 				g_free (complement);
 				return result;
 			}
@@ -1764,10 +1697,14 @@
 	if (!path)
 		return TRUE;
 
-	if (g_file_test (path, G_FILE_TEST_IS_DIR))
+	BRASERO_BURN_LOG ("Cleaning %s", path);
+
+	/* NOTE: g_file_test follows symbolic links */
+	if (g_file_test (path, G_FILE_TEST_IS_DIR)
+	&& !g_file_test (path, G_FILE_TEST_IS_SYMLINK))
 		brasero_burn_session_clean_directory (path);
 
-	/* NOTE : we don't follow uris as certain files are simply linked by content-data */
+	/* NOTE : we don't follow paths as certain files are simply linked */
 	if (g_remove (path)) {
 		BRASERO_BURN_LOG ("Cannot remove file %s", path);
 		result = FALSE;



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