Commit d14e9a14 authored by Christian Persch's avatar Christian Persch Committed by Christian Persch

configure.in gtk/Makefile.am Rename "pdf" backend to "file" backend. Step

2006-06-20  Christian Persch  <chpe@cvs.gnome.org>

	* configure.in
	* gtk/Makefile.am
	* modules/printbackends/Makefile.am
	A modules/printbackends/file/.cvsignore
	A modules/printbackends/file/Makefile.am
	A modules/printbackends/file/gtkprintbackendfile.c
	A modules/printbackends/file/gtkprintbackendfile.h
	R modules/printbackends/pdf/*:
	Rename "pdf" backend to "file" backend. Step 2 from bug #339592.
parent b73597ff
2006-06-20 Christian Persch <chpe@cvs.gnome.org>
* configure.in
* gtk/Makefile.am
* modules/printbackends/Makefile.am
A modules/printbackends/file/.cvsignore
A modules/printbackends/file/Makefile.am
A modules/printbackends/file/gtkprintbackendfile.c
A modules/printbackends/file/gtkprintbackendfile.h
R modules/printbackends/pdf/*:
Rename "pdf" backend to "file" backend. Step 2 from bug #339592.
2006-06-20 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkprinteroptionwidget.c: (filesave_changed_cb),
(alternative_set), (construct_widgets): Convert input to filename
encoding and construct an URI from that.
* gtk/gtkprintsettings.h: Add OUTPUT_FILE_FORMAT and OUTPUT_URI keys.
* modules/printbackends/pdf/gtkprintbackendpdf.c: Use those defines.
Step 1 from bug #339592.
2006-06-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintjob.c (gtk_print_job_set_source_file): Add to docs.
......
2006-06-20 Christian Persch <chpe@cvs.gnome.org>
* configure.in
* gtk/Makefile.am
* modules/printbackends/Makefile.am
A modules/printbackends/file/.cvsignore
A modules/printbackends/file/Makefile.am
A modules/printbackends/file/gtkprintbackendfile.c
A modules/printbackends/file/gtkprintbackendfile.h
R modules/printbackends/pdf/*:
Rename "pdf" backend to "file" backend. Step 2 from bug #339592.
2006-06-20 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkprinteroptionwidget.c: (filesave_changed_cb),
(alternative_set), (construct_widgets): Convert input to filename
encoding and construct an URI from that.
* gtk/gtkprintsettings.h: Add OUTPUT_FILE_FORMAT and OUTPUT_URI keys.
* modules/printbackends/pdf/gtkprintbackendpdf.c: Use those defines.
Step 1 from bug #339592.
2006-06-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintjob.c (gtk_print_job_set_source_file): Add to docs.
......
......@@ -1754,7 +1754,7 @@ modules/engines/ms-windows/Theme/gtk-2.0/Makefile
modules/printbackends/Makefile
modules/printbackends/cups/Makefile
modules/printbackends/lpr/Makefile
modules/printbackends/pdf/Makefile
modules/printbackends/file/Makefile
perf/Makefile
contrib/Makefile
contrib/gdk-pixbuf-xlib/Makefile
......
......@@ -10,9 +10,9 @@ endif
DIST_SUBDIRS=theme-bits xdgmime
if HAVE_CUPS
GTK_PRINT_BACKENDS=pdf,cups
GTK_PRINT_BACKENDS=file,cups
else
GTK_PRINT_BACKENDS=pdf,lpr
GTK_PRINT_BACKENDS=file,lpr
endif
INCLUDES = \
......
SUBDIRS = file lpr
if HAVE_CUPS
CUPS_SUBDIR=cups
SUBDIRS += cups
endif
SUBDIRS=$(CUPS_SUBDIR) lpr pdf
DIST_SUBDIRS=cups pdf lpr
Makefile
Makefile.in
*.lo
*.la
......@@ -2,28 +2,32 @@ if OS_WIN32
no_undefined = -no-undefined
endif
INCLUDES = \
backenddir = $(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/printbackends
backend_LTLIBRARIES = libprintbackend-file.la
libprintbackend_file_la_SOURCES = \
gtkprintbackendfile.c
libprintbackend_file_la_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gtk \
-I$(top_builddir)/gtk \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED \
$(GTK_DEP_CFLAGS)
$(AM_CPPFLAGS)
LDADDS = \
$(GTK_DEP_LIBS) \
$(top_builddir)/gtk/$(gtktargetlib)
libprintbackend_file_la_CFLAGS = \
$(GTK_DEP_CFLAGS) \
$(AM_CFLAGS)
backenddir = $(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/printbackends
backend_LTLIBRARIES = libprintbackend-pdf.la
libprintbackend_file_la_LDFLAGS = \
-avoid-version -module $(no_undefined)
libprintbackend_pdf_la_SOURCES = \
gtkprintbackendpdf.c
libprintbackend_file_la_LIBADD = \
$(top_builddir)/gtk/$(gtktargetlib) \
$(GTK_DEP_LIBS)
noinst_HEADERS = \
gtkprintbackendpdf.h
libprintbackend_pdf_la_LDFLAGS = -avoid-version -module $(no_undefined)
libprintbackend_pdf_la_LIBADD = $(LDADDS)
gtkprintbackendfile.h
/* GTK - The GIMP Toolkit
* gtkprintbackendpdf.c: Default implementation of GtkPrintBackend
* for printing to PDF files
* for printing to a file
* Copyright (C) 2003, Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
......@@ -19,6 +19,8 @@
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
......@@ -26,7 +28,6 @@
#include <stdlib.h>
#include <string.h>
#include <config.h>
#include <errno.h>
#include <cairo.h>
#include <cairo-pdf.h>
......@@ -36,84 +37,84 @@
#include "gtkprintoperation.h"
#include "gtkprintbackend.h"
#include "gtkprintbackendpdf.h"
#include "gtkprintbackendfile.h"
#include "gtkprinter.h"
#include "gtkprinter-private.h"
typedef struct _GtkPrintBackendPdfClass GtkPrintBackendPdfClass;
typedef struct _GtkPrintBackendFileClass GtkPrintBackendFileClass;
#define GTK_PRINT_BACKEND_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_BACKEND_PDF, GtkPrintBackendPdfClass))
#define GTK_IS_PRINT_BACKEND_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_BACKEND_PDF))
#define GTK_PRINT_BACKEND_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_BACKEND_PDF, GtkPrintBackendPdfClass))
#define GTK_PRINT_BACKEND_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_BACKEND_FILE, GtkPrintBackendFileClass))
#define GTK_IS_PRINT_BACKEND_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_BACKEND_FILE))
#define GTK_PRINT_BACKEND_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_BACKEND_FILE, GtkPrintBackendFileClass))
#define _PDF_MAX_CHUNK_SIZE 8192
#define _STREAM_MAX_CHUNK_SIZE 8192
static GType print_backend_pdf_type = 0;
static GType print_backend_file_type = 0;
struct _GtkPrintBackendPdfClass
struct _GtkPrintBackendFileClass
{
GtkPrintBackendClass parent_class;
};
struct _GtkPrintBackendPdf
struct _GtkPrintBackendFile
{
GtkPrintBackend parent_instance;
};
static GObjectClass *backend_parent_class;
static void gtk_print_backend_pdf_class_init (GtkPrintBackendPdfClass *class);
static void gtk_print_backend_pdf_init (GtkPrintBackendPdf *impl);
static void pdf_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings);
static GtkPrinterOptionSet *pdf_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup,
GtkPrintCapabilities capabilities);
static void pdf_printer_prepare_for_print (GtkPrinter *printer,
GtkPrintJob *print_job,
GtkPrintSettings *settings,
GtkPageSetup *page_setup);
static void gtk_print_backend_pdf_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
static cairo_surface_t * pdf_printer_create_cairo_surface (GtkPrinter *printer,
GtkPrintSettings *settings,
gdouble width,
gdouble height,
gint cache_fd);
static void gtk_print_backend_file_class_init (GtkPrintBackendFileClass *class);
static void gtk_print_backend_file_init (GtkPrintBackendFile *impl);
static void file_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings);
static GtkPrinterOptionSet *file_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup,
GtkPrintCapabilities capabilities);
static void file_printer_prepare_for_print (GtkPrinter *printer,
GtkPrintJob *print_job,
GtkPrintSettings *settings,
GtkPageSetup *page_setup);
static void gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
static cairo_surface_t * file_printer_create_cairo_surface (GtkPrinter *printer,
GtkPrintSettings *settings,
gdouble width,
gdouble height,
gint cache_fd);
static void
gtk_print_backend_pdf_register_type (GTypeModule *module)
gtk_print_backend_file_register_type (GTypeModule *module)
{
static const GTypeInfo print_backend_pdf_info =
static const GTypeInfo print_backend_file_info =
{
sizeof (GtkPrintBackendPdfClass),
sizeof (GtkPrintBackendFileClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_print_backend_pdf_class_init,
(GClassInitFunc) gtk_print_backend_file_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkPrintBackendPdf),
sizeof (GtkPrintBackendFile),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_print_backend_pdf_init,
(GInstanceInitFunc) gtk_print_backend_file_init,
};
print_backend_pdf_type = g_type_module_register_type (module,
GTK_TYPE_PRINT_BACKEND,
"GtkPrintBackendPdf",
&print_backend_pdf_info, 0);
print_backend_file_type = g_type_module_register_type (module,
GTK_TYPE_PRINT_BACKEND,
"GtkPrintBackendFile",
&print_backend_file_info, 0);
}
G_MODULE_EXPORT void
pb_module_init (GTypeModule *module)
{
gtk_print_backend_pdf_register_type (module);
gtk_print_backend_file_register_type (module);
}
G_MODULE_EXPORT void
......@@ -125,45 +126,45 @@ pb_module_exit (void)
G_MODULE_EXPORT GtkPrintBackend *
pb_module_create (void)
{
return gtk_print_backend_pdf_new ();
return gtk_print_backend_file_new ();
}
/*
* GtkPrintBackendPdf
* GtkPrintBackendFile
*/
GType
gtk_print_backend_pdf_get_type (void)
gtk_print_backend_file_get_type (void)
{
return print_backend_pdf_type;
return print_backend_file_type;
}
/**
* gtk_print_backend_pdf_new:
* gtk_print_backend_file_new:
*
* Creates a new #GtkPrintBackendPdf object. #GtkPrintBackendPdf
* Creates a new #GtkPrintBackendFile object. #GtkPrintBackendFile
* implements the #GtkPrintBackend interface with direct access to
* the filesystem using Unix/Linux API calls
*
* Return value: the new #GtkPrintBackendPdf object
* Return value: the new #GtkPrintBackendFile object
**/
GtkPrintBackend *
gtk_print_backend_pdf_new (void)
gtk_print_backend_file_new (void)
{
return g_object_new (GTK_TYPE_PRINT_BACKEND_PDF, NULL);
return g_object_new (GTK_TYPE_PRINT_BACKEND_FILE, NULL);
}
static void
gtk_print_backend_pdf_class_init (GtkPrintBackendPdfClass *class)
gtk_print_backend_file_class_init (GtkPrintBackendFileClass *class)
{
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_CLASS (class);
backend_parent_class = g_type_class_peek_parent (class);
backend_class->print_stream = gtk_print_backend_pdf_print_stream;
backend_class->printer_create_cairo_surface = pdf_printer_create_cairo_surface;
backend_class->printer_get_options = pdf_printer_get_options;
backend_class->printer_get_settings_from_options = pdf_printer_get_settings_from_options;
backend_class->printer_prepare_for_print = pdf_printer_prepare_for_print;
backend_class->print_stream = gtk_print_backend_file_print_stream;
backend_class->printer_create_cairo_surface = file_printer_create_cairo_surface;
backend_class->printer_get_options = file_printer_get_options;
backend_class->printer_get_settings_from_options = file_printer_get_settings_from_options;
backend_class->printer_prepare_for_print = file_printer_prepare_for_print;
}
static cairo_status_t
......@@ -195,11 +196,11 @@ _cairo_write (void *closure,
static cairo_surface_t *
pdf_printer_create_cairo_surface (GtkPrinter *printer,
GtkPrintSettings *settings,
gdouble width,
gdouble height,
gint cache_fd)
file_printer_create_cairo_surface (GtkPrinter *printer,
GtkPrintSettings *settings,
gdouble width,
gdouble height,
gint cache_fd)
{
cairo_surface_t *surface;
......@@ -221,9 +222,9 @@ typedef struct {
} _PrintStreamData;
static void
pdf_print_cb (GtkPrintBackendPdf *print_backend,
GError *error,
gpointer user_data)
file_print_cb (GtkPrintBackendFile *print_backend,
GError *error,
gpointer user_data)
{
_PrintStreamData *ps = (_PrintStreamData *) user_data;
......@@ -246,11 +247,11 @@ pdf_print_cb (GtkPrintBackendPdf *print_backend,
}
static gboolean
pdf_write (GIOChannel *source,
GIOCondition con,
gpointer user_data)
file_write (GIOChannel *source,
GIOCondition con,
gpointer user_data)
{
gchar buf[_PDF_MAX_CHUNK_SIZE];
gchar buf[_STREAM_MAX_CHUNK_SIZE];
gsize bytes_read;
GError *error;
_PrintStreamData *ps = (_PrintStreamData *) user_data;
......@@ -262,9 +263,7 @@ pdf_write (GIOChannel *source,
bytes_read = read (source_fd,
buf,
_PDF_MAX_CHUNK_SIZE);
_STREAM_MAX_CHUNK_SIZE);
if (bytes_read > 0)
{
......@@ -284,7 +283,7 @@ pdf_write (GIOChannel *source,
if (bytes_read == 0 || error != NULL)
{
pdf_print_cb (GTK_PRINT_BACKEND_PDF (ps->backend), error, user_data);
file_print_cb (GTK_PRINT_BACKEND_FILE (ps->backend), error, user_data);
return FALSE;
}
......@@ -293,7 +292,7 @@ pdf_write (GIOChannel *source,
}
static void
gtk_print_backend_pdf_print_stream (GtkPrintBackend *print_backend,
gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
......@@ -338,9 +337,7 @@ gtk_print_backend_pdf_print_stream (GtkPrintBackend *print_backend,
GTK_PRINT_ERROR_INTERNAL_ERROR,
g_strerror (errno));
pdf_print_cb (GTK_PRINT_BACKEND_PDF (print_backend),
error,
ps);
file_print_cb (GTK_PRINT_BACKEND_FILE (print_backend), error, ps);
return;
}
......@@ -349,17 +346,17 @@ gtk_print_backend_pdf_print_stream (GtkPrintBackend *print_backend,
g_io_add_watch (save_channel,
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
(GIOFunc) pdf_write,
(GIOFunc) file_write,
ps);
}
static void
gtk_print_backend_pdf_init (GtkPrintBackendPdf *backend)
gtk_print_backend_file_init (GtkPrintBackendFile *backend)
{
GtkPrinter *printer;
printer = g_object_new (GTK_TYPE_PRINTER,
"name", _("Print to PDF"),
"name", _("Print to File"),
"backend", backend,
"is-virtual", TRUE,
"accepts-ps", FALSE,
......@@ -376,10 +373,10 @@ gtk_print_backend_pdf_init (GtkPrintBackendPdf *backend)
}
static GtkPrinterOptionSet *
pdf_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup,
GtkPrintCapabilities capabilities)
file_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup,
GtkPrintCapabilities capabilities)
{
GtkPrinterOptionSet *set;
GtkPrinterOption *option;
......@@ -408,9 +405,9 @@ pdf_printer_get_options (GtkPrinter *printer,
}
static void
pdf_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings)
file_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings)
{
GtkPrinterOption *option;
......@@ -419,12 +416,12 @@ pdf_printer_get_settings_from_options (GtkPrinter *printer,
}
static void
pdf_printer_prepare_for_print (GtkPrinter *printer,
GtkPrintJob *print_job,
GtkPrintSettings *settings,
GtkPageSetup *page_setup)
file_printer_prepare_for_print (GtkPrinter *printer,
GtkPrintJob *print_job,
GtkPrintSettings *settings,
GtkPageSetup *page_setup)
{
double scale;
gdouble scale;
print_job->print_pages = gtk_print_settings_get_print_pages (settings);
print_job->page_ranges = NULL;
......
/* GTK - The GIMP Toolkit
* gtkprintbackendpdf.h: Default implementation of GtkPrintBackend
* for printing to a PDF
* for printing to a file
* Copyright (C) 2003, Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
......@@ -19,25 +19,23 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_PRINT_BACKEND_PDF_H__
#define __GTK_PRINT_BACKEND_PDF_H__
#ifndef __GTK_PRINT_BACKEND_FILE_H__
#define __GTK_PRINT_BACKEND_FILE_H__
#include <glib-object.h>
#include "gtkprintbackend.h"
G_BEGIN_DECLS
#define GTK_TYPE_PRINT_BACKEND_PDF (gtk_print_backend_pdf_get_type ())
#define GTK_PRINT_BACKEND_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND_PDF, GtkPrintBackendPdf))
#define GTK_IS_PRINT_BACKEND_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_BACKEND_PDF))
#define GTK_TYPE_PRINT_BACKEND_FILE (gtk_print_backend_file_get_type ())
#define GTK_PRINT_BACKEND_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND_FILE, GtkPrintBackendFile))
#define GTK_IS_PRINT_BACKEND_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_BACKEND_FILE))
typedef struct _GtkPrintBackendPdf GtkPrintBackendPdf;
typedef struct _GtkPrintBackendFile GtkPrintBackendFile;
GtkPrintBackend *gtk_print_backend_pdf_new (void);
GType gtk_print_backend_pdf_get_type (void) G_GNUC_CONST;
GtkPrintBackend *gtk_print_backend_file_new (void);
GType gtk_print_backend_file_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GTK_PRINT_BACKEND_PDF_H__ */
#endif /* __GTK_PRINT_BACKEND_FILE_H__ */
Makefile
Makefile.in
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment