? ncb-auto-alternate-tmpdir.patch
Index: make-iso.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/make-iso.c,v
retrieving revision 1.23
diff -u -r1.23 make-iso.c
--- make-iso.c	11 Aug 2003 10:46:29 -0000	1.23
+++ make-iso.c	2 Sep 2003 17:13:26 -0000
@@ -46,6 +46,7 @@
 #include <gtk/gtkmessagedialog.h>
 
 #include "nautilus-cd-burner.h"
+#include "make-iso.h"
 
 #ifndef HAVE_MKDTEMP
 #include "mkdtemp.h"
@@ -467,7 +468,7 @@
 }
 
 int
-make_iso (const char *filename, const char *label)
+make_iso (const char *filename, const char *label, gboolean warn_low_space)
 {
 	GnomeVFSURI *uri;
 	char *filelist = NULL;
@@ -580,17 +581,20 @@
 		g_free (dirname);
 	} else if (iso_size / statfs_buf.f_bsize >= statfs_buf.f_bavail / 2048) {
 		g_free (dirname);
-		dialog = gtk_message_dialog_new (cd_progress_get_window (),
-						 GTK_DIALOG_DESTROY_WITH_PARENT,
-						 GTK_MESSAGE_ERROR,
-						 GTK_BUTTONS_CLOSE,
-						 _("Not enough space to store CD image (%ld Megabytes needed)"),
-						 iso_size / 512);
-		gtk_window_set_title (GTK_WINDOW (dialog),
-				      _("Not enough space"));
-		gtk_dialog_run (GTK_DIALOG (dialog));
-		gtk_widget_destroy (dialog);
-		mkisofs_output.result = RESULT_ERROR;
+		if (warn_low_space) {
+			dialog = gtk_message_dialog_new (cd_progress_get_window (),
+							 GTK_DIALOG_DESTROY_WITH_PARENT,
+							 GTK_MESSAGE_ERROR,
+							 GTK_BUTTONS_CLOSE,
+							 _("Not enough space to store CD image (%ld Megabytes needed)"),
+							 iso_size / 512);
+			gtk_window_set_title (GTK_WINDOW (dialog),
+					      _("Not enough space"));
+			gtk_dialog_run (GTK_DIALOG (dialog));
+			gtk_widget_destroy (dialog);
+		}
+
+		mkisofs_output.result = RESULT_RETRY;
 		goto cleanup;
 	}
 
Index: make-iso.h
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/make-iso.h,v
retrieving revision 1.5
diff -u -r1.5 make-iso.h
--- make-iso.h	27 May 2003 08:07:06 -0000	1.5
+++ make-iso.h	2 Sep 2003 17:13:26 -0000
@@ -21,6 +21,7 @@
   
    Authors: Alexander Larsson <alexl@redhat.com>
 */
-int make_iso (const char *filename, const char *label);
+
+int make_iso (const char *filename, const char *label, gboolean warn_low_space);
 gint build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args);
 extern gboolean is_audio (char *mime_type);
Index: nautilus-cd-burner.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-cd-burner.c,v
retrieving revision 1.36
diff -u -r1.36 nautilus-cd-burner.c
--- nautilus-cd-burner.c	29 Aug 2003 16:43:09 -0000	1.36
+++ nautilus-cd-burner.c	2 Sep 2003 17:13:28 -0000
@@ -589,11 +589,20 @@
 	}
 
 	if (source_iso == NULL && !music_cd) {
-		/* TODO: Check for availible diskspace */
-		res = make_iso (filename, label);
-		if (!res) {
-			/* User cancelled or we had an error. */
-			goto out;
+		res = make_iso (filename, label, FALSE);
+		if (res == RESULT_RETRY) {
+			g_free (filename);
+			filename = g_build_filename (g_get_home_dir (), ".image.iso.XXXXXX", NULL);
+			fd = mkstemp(filename);
+			close (fd);
+
+			res = make_iso (filename, label, TRUE);
+			if (!res) {
+				/* User cancelled or we had an error. */
+				if (res == RESULT_RETRY)
+					res = RESULT_ERROR;
+				goto out;
+			}
 		}
 	}
 
Index: nautilus-cd-burner.h
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-cd-burner.h,v
retrieving revision 1.13
diff -u -r1.13 nautilus-cd-burner.h
--- nautilus-cd-burner.h	27 May 2003 08:07:06 -0000	1.13
+++ nautilus-cd-burner.h	2 Sep 2003 17:13:29 -0000
@@ -29,8 +29,6 @@
 #include "cd-drive.h"
 #include "cd-recorder.h"
 
-extern int make_iso (const char *filename,
-		     const char *label);
 extern gint build_list_of_music_arguments (char *uri, int *argc, const char **argv, int max_num_args);
 gboolean is_audio (char *mime_type);
 
