brasero r1589 - in trunk: . src



Author: philippr
Date: Sun Nov 30 17:55:09 2008
New Revision: 1589
URL: http://svn.gnome.org/viewvc/brasero?rev=1589&view=rev

Log:
	Allow to recover from error in image creation in disc copy too
	Complement the previous changes

	* src/burn-job.c (brasero_job_check_output_volume_space),
	(brasero_job_set_output_file):
	* src/burn-session.c (brasero_burn_session_get_tmp_dir),
	(brasero_burn_session_get_tmp_file):
	* src/burn.c (brasero_burn_same_src_dest_image):


Modified:
   trunk/ChangeLog
   trunk/src/burn-job.c
   trunk/src/burn-session.c
   trunk/src/burn.c

Modified: trunk/src/burn-job.c
==============================================================================
--- trunk/src/burn-job.c	(original)
+++ trunk/src/burn-job.c	Sun Nov 30 17:55:09 2008
@@ -443,11 +443,6 @@
 	if (!priv->output)
 		return BRASERO_BURN_ERR;
 
-	/* If the plugin is not supposed to output anything, then don't test */
-	brasero_job_get_session_output_size (BRASERO_JOB (self), NULL, &output_size);
-	if (!output_size)
-		return BRASERO_BURN_OK;
-
 	directory = g_path_get_dirname (priv->output->image);
 	file = g_file_new_for_path (directory);
 	g_free (directory);
@@ -465,6 +460,8 @@
 
 	/* Check permissions first */
 	if (!g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
+		BRASERO_JOB_LOG (self, "No permissions");
+
 		g_object_unref (info);
 		g_object_unref (file);
 		g_set_error (error,
@@ -566,6 +563,7 @@
 	BraseroBurnResult result;
 	BraseroJobPrivate *priv;
 	BraseroBurnFlag flags;
+	gint64 output_size = 0;
 	gchar *image = NULL;
 	gchar *toc = NULL;
 
@@ -573,6 +571,12 @@
 
 	/* no next job so we need a file pad */
 	session = brasero_task_ctx_get_session (priv->ctx);
+
+	/* If the plugin is not supposed to output anything, then don't test */
+	brasero_job_get_session_output_size (BRASERO_JOB (self), NULL, &output_size);
+	if (!output_size)
+		return BRASERO_BURN_OK;
+
 	flags = brasero_burn_session_get_flags (session);
 	if (priv->type.type == BRASERO_TRACK_TYPE_IMAGE) {
 		BraseroImageFormat format;

Modified: trunk/src/burn-session.c
==============================================================================
--- trunk/src/burn-session.c	(original)
+++ trunk/src/burn-session.c	Sun Nov 30 17:55:09 2008
@@ -714,6 +714,7 @@
 	if (*path == NULL) {
                 int errsv = errno;
 
+		BRASERO_BURN_LOG ("Impossible to create tmp directory");
 		g_free (tmp);
 		if (errsv != EACCES)
 			g_set_error (error, 
@@ -771,6 +772,7 @@
                 int errsv = errno;
 
 		g_free (tmp);
+		BRASERO_BURN_LOG ("Impossible to create tmp file");
 		if (errsv != EACCES)
 			g_set_error (error, 
 				     BRASERO_BURN_ERROR,

Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c	(original)
+++ trunk/src/burn.c	Sun Nov 30 17:55:09 2008
@@ -2342,6 +2342,7 @@
 	gchar *image = NULL;
 	BraseroTrack *track;
 	BraseroTrackType output;
+	GError *ret_error = NULL;
 	BraseroBurnResult result;
 	BraseroBurnPrivate *priv;
 	BraseroImageFormat format;
@@ -2377,9 +2378,48 @@
 						     format,
 						     &image,
 						     &toc,
-						     error);
-	if (result != BRASERO_BURN_OK)
-		return result;
+						     &ret_error);
+	while (result != BRASERO_BURN_OK) {
+		gboolean is_temp;
+
+		if (!ret_error
+		||  (ret_error->code != BRASERO_BURN_ERROR_DISK_SPACE
+		&&   ret_error->code != BRASERO_BURN_ERROR_PERMISSION)) {
+			g_propagate_error (error, ret_error);
+			return result;
+		}
+
+		/* That's an imager (outputs an image to the disc) so that means
+		 * that here the problem comes from the hard drive being too
+		 * small or we don't have the right permission. */
+
+		/* NOTE: Image file creation is always the last to take place 
+		 * when it's not temporary. Another job should not take place
+		 * afterwards */
+		if (!brasero_burn_session_is_dest_file (priv->session))
+			is_temp = TRUE;
+		else
+			is_temp = FALSE;
+
+		result = brasero_burn_ask_for_location (self,
+							ret_error,
+							is_temp,
+							error);
+
+		/* clean the error anyway since at worst the user will cancel */
+		g_error_free (ret_error);
+		ret_error = NULL;
+
+		if (result != BRASERO_BURN_OK)
+			return result;
+
+		/* retry */
+		result = brasero_burn_session_get_tmp_image (priv->session,
+							     format,
+							     &image,
+							     &toc,
+							     &ret_error);
+	}
 
 	/* some, like cdrdao, can't overwrite the files */
 	g_remove (image);



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