brasero r1000 - in trunk: . src



Author: philippr
Date: Wed Jul 16 13:21:26 2008
New Revision: 1000
URL: http://svn.gnome.org/viewvc/brasero?rev=1000&view=rev

Log:
	Improved previous change with a dialog that warns the user when he chooses a fat filesystem

	* src/brasero-drive-properties.c
	(brasero_drive_properties_set_tmpdir):

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

Modified: trunk/src/brasero-drive-properties.c
==============================================================================
--- trunk/src/brasero-drive-properties.c	(original)
+++ trunk/src/brasero-drive-properties.c	Wed Jul 16 13:21:26 2008
@@ -26,6 +26,8 @@
 #  include <config.h>
 #endif
 
+#include <string.h>
+
 #include <glib.h>
 #include <glib-object.h>
 #include <glib/gi18n-lib.h>
@@ -139,16 +141,13 @@
 	gchar *directory;
 	GError *error = NULL;
 	guint64 vol_size = 0;
+	const gchar *filesystem;
 	BraseroDrivePropertiesPrivate *priv;
 
 	priv = BRASERO_DRIVE_PROPERTIES_PRIVATE (self);
 
 	if (!path)
-		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir),
-					       g_get_tmp_dir ());
-	else
-		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir),
-					       path);
+		path = g_get_tmp_dir ();
 
 	/* get the volume free space */
 	directory = g_path_get_dirname (path);
@@ -158,11 +157,12 @@
 	if (file == NULL) {
 		BRASERO_BURN_LOG ("impossible to retrieve size for %s", path);
 		gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), _("unknown"));
+		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir), path);
 		return;
 	}
 
 	info = g_file_query_filesystem_info (file,
-					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+					     G_FILE_ATTRIBUTE_FILESYSTEM_FREE ",",
 					     NULL,
 					     &error);
 	g_object_unref (file);
@@ -177,6 +177,48 @@
 		return;
 	}
 
+	/* 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 (). */
+
+	/* check the filesystem type: the problem here is that some
+	 * filesystems have a maximum file size limit of 4 Gio and more than
+	 * often we need a temporary file size of 4 Gio or more. */
+	filesystem = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
+	if (filesystem && !strcmp (filesystem, "msdos")) {
+		gint answer;
+		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?"));
+
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+							  _("The filesystem on this volume doesn't support large files (size over 2 Gio)."
+							    "\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,
+					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;
+		}
+	}
+
+	gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->tmpdir), path);
+
 	vol_size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
 	g_object_unref (info);
 



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