summaryrefslogtreecommitdiff
path: root/gtk/gtkprintoperation-unix.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2006-06-08 09:09:50 +0000
committerAlexander Larsson <alexl@src.gnome.org>2006-06-08 09:09:50 +0000
commit79041f07cd6b9be3e091f86b1b3439108a5bce5b (patch)
tree6227513e27a3b1f7314e0c659eb684e0e05188d4 /gtk/gtkprintoperation-unix.c
parent37400c5ac5e7d12c72d87fa2e989a4ca9f531284 (diff)
downloadgtk+-79041f07cd6b9be3e091f86b1b3439108a5bce5b.tar.gz
Update windows to build with new APIs and first cut at preview work.
2006-06-08 Alexander Larsson <alexl@redhat.com> * gtk/gtkprintoperation-win32.c: Update windows to build with new APIs and first cut at preview work. * gtk/gtkprintoperation-private.h: * gtk/gtkprintoperation-unix.c: * gtk/gtkprintoperation.c Various updates needed when making the preview work on win32. * tests/print-editor.c: Print, don't preview.
Diffstat (limited to 'gtk/gtkprintoperation-unix.c')
-rw-r--r--gtk/gtkprintoperation-unix.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index d5389f92c7..46ce889be9 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -164,6 +164,7 @@ shell_command_substitute_file (const gchar *cmd,
void
_gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
+ cairo_surface_t *surface,
GtkWindow *parent,
const gchar *filename)
{
@@ -175,6 +176,8 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
gchar *quoted_filename;
GdkScreen *screen;
GError *error = NULL;
+
+ cairo_surface_destroy (pop->surface);
settings = gtk_settings_get_default ();
g_object_get (settings, "gtk-print-preview-command", &preview_cmd, NULL);
@@ -570,17 +573,45 @@ _gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation
GtkPageSetup *page_setup,
gdouble *dpi_x,
gdouble *dpi_y,
- const gchar *target)
+ gchar **target)
{
+ gchar *tmp_dir, *dir_template, *preview_filename;
GtkPaperSize *paper_size;
gdouble w, h;
+ dir_template = g_build_filename (g_get_tmp_dir (), "print-preview-XXXXXX", NULL);
+
+ /* use temp dirs because apps like evince need to have extensions
+ * to determine the mime type
+ */
+ tmp_dir = mkdtemp(dir_template);
+ preview_filename = g_build_filename (tmp_dir,
+ "Print Preview.pdf",
+ NULL);
+ g_free (dir_template);
+ *target = preview_filename;
+
paper_size = gtk_page_setup_get_paper_size (page_setup);
w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
*dpi_x = *dpi_y = 72;
- return cairo_pdf_surface_create (target, w, h);
+ return cairo_pdf_surface_create (preview_filename, w, h);
+}
+
+void
+_gtk_print_operation_platform_backend_preview_start_page (GtkPrintOperation *op,
+ cairo_surface_t *surface,
+ cairo_t *cr)
+{
+}
+
+void
+_gtk_print_operation_platform_backend_preview_end_page (GtkPrintOperation *op,
+ cairo_surface_t *surface,
+ cairo_t *cr)
+{
+ cairo_show_page (cr);
}
void