brasero r1585 - in trunk: . src src/plugins/cdrkit src/plugins/cdrtools src/plugins/checksum src/plugins/libburnia



Author: philippr
Date: Sun Nov 30 16:06:57 2008
New Revision: 1585
URL: http://svn.gnome.org/viewvc/brasero?rev=1585&view=rev

Log:
	Fix #560365 â Image creation breaks when disk is out of space
	and #549119 â no space in /tmp given a not informative error

	Handle temporary location errors and image creation errors by asking
	the user if he wants to set another location.
	We now also detect permission problem (as well as space error) for images.

	Fix some small things in the mean time
	- malformed strings
	- a small bug in burn-job.c not returning correct value on error
	- a small bug in checksum-file plugin that was overwriting errors

	* src/brasero-burn-dialog.c (brasero_burn_dialog_image_error),
	(brasero_burn_dialog_setup_session):
	* src/brasero-data-disc.c (brasero_data_disc_unknown_uri_cb):
	* src/brasero-drive-properties.c
	(brasero_drive_properties_set_tmpdir_info),
	(brasero_drive_properties_init):
	* src/brasero-image-properties.c (brasero_image_properties_init):
	* src/brasero-marshal.list:
	* src/brasero-session-cfg.c (brasero_session_cfg_update):
	* src/brasero-sum-dialog.c (brasero_sum_dialog_download):
	* src/burn-job.c (brasero_job_check_output_volume_space),
	(brasero_job_get_tmp_file):
	* src/burn-session.c (brasero_burn_session_get_tmp_dir),
	(brasero_burn_session_get_tmp_file):
	* src/burn.c (brasero_burn_ask_for_location),
	(brasero_burn_run_imager), (brasero_burn_class_init):
	* src/burn.h:
	* src/plugins/cdrkit/burn-genisoimage.c
	(brasero_genisoimage_read_stderr):
	* src/plugins/cdrtools/burn-mkisofs.c
	(brasero_mkisofs_read_stderr):
	* src/plugins/checksum/burn-checksum-files.c
	(brasero_checksum_files_create_checksum):
	* src/plugins/libburnia/burn-libisofs.c
	(brasero_libisofs_write_image_to_file_thread):

Modified:
   trunk/ChangeLog
   trunk/src/brasero-burn-dialog.c
   trunk/src/brasero-data-disc.c
   trunk/src/brasero-drive-properties.c
   trunk/src/brasero-image-properties.c
   trunk/src/brasero-marshal.list
   trunk/src/brasero-session-cfg.c
   trunk/src/brasero-sum-dialog.c
   trunk/src/burn-job.c
   trunk/src/burn-session.c
   trunk/src/burn.c
   trunk/src/burn.h
   trunk/src/plugins/cdrkit/burn-genisoimage.c
   trunk/src/plugins/cdrtools/burn-mkisofs.c
   trunk/src/plugins/checksum/burn-checksum-files.c
   trunk/src/plugins/libburnia/burn-libisofs.c

Modified: trunk/src/brasero-burn-dialog.c
==============================================================================
--- trunk/src/brasero-burn-dialog.c	(original)
+++ trunk/src/brasero-burn-dialog.c	Sun Nov 30 16:06:57 2008
@@ -616,6 +616,150 @@
 }
 
 static BraseroBurnResult
+brasero_burn_dialog_image_error (BraseroBurn *burn,
+				 GError *error,
+				 gboolean is_temporary,
+				 BraseroBurnDialog *dialog)
+{
+	gint result;
+	gchar *path;
+	gchar *string;
+	GtkWindow *window;
+	GtkWidget *message;
+	gboolean hide = FALSE;
+
+	if (!GTK_WIDGET_VISIBLE (dialog)) {
+		gtk_widget_show (GTK_WIDGET (dialog));
+		hide = TRUE;
+	}
+
+	g_timer_stop (BRASERO_BURN_DIALOG (dialog)->priv->total_time);
+
+	window = GTK_WINDOW (dialog);
+
+	string = g_strdup_printf ("%s. %s",
+				  is_temporary?
+				  _("A file could not be created at the location specified for temporary files"):
+				  _("The image could not be created at the specified location"),
+				  _("Do you want to specify another location for this session or retry with the current location?"));
+
+	message = gtk_message_dialog_new (window,
+					  GTK_DIALOG_DESTROY_WITH_PARENT|
+					  GTK_DIALOG_MODAL,
+					  GTK_MESSAGE_ERROR,
+					  GTK_BUTTONS_NONE,
+					  string);
+	g_free (string);
+
+	if (error && error->code == BRASERO_BURN_ERROR_DISK_SPACE)
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+							 "%s.\n%s.",
+							  error->message,
+							  _("You may want to free some space on the disc and retry"));
+	else
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+							 "%s.",
+							  error->message);
+
+	gtk_dialog_add_buttons (GTK_DIALOG (message),
+				_("_Keep Current Location"), GTK_RESPONSE_OK,
+				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				_("_Change Location"), GTK_RESPONSE_ACCEPT,
+				NULL);
+
+	result = gtk_dialog_run (GTK_DIALOG (message));
+	gtk_widget_destroy (message);
+
+	if (hide)
+		gtk_widget_hide (GTK_WIDGET (dialog));
+
+	if (result == GTK_RESPONSE_OK) {
+		g_timer_start (BRASERO_BURN_DIALOG (dialog)->priv->total_time);
+		return BRASERO_BURN_OK;
+	}
+
+	if (result != GTK_RESPONSE_ACCEPT) {
+		g_timer_start (BRASERO_BURN_DIALOG (dialog)->priv->total_time);
+		return BRASERO_BURN_CANCEL;
+	}
+
+	/* Show a GtkFileChooserDialog */
+	if (!is_temporary) {
+		gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (message), TRUE);
+		message = gtk_file_chooser_dialog_new (_("Location for Image File"),
+						       GTK_WINDOW (dialog),
+						       GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+						       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+						       GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+						       NULL);
+	}
+	else
+		message = gtk_file_chooser_dialog_new (_("Location for Temporary Files"),
+						       GTK_WINDOW (dialog),
+						       GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+						       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+						       GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+						       NULL);
+
+	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (message), TRUE);
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (message), g_get_home_dir ());
+
+	result = gtk_dialog_run (GTK_DIALOG (message));
+	if (result != GTK_RESPONSE_OK) {
+		gtk_widget_destroy (message);
+		g_timer_start (BRASERO_BURN_DIALOG (dialog)->priv->total_time);
+		return BRASERO_BURN_CANCEL;
+	}
+
+	path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (message));
+	gtk_widget_destroy (message);
+
+	if (!is_temporary) {
+		BraseroImageFormat format;
+		gchar *image = NULL;
+		gchar *toc = NULL;
+
+		format = brasero_burn_session_get_output_format (dialog->priv->session);
+		brasero_burn_session_get_output (dialog->priv->session,
+						 &image,
+						 &toc,
+						 NULL);
+
+		if (toc) {
+			gchar *name;
+
+			name = g_path_get_basename (toc);
+			g_free (toc);
+
+			toc = g_build_filename (path, name, NULL);
+			BRASERO_BURN_LOG ("New toc location %s", toc);
+		}
+
+		if (image) {
+			gchar *name;
+
+			name = g_path_get_basename (image);
+			g_free (image);
+
+			image = g_build_filename (path, name, NULL);
+			BRASERO_BURN_LOG ("New image location %s", toc);
+		}
+
+		brasero_burn_session_set_image_output_full (dialog->priv->session,
+							    format,
+							    image,
+							    toc);
+	}
+	else
+		brasero_burn_session_set_tmpdir (dialog->priv->session, path);
+
+	g_free (path);
+
+	g_timer_start (BRASERO_BURN_DIALOG (dialog)->priv->total_time);
+	return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
 brasero_burn_dialog_loss_warnings_cb (GtkDialog *dialog, 
 				      const gchar *main_message,
 				      const gchar *secondary_message,
@@ -1287,6 +1431,10 @@
 			  G_CALLBACK (brasero_burn_dialog_insert_disc_cb),
 			  dialog);
 	g_signal_connect (dialog->priv->burn,
+			  "location-request",
+			  G_CALLBACK (brasero_burn_dialog_image_error),
+			  dialog);
+	g_signal_connect (dialog->priv->burn,
 			  "warn-data-loss",
 			  G_CALLBACK (brasero_burn_dialog_data_loss_cb),
 			  dialog);

Modified: trunk/src/brasero-data-disc.c
==============================================================================
--- trunk/src/brasero-data-disc.c	(original)
+++ trunk/src/brasero-data-disc.c	Sun Nov 30 16:06:57 2008
@@ -948,7 +948,7 @@
 	primary = g_strdup_printf (_("\"%s\" cannot be added to the selection."), name);
 	brasero_app_alert (BRASERO_APP (gtk_widget_get_toplevel (GTK_WIDGET (self))),
 			   primary,
-			   _("It doesn't exist at the specified location"),
+			   _("It does not exist at the specified location"),
 			   GTK_MESSAGE_ERROR);
 	g_free (primary);
 	g_free (name);

Modified: trunk/src/brasero-drive-properties.c
==============================================================================
--- trunk/src/brasero-drive-properties.c	(original)
+++ trunk/src/brasero-drive-properties.c	Sun Nov 30 16:06:57 2008
@@ -154,7 +154,8 @@
 
 	info = g_file_query_filesystem_info (file,
 					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
-					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE ","
+					     G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
 					     NULL,
 					     &error);
 	g_object_unref (file);
@@ -169,6 +170,41 @@
 		return FALSE;
 	}
 
+	if (!g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
+		gint answer;
+		gchar *string;
+		GtkWidget *dialog;
+		GtkWidget *toplevel;
+
+		toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+		dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
+						 GTK_DIALOG_DESTROY_WITH_PARENT |
+						 GTK_DIALOG_MODAL,
+						 GTK_MESSAGE_WARNING,
+						 GTK_BUTTONS_NONE,
+						 _("Do you really want to choose this location?"));
+
+		string = g_strdup_printf ("%s.", _("You do not have the required permission to write at this location"));
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), string);
+		g_free (string);
+
+		gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+					_("_Keep Current Location"), GTK_RESPONSE_CANCEL,
+					_("_Change Location"), GTK_RESPONSE_OK,
+					NULL);
+
+		gtk_widget_show_all (dialog);
+		answer = gtk_dialog_run (GTK_DIALOG (dialog));
+		gtk_widget_destroy (dialog);
+
+		if (answer != GTK_RESPONSE_OK) {
+			g_object_unref (info);
+			return FALSE;
+		}
+
+		priv->check_filesystem = 1;
+	}
+
 	/* NOTE/FIXME: also check, probably best at start or in a special dialog
 	 * whether quotas or any other limitation enforced on the system may not
 	 * get in out way. Think getrlimit (). */
@@ -197,8 +233,8 @@
 							    "\nThis can be a problem when writing DVDs or large images."));
 
 		gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-					_("_Keep current location"), GTK_RESPONSE_CANCEL,
-					_("_Change location"), GTK_RESPONSE_OK,
+					_("_Keep Current Location"), GTK_RESPONSE_CANCEL,
+					_("_Change Location"), GTK_RESPONSE_OK,
 					NULL);
 
 		gtk_widget_show_all (dialog);
@@ -512,7 +548,7 @@
 			    FALSE, 0);
 	g_free (string);
 
-	priv->tmpdir = gtk_file_chooser_button_new (_("Directory for temporary files"),
+	priv->tmpdir = gtk_file_chooser_button_new (_("Location for Temporary Files"),
 						    GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
 
 	box = gtk_hbox_new (FALSE, 6);

Modified: trunk/src/brasero-image-properties.c
==============================================================================
--- trunk/src/brasero-image-properties.c	(original)
+++ trunk/src/brasero-image-properties.c	Sun Nov 30 16:06:57 2008
@@ -229,7 +229,7 @@
 
 	priv = BRASERO_IMAGE_PROPERTIES_PRIVATE (object);
 
-	gtk_window_set_title (GTK_WINDOW (object), _("Image File Properties"));
+	gtk_window_set_title (GTK_WINDOW (object), _("Location for Image File"));
 	gtk_dialog_set_has_separator (GTK_DIALOG (object), FALSE);
 	gtk_dialog_add_buttons (GTK_DIALOG (object),
 				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,

Modified: trunk/src/brasero-marshal.list
==============================================================================
--- trunk/src/brasero-marshal.list	(original)
+++ trunk/src/brasero-marshal.list	Sun Nov 30 16:06:57 2008
@@ -1,5 +1,6 @@
 VOID:DOUBLE,LONG
 INT:STRING,BOOLEAN
+INT:POINTER,BOOLEAN
 INT:VOID
 INT:INT
 INT:INT,INT

Modified: trunk/src/brasero-session-cfg.c
==============================================================================
--- trunk/src/brasero-session-cfg.c	(original)
+++ trunk/src/brasero-session-cfg.c	Sun Nov 30 16:06:57 2008
@@ -632,6 +632,8 @@
 		return;
 	}
 
+	/* FIXME: another easy error to catch: AUDIO project with a DVD */
+
 	/* make sure there is an output set */
 	burner = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (self));
 	if (!burner) {

Modified: trunk/src/brasero-sum-dialog.c
==============================================================================
--- trunk/src/brasero-sum-dialog.c	(original)
+++ trunk/src/brasero-sum-dialog.c	Sun Nov 30 16:06:57 2008
@@ -298,7 +298,8 @@
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_GENERAL,
-			     _("A temporary file could not be created (%s)"),
+			     "%s (%s)",
+			     _("A file could not be created at the location specified for temporary files"),
 			     g_strerror (errnum));
 
 		return BRASERO_BURN_ERR;

Modified: trunk/src/burn-job.c
==============================================================================
--- trunk/src/burn-job.c	(original)
+++ trunk/src/burn-job.c	Sun Nov 30 16:06:57 2008
@@ -452,7 +452,8 @@
 
 	info = g_file_query_filesystem_info (file,
 					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
-					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE ","
+					     G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
 					     NULL,
 					     error);
 	if (!info)
@@ -460,6 +461,15 @@
 
 	g_object_unref (file);
 
+	/* Check permissions first */
+	if (!g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
+		g_set_error (error,
+			     BRASERO_BURN_ERROR,
+			     BRASERO_BURN_ERROR_PERMISSION,
+			     _("You do not have the required permission to write at this location"));
+		return BRASERO_BURN_ERR;
+	}
+
 	brasero_job_get_session_output_size (BRASERO_JOB (self), NULL, &output_size);
 
 	/* Now check the filesystem type: the problem here is that some
@@ -474,7 +484,7 @@
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_DISK_SPACE,
-			     _("The filesystem you chose to store the temporary image on cannot hold files with a size over 2 GiB."));
+			     _("The filesystem you chose to store the temporary image on cannot hold files with a size over 2 GiB"));
 		return BRASERO_BURN_ERR;
 	}
 
@@ -489,7 +499,7 @@
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_DISK_SPACE,
-			     _("The location you chose to store the temporary image on does not have enough free space for the disc image (%ld MiB needed)."),
+			     _("The location you chose to store the temporary image on does not have enough free space for the disc image (%ld MiB needed)"),
 			     (unsigned long) output_size / 1048576);
 		return BRASERO_BURN_ERR;
 	}
@@ -511,7 +521,7 @@
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_DISK_SPACE,
-			     _("The location you chose to store the temporary image on does not have enough free space for the disc image (%ld MiB needed)."),
+			     _("The location you chose to store the temporary image on does not have enough free space for the disc image (%ld MiB needed)"),
 			     (unsigned long) output_size / 1048576);
 		return BRASERO_BURN_ERR;
 	}
@@ -1650,12 +1660,10 @@
 
 	priv = BRASERO_JOB_PRIVATE (self);
 	session = brasero_task_ctx_get_session (priv->ctx);
-	brasero_burn_session_get_tmp_file (session,
-					   suffix,
-					   output,
-					   error);
-
-	return BRASERO_BURN_OK;
+	return brasero_burn_session_get_tmp_file (session,
+						  suffix,
+						  output,
+						  error);
 }
 
 BraseroBurnResult

Modified: trunk/src/burn-session.c
==============================================================================
--- trunk/src/burn-session.c	(original)
+++ trunk/src/burn-session.c	Sun Nov 30 16:06:57 2008
@@ -715,11 +715,17 @@
                 int errsv = errno;
 
 		g_free (tmp);
-		g_set_error (error,
-			     BRASERO_BURN_ERROR,
-			     BRASERO_BURN_ERROR_GENERAL,
-			     _("A temporary directory could not be created (%s)"),
-			     g_strerror (errsv));
+		if (errsv != EACCES)
+			g_set_error (error, 
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+				     "%s",
+				     g_strerror (errsv));
+		else
+			g_set_error (error,
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_PERMISSION,
+				     _("You do not have the required permission to write at this location"));
 		return BRASERO_BURN_ERR;
 	}
 
@@ -765,11 +771,18 @@
                 int errsv = errno;
 
 		g_free (tmp);
-		g_set_error (error, 
-			     BRASERO_BURN_ERROR,
-			     BRASERO_BURN_ERROR_GENERAL,
-			     _("A temporary file could not be created (%s)"),
-			     g_strerror (errsv));
+		if (errsv != EACCES)
+			g_set_error (error, 
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+				     "%s",
+				     g_strerror (errsv));
+		else
+			g_set_error (error, 
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_PERMISSION,
+				     _("You do not have the required permission to write at this location"));
+
 		return BRASERO_BURN_ERR;
 	}
 

Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c	(original)
+++ trunk/src/burn.c	Sun Nov 30 16:06:57 2008
@@ -122,6 +122,7 @@
 	WARN_AUDIO_TO_APPENDABLE_SIGNAL,
 	WARN_REWRITABLE_SIGNAL,
 	INSERT_MEDIA_REQUEST_SIGNAL,
+	LOCATION_REQUEST_SIGNAL,
 	PROGRESS_CHANGED_SIGNAL,
 	ACTION_CHANGED_SIGNAL,
 	DUMMY_SUCCESS_SIGNAL,
@@ -435,6 +436,41 @@
 }
 
 static BraseroBurnResult
+brasero_burn_ask_for_location (BraseroBurn *burn,
+			       GError *received_error,
+			       gboolean is_temporary,
+			       GError **error)
+{
+	GValue instance_and_params [3];
+	GValue return_value;
+
+	instance_and_params [0].g_type = 0;
+	g_value_init (instance_and_params, G_TYPE_FROM_INSTANCE (burn));
+	g_value_set_instance (instance_and_params, burn);
+	
+	instance_and_params [1].g_type = 0;
+	g_value_init (instance_and_params + 1, G_TYPE_POINTER);
+	g_value_set_pointer (instance_and_params + 1, received_error);
+	
+	instance_and_params [2].g_type = 0;
+	g_value_init (instance_and_params + 2, G_TYPE_BOOLEAN);
+	g_value_set_boolean (instance_and_params + 2, is_temporary);
+	
+	return_value.g_type = 0;
+	g_value_init (&return_value, G_TYPE_INT);
+	g_value_set_int (&return_value, BRASERO_BURN_CANCEL);
+
+	g_signal_emitv (instance_and_params,
+			brasero_burn_signals [LOCATION_REQUEST_SIGNAL],
+			0,
+			&return_value);
+
+	g_value_unset (instance_and_params);
+	g_value_unset (instance_and_params + 1);
+
+	return g_value_get_int (&return_value);
+}
+static BraseroBurnResult
 brasero_burn_ask_for_src_media (BraseroBurn *burn,
 				BraseroBurnError error_type,
 				BraseroMedia required_media,
@@ -1355,6 +1391,24 @@
 	if (!ret_error)
 		return result;
 
+	if (brasero_burn_session_is_dest_file (priv->session)) {
+		gchar *image = NULL;
+		gchar *toc = NULL;
+
+		/* If it was an image that was output, remove it. If that was
+		 * a temporary image, it will be removed by BraseroBurnSession 
+		 * object. But if it was a final image, it would be left and
+		 * would clutter the disk, wasting space. */
+		brasero_burn_session_get_output (priv->session,
+						 &image,
+						 &toc,
+						 NULL);
+		if (image)
+			g_remove (image);
+		if (toc)
+			g_remove (toc);
+	}
+
 	/* See if we can recover from the error */
 	error_code = ret_error->code;
 	if (error_code == BRASERO_BURN_ERROR_IMAGE_JOLIET) {
@@ -1384,31 +1438,35 @@
 
 		goto start;
 	}
-	else if (error_code == BRASERO_BURN_ERROR_DISK_SPACE) {
+	else if (error_code == BRASERO_BURN_ERROR_DISK_SPACE
+	     ||  error_code == BRASERO_BURN_ERROR_PERMISSION) {
+		gboolean is_temp;
+
 		/* 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. */
-		/* ATM there is nothing we can do here except fail. We could one
-		 * day send a signal so that a dialog asking for a new hard
-		 * drive location is shown */
-	}
+		 * small or we don't have the right permission. */
 
-	if (brasero_burn_session_is_dest_file (priv->session)) {
-		gchar *image = NULL;
-		gchar *toc = NULL;
+		/* 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;
 
-		/* If it was an image that was output, remove it. If that was
-		 * a temporary image, it will be removed by BraseroBurnSession 
-		 * object. But if it was a final image, it would be left and
-		 * would clutter the disk, wasting space. */
-		brasero_burn_session_get_output (priv->session,
-						 &image,
-						 &toc,
-						 NULL);
-		if (image)
-			g_remove (image);
-		if (toc)
-			g_remove (toc);
+		result = brasero_burn_ask_for_location (burn,
+							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;
+
+		goto start;
 	}
 
 	/* If we reached this point that means the error was not recoverable.
@@ -2768,7 +2826,7 @@
 			      NULL, NULL,
 			      brasero_marshal_INT__VOID,
 			      G_TYPE_INT, 0);
-        brasero_burn_signals [INSERT_MEDIA_REQUEST_SIGNAL] =
+	brasero_burn_signals [INSERT_MEDIA_REQUEST_SIGNAL] =
 		g_signal_new ("insert_media",
 			      G_TYPE_FROM_CLASS (klass),
 			      G_SIGNAL_RUN_LAST,
@@ -2781,7 +2839,19 @@
 			      BRASERO_TYPE_DRIVE,
 			      G_TYPE_INT,
 			      G_TYPE_INT);
-        brasero_burn_signals [PROGRESS_CHANGED_SIGNAL] =
+	brasero_burn_signals [LOCATION_REQUEST_SIGNAL] =
+		g_signal_new ("location-request",
+			      G_TYPE_FROM_CLASS (klass),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (BraseroBurnClass,
+					       location_request),
+			      NULL, NULL,
+			      brasero_marshal_INT__POINTER_BOOLEAN,
+			      G_TYPE_INT, 
+			      2,
+			      G_TYPE_POINTER,
+			      G_TYPE_INT);
+	brasero_burn_signals [PROGRESS_CHANGED_SIGNAL] =
 		g_signal_new ("progress_changed",
 			      G_TYPE_FROM_CLASS (klass),
 			      G_SIGNAL_RUN_LAST,

Modified: trunk/src/burn.h
==============================================================================
--- trunk/src/burn.h	(original)
+++ trunk/src/burn.h	Sun Nov 30 16:06:57 2008
@@ -54,9 +54,14 @@
 
 	/* signals */
 	BraseroBurnResult		(*insert_media_request)		(BraseroBurn *obj,
+									 BraseroDrive *drive,
 									 BraseroBurnError error,
 									 BraseroMedia required_media);
 
+	BraseroBurnResult		(*location_request)		(BraseroBurn *obj,
+									 GError *error,
+									 gboolean is_temporary);
+
 	BraseroBurnResult		(*ask_disable_joliet)		(BraseroBurn *obj);
 
 	BraseroBurnResult		(*warn_data_loss)		(BraseroBurn *obj);

Modified: trunk/src/plugins/cdrkit/burn-genisoimage.c
==============================================================================
--- trunk/src/plugins/cdrkit/burn-genisoimage.c	(original)
+++ trunk/src/plugins/cdrkit/burn-genisoimage.c	Sun Nov 30 16:06:57 2008
@@ -183,6 +183,13 @@
 							_("There is no space left on the device")));
 
 	}
+	else if (strstr (line, "Unable to open disc image file")) {
+		brasero_job_error (BRASERO_JOB (process),
+				   g_error_new_literal (BRASERO_BURN_ERROR,
+							BRASERO_BURN_ERROR_PERMISSION,
+							_("You do not have the required permission to write at this location")));
+
+	}
 	else if (strstr (line, "Value too large for defined data type")) {
 		brasero_job_error (BRASERO_JOB (process),
 				   g_error_new_literal (BRASERO_BURN_ERROR,

Modified: trunk/src/plugins/cdrtools/burn-mkisofs.c
==============================================================================
--- trunk/src/plugins/cdrtools/burn-mkisofs.c	(original)
+++ trunk/src/plugins/cdrtools/burn-mkisofs.c	Sun Nov 30 16:06:57 2008
@@ -184,6 +184,13 @@
 							_("There is no space left on the device")));
 
 	}
+	else if (strstr (line, "Unable to open disc image file")) {
+		brasero_job_error (BRASERO_JOB (process),
+				   g_error_new_literal (BRASERO_BURN_ERROR,
+							BRASERO_BURN_ERROR_PERMISSION,
+							_("You do not have the required permission to write at this location")));
+
+	}
 	else if (strstr (line, "Value too large for defined data type")) {
 		brasero_job_error (BRASERO_JOB (process),
 				   g_error_new_literal (BRASERO_BURN_ERROR,

Modified: trunk/src/plugins/checksum/burn-checksum-files.c
==============================================================================
--- trunk/src/plugins/checksum/burn-checksum-files.c	(original)
+++ trunk/src/plugins/checksum/burn-checksum-files.c	Sun Nov 30 16:06:57 2008
@@ -541,12 +541,13 @@
 		break;
 	}
 
-	if (result != BRASERO_BURN_OK)
+	if (result != BRASERO_BURN_OK || !priv->sums_path)
 		return result;
 
 	priv->file = fopen (priv->sums_path, "w");
 	if (!priv->file) {
                 int errsv = errno;
+
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_GENERAL,

Modified: trunk/src/plugins/libburnia/burn-libisofs.c
==============================================================================
--- trunk/src/plugins/libburnia/burn-libisofs.c	(original)
+++ trunk/src/plugins/libburnia/burn-libisofs.c	Sun Nov 30 16:06:57 2008
@@ -213,9 +213,16 @@
 	brasero_job_get_image_output (BRASERO_JOB (self), &output, NULL);
 	file = fopen (output, "w");
 	if (!file) {
-		priv->error = g_error_new_literal (BRASERO_BURN_ERROR,
-                                                   BRASERO_BURN_ERROR_GENERAL,
-                                                   g_strerror (errno));
+		int errnum = errno;
+
+		if (errno == EACCES)
+			priv->error = g_error_new_literal (BRASERO_BURN_ERROR,
+							   BRASERO_BURN_ERROR_PERMISSION,
+							   "You do not have the required permission to write at this location");
+		else
+			priv->error = g_error_new_literal (BRASERO_BURN_ERROR,
+							   BRASERO_BURN_ERROR_GENERAL,
+							   g_strerror (errnum));
 		return;
 	}
 



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