*** gtkprintoperation.c.orig	2006-06-03 12:30:21.000000000 +0900
--- gtkprintoperation.c	2006-06-05 21:52:18.000000000 +0900
***************
*** 474,479 ****
--- 474,480 ----
    GtkPageSetup *page_setup;
    cairo_t *cr;
  
+ #ifdef HAVE_MKDTEMP
    dir_template = g_build_filename (g_get_tmp_dir (), "print-preview-XXXXXX", NULL);
  
    /* use temp dirs because apps like evince need to have extentions
***************
*** 485,490 ****
--- 486,508 ----
                                        NULL);
    
    g_free (dir_template);
+ #else /* not HAVE_MKDTEMP */
+   gint i = 0;
+ 
+   while (1)
+     {
+       dir_template = g_strdup_printf ("print-preview-%06d", i++);
+       tmp_dir = g_build_filename (g_get_tmp_dir (), dir_template, NULL);
+       g_free (dir_template);
+       if (!g_file_test (tmp_dir, G_FILE_TEST_EXISTS))
+         break;
+       g_free (tmp_dir);
+     }
+   preview_filename = g_build_filename (tmp_dir,
+                                       "Print Preview.pdf",
+                                       NULL);
+   g_free (tmp_dir);
+ #endif /* not HAVE_MKDTEMP */
  
    pop = g_new0 (PreviewOp, 1);
    pop->filename = preview_filename;
