brasero r994 - in trunk: . src



Author: philippr
Date: Tue Jul 15 13:32:07 2008
New Revision: 994
URL: http://svn.gnome.org/viewvc/brasero?rev=994&view=rev

Log:
	Various fixes for when a disc is copied to an image file
	Fix #543016 â Crash in the disc copy target selection dialog

	* src/brasero-dest-selection.c
	(brasero_dest_selection_set_output_path),
	(brasero_dest_selection_image_format_changed_cb),
	(brasero_dest_selection_image_properties),
	(brasero_dest_selection_set_image_properties),
	(brasero_dest_selection_check_image_settings):
	* src/brasero-image-properties.c
	(brasero_image_properties_is_path_edited),
	(brasero_image_properties_set_path):
	* src/burn-session.c (brasero_burn_session_get_output):

Modified:
   trunk/ChangeLog
   trunk/src/brasero-dest-selection.c
   trunk/src/brasero-image-properties.c
   trunk/src/burn-session.c

Modified: trunk/src/brasero-dest-selection.c
==============================================================================
--- trunk/src/brasero-dest-selection.c	(original)
+++ trunk/src/brasero-dest-selection.c	Tue Jul 15 13:32:07 2008
@@ -303,6 +303,37 @@
 }
 
 static void
+brasero_dest_selection_set_output_path (BraseroDestSelection *self,
+					BraseroImageFormat format,
+					const gchar *path)
+{
+	BraseroDestSelectionPrivate *priv;
+
+	priv = BRASERO_DEST_SELECTION_PRIVATE (self);
+
+	switch (format) {
+	case BRASERO_IMAGE_FORMAT_BIN:
+		brasero_burn_session_set_image_output_full (priv->session,
+							    format,
+							    path,
+							    NULL);
+		break;
+
+	case BRASERO_IMAGE_FORMAT_CDRDAO:
+	case BRASERO_IMAGE_FORMAT_CLONE:
+	case BRASERO_IMAGE_FORMAT_CUE:
+		brasero_burn_session_set_image_output_full (priv->session,
+							    format,
+							    NULL,
+							    path);
+		break;
+
+	default:
+		break;
+	}
+}
+
+static void
 brasero_dest_selection_get_default_output_format (BraseroDestSelection *self,
 						  BraseroTrackType *output)
 {
@@ -521,6 +552,9 @@
 
 	/* make sure the extension is still valid */
 	image_path = brasero_image_properties_get_path (dialog);
+	if (!image_path)
+		return;
+
 	format = brasero_image_properties_get_format (dialog);
 
 	if (format == BRASERO_IMAGE_FORMAT_ANY || format == BRASERO_IMAGE_FORMAT_NONE) {
@@ -535,8 +569,10 @@
 		g_free (image_path);
 		image_path = brasero_dest_selection_get_default_output_path (self, format);
 	}
-	else
+	else if (image_path)
 		image_path = brasero_dest_selection_fix_image_extension (format, FALSE, image_path);
+	else
+		image_path = brasero_dest_selection_get_default_output_path (self, format);
 
 	brasero_image_properties_set_path (dialog, image_path);
 }
@@ -684,7 +720,7 @@
 		image_path = brasero_image_properties_get_path (BRASERO_IMAGE_PROPERTIES (priv->drive_prop));
 
 		if (!brasero_dest_selection_image_check_extension (self, format, image_path)) {
-			if (!brasero_dest_selection_image_extension_ask (self)) {
+			if (brasero_dest_selection_image_extension_ask (self)) {
 				priv->default_ext = TRUE;
 				image_path = brasero_dest_selection_fix_image_extension (format, TRUE, image_path);
 			}
@@ -699,9 +735,9 @@
 	priv->drive_prop = NULL;
 
 	brasero_drive_selection_set_image_path (BRASERO_DRIVE_SELECTION (self), image_path);
-	brasero_burn_session_set_image_output (priv->session,
-					       format,
-					       image_path);
+	brasero_dest_selection_set_output_path (self,
+						format,
+						image_path);
 	g_free (image_path);
 }
 
@@ -1030,11 +1066,9 @@
 		       0,
 		       TRUE);
 	gtk_widget_set_sensitive (priv->button, TRUE);
-
-	brasero_burn_session_set_image_output (priv->session,
-					       output.subtype.img_format,
-					       path);
-
+	brasero_dest_selection_set_output_path (self,
+						output.subtype.img_format,
+						path);
 	brasero_drive_selection_set_image_path (BRASERO_DRIVE_SELECTION (self),
 						path);
 	g_free (path);
@@ -1106,7 +1140,9 @@
 		else
 			path = brasero_dest_selection_get_default_output_path (self, format);
 
-		brasero_burn_session_set_image_output (priv->session, format, path);
+		brasero_dest_selection_set_output_path (self,
+							format,
+							path);
 		brasero_drive_selection_set_image_path (BRASERO_DRIVE_SELECTION (self), path);
 		g_free (path);
 	}

Modified: trunk/src/brasero-image-properties.c
==============================================================================
--- trunk/src/brasero-image-properties.c	(original)
+++ trunk/src/brasero-image-properties.c	Tue Jul 15 13:32:07 2008
@@ -100,6 +100,12 @@
 		return TRUE;
 
 	chooser_path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self));
+	if (!chooser_path && priv->original_path)
+		return TRUE;
+
+	if (!priv->original_path && chooser_path)
+		return TRUE;
+
 	if (!strcmp (chooser_path, priv->original_path))
 		return FALSE;
 
@@ -129,7 +135,12 @@
 
 			/* check if the path was edited since the last time it was set */
 			chooser_path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self));
-			priv->edited = strcmp (priv->original_path, chooser_path) != 0;
+			priv->edited = 	(!chooser_path && priv->original_path) ||
+				        (!priv->original_path && chooser_path) ||
+					 strcmp (priv->original_path, chooser_path) != 0;
+
+			if (chooser_path)
+				g_free (chooser_path);
 		}
 		g_free (priv->original_path);
 	}

Modified: trunk/src/burn-session.c
==============================================================================
--- trunk/src/burn-session.c	(original)
+++ trunk/src/burn-session.c	Tue Jul 15 13:32:07 2008
@@ -657,40 +657,69 @@
 		return BRASERO_BURN_ERR;
 	}
 
-	/* output paths were set so test them and returns them if OK */
-	if (priv->settings->image) {
-		result = brasero_burn_session_file_test (self,
-							 priv->settings->image,
-							 error);
-		if (result != BRASERO_BURN_OK) {
-			BRASERO_BURN_LOG ("Problem with image existence");
-			return result;
+	if (image) {
+		/* output paths were set so test them and returns them if OK */
+		if (priv->settings->image) {
+			result = brasero_burn_session_file_test (self,
+								 priv->settings->image,
+								 error);
+			if (result != BRASERO_BURN_OK) {
+				BRASERO_BURN_LOG ("Problem with image existence");
+				return result;
+			}
+
+			*image = g_strdup (priv->settings->image);
 		}
-	}
-	else {
-		BRASERO_BURN_LOG ("no output specified");
+		else if (priv->settings->toc) {
+			gchar *complement;
 
-		g_set_error (error,
-			     BRASERO_BURN_ERROR,
-			     BRASERO_BURN_ERROR_GENERAL,
-			     _("no output specified"));
-		return BRASERO_BURN_ERR;
-	}
+			/* get the cuesheet complement */
+			complement = brasero_image_format_get_complement (priv->settings->format,
+									  priv->settings->toc);
+			if (!complement) {
+				BRASERO_BURN_LOG ("no output specified");
+
+				g_set_error (error,
+					     BRASERO_BURN_ERROR,
+					     BRASERO_BURN_ERROR_GENERAL,
+					     _("no output specified"));
+				return BRASERO_BURN_ERR;
+			}
 
-	if (priv->settings->toc) {
-		result = brasero_burn_session_file_test (self,
-							 priv->settings->toc,
-							 error);
-		if (result != BRASERO_BURN_OK) {
-			BRASERO_BURN_LOG ("Problem with toc existence");
-			return result;
+			result = brasero_burn_session_file_test (self,
+								 complement,
+								 error);
+			if (result != BRASERO_BURN_OK) {
+				BRASERO_BURN_LOG ("Problem with image existence");
+				return result;
+			}
+
+			*image = complement;
+		}
+		else {
+			BRASERO_BURN_LOG ("no output specified");
+
+			g_set_error (error,
+				     BRASERO_BURN_ERROR,
+				     BRASERO_BURN_ERROR_GENERAL,
+				     _("no output specified"));
+			return BRASERO_BURN_ERR;
 		}
 	}
 
-	if (image)
-		*image = g_strdup (priv->settings->image);
-	if (toc)
+	if (toc) {
+		if (priv->settings->toc) {
+			result = brasero_burn_session_file_test (self,
+								 priv->settings->toc,
+								 error);
+			if (result != BRASERO_BURN_OK) {
+				BRASERO_BURN_LOG ("Problem with toc existence");
+				return result;
+			}
+		}
+
 		*toc = g_strdup (priv->settings->toc);
+	}
 
 	return BRASERO_BURN_OK;
 }



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