brasero r1586 - in trunk: . src



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

Log:
	Fix a problem introduced by late change where we incorrectly checked for
	write permissions.

	* src/brasero-drive-properties.c
	(brasero_drive_properties_set_tmpdir_info):
	* src/burn-job.c (brasero_job_check_output_volume_space):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-drive-properties.c
   trunk/src/burn-job.c

Modified: trunk/src/brasero-drive-properties.c
==============================================================================
--- trunk/src/brasero-drive-properties.c	(original)
+++ trunk/src/brasero-drive-properties.c	Sun Nov 30 17:18:28 2008
@@ -152,16 +152,14 @@
 		return FALSE;
 	}
 
-	info = g_file_query_filesystem_info (file,
-					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
-					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE ","
-					     G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
-					     NULL,
-					     &error);
-	g_object_unref (file);
-
+	info = g_file_query_info (file,
+				  G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
+				  G_FILE_QUERY_INFO_NONE,
+				  NULL,
+				  &error);
 	if (error) {
 		g_object_unref (info);
+		g_object_unref (file);
 
 		BRASERO_BURN_LOG ("impossible to retrieve size for %s (%s)", path, error->message);
 		g_error_free (error);
@@ -199,12 +197,21 @@
 
 		if (answer != GTK_RESPONSE_OK) {
 			g_object_unref (info);
+			g_object_unref (file);
 			return FALSE;
 		}
 
 		priv->check_filesystem = 1;
 	}
 
+	g_object_unref (info);
+	info = g_file_query_filesystem_info (file,
+					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
+					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+					     NULL,
+					     &error);
+	g_object_unref (file);
+
 	/* 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 (). */
@@ -229,7 +236,7 @@
 						 _("Do you really want to choose this location?"));
 
 		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-							  _("The filesystem on this volume doesn't support large files (size over 2 GiB)."
+							  _("The filesystem on this volume does not support large files (size over 2 GiB)."
 							    "\nThis can be a problem when writing DVDs or large images."));
 
 		gtk_dialog_add_buttons (GTK_DIALOG (dialog),

Modified: trunk/src/burn-job.c
==============================================================================
--- trunk/src/burn-job.c	(original)
+++ trunk/src/burn-job.c	Sun Nov 30 17:18:28 2008
@@ -423,9 +423,9 @@
 brasero_job_check_output_volume_space (BraseroJob *self,
 				       GError **error)
 {
-	GFile *file;
 	GFileInfo *info;
 	gchar *directory;
+	GFile *file = NULL;
 	struct rlimit limit;
 	guint64 vol_size = 0;
 	gint64 output_size = 0;
@@ -437,12 +437,17 @@
 
 	priv = BRASERO_JOB_PRIVATE (self);
 
-	/* get the size and filesystem type for the volume first.
+	/* Get the size and filesystem type for the volume first.
 	 * NOTE: since any plugin must output anything LOCALLY, we can then use
 	 * all libc API. */
 	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);
@@ -450,27 +455,37 @@
 	if (file == NULL)
 		goto error;
 
-	info = g_file_query_filesystem_info (file,
-					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
-					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE ","
-					     G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
-					     NULL,
-					     error);
+	info = g_file_query_info (file,
+				  G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
+				  G_FILE_QUERY_INFO_NONE,
+				  NULL,
+				  error);
 	if (!info)
 		goto error;
 
-	g_object_unref (file);
-
 	/* Check permissions first */
 	if (!g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) {
+		g_object_unref (info);
+		g_object_unref (file);
 		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;
 	}
+	g_object_unref (info);
 
-	brasero_job_get_session_output_size (BRASERO_JOB (self), NULL, &output_size);
+	/* Now size left */
+	info = g_file_query_filesystem_info (file,
+					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ","
+					     G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+					     NULL,
+					     error);
+	if (!info)
+		goto error;
+
+	g_object_unref (file);
+	file = NULL;
 
 	/* Now check the filesystem type: the problem here is that some
 	 * filesystems have a maximum file size limit of 4 GiB and more than
@@ -481,6 +496,7 @@
 	if (output_size >= 2147483648ULL
 	&&  filesystem
 	&& !strcmp (filesystem, "msdos")) {
+		g_object_unref (info);
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_DISK_SPACE,
@@ -535,7 +551,10 @@
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_GENERAL,
 			     _("The size of the volume could not be retrieved"));
-	g_object_unref (file);
+
+	if (file)
+		g_object_unref (file);
+
 	return BRASERO_BURN_ERR;
 }
 



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