Commit 70376f28 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Add gtk_print_unix_dialog_set_manual_capabilities that controls what

2006-05-24  Alexander Larsson  <alexl@redhat.com>

	* gtk/gtk.symbols:
	* gtk/gtkprintunixdialog.[ch]:
	Add gtk_print_unix_dialog_set_manual_capabilities that controls
	what widgets to enable in the dialog depending on the apps
	capabilities.

	* gtk/gtkprintbackend.[ch]:
	* gtk/gtkprinter-private.h:
	* gtk/gtkprinter.c:
	* gtk/gtkprintjob.h:
	Add printer_get_capabilities to backend.
	Move some fallback calls to the printbackend base class.

	* gtk/gtkprintoperation-unix.c:
	Set manual capabilities

	* modules/printbackends/cups/gtkprintbackendcups.c:
	Implement get_capabilities

	* modules/printbackends/lpr/gtkprintbackendlpr.c:
	* modules/printbackends/pdf/gtkprintbackendpdf.c:
	Move some methods to baseclass.
parent 27f2b1d9
2006-05-24 Alexander Larsson <alexl@redhat.com>
* gtk/gtk.symbols:
* gtk/gtkprintunixdialog.[ch]:
Add gtk_print_unix_dialog_set_manual_capabilities that controls
what widgets to enable in the dialog depending on the apps
capabilities.
* gtk/gtkprintbackend.[ch]:
* gtk/gtkprinter-private.h:
* gtk/gtkprinter.c:
* gtk/gtkprintjob.h:
Add printer_get_capabilities to backend.
Move some fallback calls to the printbackend base class.
* gtk/gtkprintoperation-unix.c:
Set manual capabilities
* modules/printbackends/cups/gtkprintbackendcups.c:
Implement get_capabilities
* modules/printbackends/lpr/gtkprintbackendlpr.c:
* modules/printbackends/pdf/gtkprintbackendpdf.c:
Move some methods to baseclass.
2006-05-23 Matthias Clasen <mclasen@redhat.com> 2006-05-23 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperation.c (print_pages): Do the begin-print * gtk/gtkprintoperation.c (print_pages): Do the begin-print
......
2006-05-24 Alexander Larsson <alexl@redhat.com>
* gtk/gtk.symbols:
* gtk/gtkprintunixdialog.[ch]:
Add gtk_print_unix_dialog_set_manual_capabilities that controls
what widgets to enable in the dialog depending on the apps
capabilities.
* gtk/gtkprintbackend.[ch]:
* gtk/gtkprinter-private.h:
* gtk/gtkprinter.c:
* gtk/gtkprintjob.h:
Add printer_get_capabilities to backend.
Move some fallback calls to the printbackend base class.
* gtk/gtkprintoperation-unix.c:
Set manual capabilities
* modules/printbackends/cups/gtkprintbackendcups.c:
Implement get_capabilities
* modules/printbackends/lpr/gtkprintbackendlpr.c:
* modules/printbackends/pdf/gtkprintbackendpdf.c:
Move some methods to baseclass.
2006-05-23 Matthias Clasen <mclasen@redhat.com> 2006-05-23 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperation.c (print_pages): Do the begin-print * gtk/gtkprintoperation.c (print_pages): Do the begin-print
......
...@@ -2806,6 +2806,7 @@ gtk_print_unix_dialog_set_settings ...@@ -2806,6 +2806,7 @@ gtk_print_unix_dialog_set_settings
gtk_print_unix_dialog_get_settings gtk_print_unix_dialog_get_settings
gtk_print_unix_dialog_get_selected_printer gtk_print_unix_dialog_get_selected_printer
gtk_print_unix_dialog_add_custom_tab gtk_print_unix_dialog_add_custom_tab
gtk_print_unix_dialog_set_manual_capabilities
#endif #endif
#endif #endif
#endif #endif
......
...@@ -303,6 +303,17 @@ gtk_print_backend_load_modules () ...@@ -303,6 +303,17 @@ gtk_print_backend_load_modules ()
G_DEFINE_TYPE (GtkPrintBackend, gtk_print_backend, G_TYPE_OBJECT) G_DEFINE_TYPE (GtkPrintBackend, gtk_print_backend, G_TYPE_OBJECT)
static void fallback_printer_request_details (GtkPrinter *printer);
static gboolean fallback_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options);
static void fallback_printer_get_hard_margins (GtkPrinter *printer,
double *top,
double *bottom,
double *left,
double *right);
static GList * fallback_printer_list_papers (GtkPrinter *printer);
static GtkPrintCapabilities fallback_printer_get_capabilities (GtkPrinter *printer);
static void static void
gtk_print_backend_class_init (GtkPrintBackendClass *class) gtk_print_backend_class_init (GtkPrintBackendClass *class)
{ {
...@@ -313,8 +324,13 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) ...@@ -313,8 +324,13 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class)
object_class->dispose = gtk_print_backend_dispose; object_class->dispose = gtk_print_backend_dispose;
g_type_class_add_private (class, sizeof (GtkPrintBackendPrivate)); class->printer_request_details = fallback_printer_request_details;
class->printer_mark_conflicts = fallback_printer_mark_conflicts;
class->printer_get_hard_margins = fallback_printer_get_hard_margins;
class->printer_list_papers = fallback_printer_list_papers;
class->printer_get_capabilities = fallback_printer_get_capabilities;
g_type_class_add_private (class, sizeof (GtkPrintBackendPrivate));
signals[PRINTER_LIST_CHANGED] = signals[PRINTER_LIST_CHANGED] =
g_signal_new ("printer-list-changed", g_signal_new ("printer-list-changed",
...@@ -391,6 +407,44 @@ gtk_print_backend_dispose (GObject *object) ...@@ -391,6 +407,44 @@ gtk_print_backend_dispose (GObject *object)
} }
static void
fallback_printer_request_details (GtkPrinter *printer)
{
}
static gboolean
fallback_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options)
{
return FALSE;
}
static void
fallback_printer_get_hard_margins (GtkPrinter *printer,
double *top,
double *bottom,
double *left,
double *right)
{
*top = 0;
*bottom = 0;
*left = 0;
*right = 0;
}
static GList *
fallback_printer_list_papers (GtkPrinter *printer)
{
return NULL;
}
static GtkPrintCapabilities
fallback_printer_get_capabilities (GtkPrinter *printer)
{
return 0;
}
static void static void
printer_hash_to_sorted_active_list (const gchar *key, printer_hash_to_sorted_active_list (const gchar *key,
gpointer value, gpointer value,
......
...@@ -103,6 +103,7 @@ struct _GtkPrintBackendClass ...@@ -103,6 +103,7 @@ struct _GtkPrintBackendClass
double *bottom, double *bottom,
double *left, double *left,
double *right); double *right);
GtkPrintCapabilities (*printer_get_capabilities) (GtkPrinter *printer);
/* Signals */ /* Signals */
void (*printer_list_changed) (GtkPrintBackend *backend); void (*printer_list_changed) (GtkPrintBackend *backend);
......
...@@ -55,6 +55,7 @@ void _gtk_printer_get_hard_margins (GtkPrinter ...@@ -55,6 +55,7 @@ void _gtk_printer_get_hard_margins (GtkPrinter
gdouble *left, gdouble *left,
gdouble *right); gdouble *right);
GHashTable * _gtk_printer_get_custom_widgets (GtkPrinter *printer); GHashTable * _gtk_printer_get_custom_widgets (GtkPrinter *printer);
GtkPrintCapabilities _gtk_printer_get_capabilities (GtkPrinter *printer);
/* GtkPrintJob private methods: */ /* GtkPrintJob private methods: */
......
...@@ -726,6 +726,14 @@ _gtk_printer_get_hard_margins (GtkPrinter *printer, ...@@ -726,6 +726,14 @@ _gtk_printer_get_hard_margins (GtkPrinter *printer,
backend_class->printer_get_hard_margins (printer, top, bottom, left, right); backend_class->printer_get_hard_margins (printer, top, bottom, left, right);
} }
GtkPrintCapabilities
_gtk_printer_get_capabilities (GtkPrinter *printer)
{
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_class->printer_get_capabilities (printer);
}
gint gint
gtk_printer_compare (GtkPrinter *a, GtkPrinter *b) gtk_printer_compare (GtkPrinter *a, GtkPrinter *b)
{ {
......
...@@ -34,6 +34,14 @@ G_BEGIN_DECLS ...@@ -34,6 +34,14 @@ G_BEGIN_DECLS
#define GTK_IS_PRINT_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_JOB)) #define GTK_IS_PRINT_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_JOB))
#define GTK_PRINT_JOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_JOB, GtkPrintJobClass)) #define GTK_PRINT_JOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_JOB, GtkPrintJobClass))
typedef enum
{
GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0,
GTK_PRINT_CAPABILITY_COPIES = 1 << 1,
GTK_PRINT_CAPABILITY_COLLATE = 1 << 2,
GTK_PRINT_CAPABILITY_REVERSE = 1 << 3,
GTK_PRINT_CAPABILITY_SCALE = 1 << 4
} GtkPrintCapabilities;
typedef struct _GtkPrintJob GtkPrintJob; typedef struct _GtkPrintJob GtkPrintJob;
typedef struct _GtkPrintJobClass GtkPrintJobClass; typedef struct _GtkPrintJobClass GtkPrintJobClass;
...@@ -57,12 +65,13 @@ struct _GtkPrintJob ...@@ -57,12 +65,13 @@ struct _GtkPrintJob
GtkPrintPages print_pages; GtkPrintPages print_pages;
GtkPageRange *page_ranges; GtkPageRange *page_ranges;
int num_page_ranges; int num_page_ranges;
gboolean rotate_to_orientation;
GtkPageSet page_set; GtkPageSet page_set;
int num_copies; int num_copies;
gboolean collate; gboolean collate;
gboolean reverse; gboolean reverse;
double scale; double scale;
gboolean rotate_to_orientation;
}; };
struct _GtkPrintJobClass struct _GtkPrintJobClass
......
...@@ -183,6 +183,13 @@ get_print_dialog (GtkPrintOperation *op, ...@@ -183,6 +183,13 @@ get_print_dialog (GtkPrintOperation *op,
pd = gtk_print_unix_dialog_new (NULL, parent); pd = gtk_print_unix_dialog_new (NULL, parent);
gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (pd),
GTK_PRINT_CAPABILITY_PAGE_SET |
GTK_PRINT_CAPABILITY_COPIES |
GTK_PRINT_CAPABILITY_COLLATE |
GTK_PRINT_CAPABILITY_REVERSE |
GTK_PRINT_CAPABILITY_SCALE);
if (priv->print_settings) if (priv->print_settings)
gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (pd), gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (pd),
priv->print_settings); priv->print_settings);
......
...@@ -82,6 +82,10 @@ static void printer_removed_cb (GtkPrintBackend *backend, ...@@ -82,6 +82,10 @@ static void printer_removed_cb (GtkPrintBackend *backend,
static void printer_status_cb (GtkPrintBackend *backend, static void printer_status_cb (GtkPrintBackend *backend,
GtkPrinter *printer, GtkPrinter *printer,
GtkPrintUnixDialog *dialog); GtkPrintUnixDialog *dialog);
static void update_collate_icon (GtkToggleButton *toggle_button,
GtkPrintUnixDialog *dialog);
static gboolean dialog_get_collate (GtkPrintUnixDialog *dialog);
static gboolean dialog_get_reverse (GtkPrintUnixDialog *dialog);
enum { enum {
PROP_0, PROP_0,
...@@ -109,6 +113,9 @@ struct GtkPrintUnixDialogPrivate ...@@ -109,6 +113,9 @@ struct GtkPrintUnixDialogPrivate
GtkWidget *printer_treeview; GtkWidget *printer_treeview;
GtkPrintCapabilities manual_capabilities;
GtkPrintCapabilities printer_capabilities;
GtkTreeModel *printer_list; GtkTreeModel *printer_list;
GtkTreeModelFilter *printer_list_filter; GtkTreeModelFilter *printer_list_filter;
...@@ -1003,6 +1010,28 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog) ...@@ -1003,6 +1010,28 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
g_list_free (groups); g_list_free (groups);
} }
static void
update_dialog_from_capabilities (GtkPrintUnixDialog *dialog)
{
GtkPrintCapabilities caps;
GtkPrintUnixDialogPrivate *priv = dialog->priv;
caps = priv->manual_capabilities | priv->printer_capabilities;
gtk_widget_set_sensitive (priv->page_set_combo,
caps & GTK_PRINT_CAPABILITY_PAGE_SET);
gtk_widget_set_sensitive (priv->copies_spin,
caps & GTK_PRINT_CAPABILITY_COPIES);
gtk_widget_set_sensitive (priv->collate_check,
caps & GTK_PRINT_CAPABILITY_COLLATE);
gtk_widget_set_sensitive (priv->reverse_check,
caps & GTK_PRINT_CAPABILITY_REVERSE);
gtk_widget_set_sensitive (priv->scale_spin,
caps & GTK_PRINT_CAPABILITY_PAGE_SET);
update_collate_icon (NULL, dialog);
}
static void static void
mark_conflicts (GtkPrintUnixDialog *dialog) mark_conflicts (GtkPrintUnixDialog *dialog)
{ {
...@@ -1215,11 +1244,14 @@ selected_printer_changed (GtkTreeSelection *selection, ...@@ -1215,11 +1244,14 @@ selected_printer_changed (GtkTreeSelection *selection,
g_object_unref (priv->current_printer); g_object_unref (priv->current_printer);
} }
priv->printer_capabilities = 0;
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
priv->current_printer = printer; priv->current_printer = printer;
if (printer != NULL) if (printer != NULL)
{ {
priv->printer_capabilities = _gtk_printer_get_capabilities (printer);
priv->options = _gtk_printer_get_options (printer, priv->initial_settings, priv->options = _gtk_printer_get_options (printer, priv->initial_settings,
priv->page_setup); priv->page_setup);
...@@ -1228,7 +1260,9 @@ selected_printer_changed (GtkTreeSelection *selection, ...@@ -1228,7 +1260,9 @@ selected_printer_changed (GtkTreeSelection *selection,
} }
update_dialog_from_settings (dialog); update_dialog_from_settings (dialog);
update_dialog_from_capabilities (dialog);
} }
static void static void
update_collate_icon (GtkToggleButton *toggle_button, update_collate_icon (GtkToggleButton *toggle_button,
GtkPrintUnixDialog *dialog) GtkPrintUnixDialog *dialog)
...@@ -1281,7 +1315,6 @@ draw_collate_cb (GtkWidget *widget, ...@@ -1281,7 +1315,6 @@ draw_collate_cb (GtkWidget *widget,
GdkEventExpose *event, GdkEventExpose *event,
GtkPrintUnixDialog *dialog) GtkPrintUnixDialog *dialog)
{ {
GtkPrintUnixDialogPrivate *priv = dialog->priv;
GtkSettings *settings; GtkSettings *settings;
cairo_t *cr; cairo_t *cr;
gint size; gint size;
...@@ -1289,8 +1322,8 @@ draw_collate_cb (GtkWidget *widget, ...@@ -1289,8 +1322,8 @@ draw_collate_cb (GtkWidget *widget,
gboolean collate, reverse, rtl; gboolean collate, reverse, rtl;
gint text_x; gint text_x;
collate = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->collate_check)); collate = dialog_get_collate (dialog);
reverse = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->reverse_check)); reverse = dialog_get_reverse (dialog);
rtl = (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL); rtl = (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL);
settings = gtk_widget_get_settings (widget); settings = gtk_widget_get_settings (widget);
...@@ -1648,7 +1681,10 @@ dialog_set_print_pages (GtkPrintUnixDialog *dialog, GtkPrintPages pages) ...@@ -1648,7 +1681,10 @@ dialog_set_print_pages (GtkPrintUnixDialog *dialog, GtkPrintPages pages)
static gdouble static gdouble
dialog_get_scale (GtkPrintUnixDialog *dialog) dialog_get_scale (GtkPrintUnixDialog *dialog)
{ {
if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->scale_spin))
return gtk_spin_button_get_value (GTK_SPIN_BUTTON (dialog->priv->scale_spin)); return gtk_spin_button_get_value (GTK_SPIN_BUTTON (dialog->priv->scale_spin));
else
return 100.0;
} }
static void static void
...@@ -1661,7 +1697,10 @@ dialog_set_scale (GtkPrintUnixDialog *dialog, ...@@ -1661,7 +1697,10 @@ dialog_set_scale (GtkPrintUnixDialog *dialog,
static GtkPageSet static GtkPageSet
dialog_get_page_set (GtkPrintUnixDialog *dialog) dialog_get_page_set (GtkPrintUnixDialog *dialog)
{ {
if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->page_set_combo))
return (GtkPageSet)gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->page_set_combo)); return (GtkPageSet)gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->page_set_combo));
else
return GTK_PAGE_SET_ALL;
} }
static void static void
...@@ -1675,7 +1714,9 @@ dialog_set_page_set (GtkPrintUnixDialog *dialog, ...@@ -1675,7 +1714,9 @@ dialog_set_page_set (GtkPrintUnixDialog *dialog,
static gint static gint
dialog_get_n_copies (GtkPrintUnixDialog *dialog) dialog_get_n_copies (GtkPrintUnixDialog *dialog)
{ {
if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->copies_spin))
return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->copies_spin)); return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->copies_spin));
return 1;
} }
static void static void
...@@ -1689,7 +1730,9 @@ dialog_set_n_copies (GtkPrintUnixDialog *dialog, ...@@ -1689,7 +1730,9 @@ dialog_set_n_copies (GtkPrintUnixDialog *dialog,
static gboolean static gboolean
dialog_get_collate (GtkPrintUnixDialog *dialog) dialog_get_collate (GtkPrintUnixDialog *dialog)
{ {
if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->collate_check))
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->collate_check)); return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->collate_check));
return FALSE;
} }
static void static void
...@@ -1703,7 +1746,9 @@ dialog_set_collate (GtkPrintUnixDialog *dialog, ...@@ -1703,7 +1746,9 @@ dialog_set_collate (GtkPrintUnixDialog *dialog,
static gboolean static gboolean
dialog_get_reverse (GtkPrintUnixDialog *dialog) dialog_get_reverse (GtkPrintUnixDialog *dialog)
{ {
if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->reverse_check))
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->reverse_check)); return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->reverse_check));
return FALSE;
} }
static void static void
...@@ -2648,6 +2693,26 @@ gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog, ...@@ -2648,6 +2693,26 @@ gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog,
gtk_widget_show (tab_label); gtk_widget_show (tab_label);
} }
/**
* gtk_print_unix_dialog_set_manual_capabilities:
* @dialog: a #GtkPrintUnixDialog
* @capabilites: the printing capabilities of your application
*
* This lets you specify the printing capabilities your application
* supports. For instance, if you can handle scaling the output then
* you pass #GTK_PRINT_CAPABILITY_SCALE. If you don't pass that, then
* the dialog will only let you select the scale if the printing
* system automatically handles scaling.
*
* Since: 2.10
*/
void
gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
GtkPrintCapabilities capabilities)
{
dialog->priv->manual_capabilities = capabilities;
update_dialog_from_capabilities (dialog);
}
#define __GTK_PRINT_UNIX_DIALOG_C__ #define __GTK_PRINT_UNIX_DIALOG_C__
#include "gtkaliasdef.c" #include "gtkaliasdef.c"
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <gtk/gtkdialog.h> #include <gtk/gtkdialog.h>
#include <gtk/gtkprinter.h> #include <gtk/gtkprinter.h>
#include <gtk/gtkprintjob.h>
#include <gtk/gtkprintsettings.h> #include <gtk/gtkprintsettings.h>
#include <gtk/gtkpagesetup.h> #include <gtk/gtkpagesetup.h>
...@@ -77,6 +78,8 @@ GtkPrinter * gtk_print_unix_dialog_get_selected_printer (GtkPrintUnixDialog ...@@ -77,6 +78,8 @@ GtkPrinter * gtk_print_unix_dialog_get_selected_printer (GtkPrintUnixDialog
void gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog, void gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog,
GtkWidget *child, GtkWidget *child,
GtkWidget *tab_label); GtkWidget *tab_label);
void gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
GtkPrintCapabilities capabilities);
G_END_DECLS G_END_DECLS
......
...@@ -137,6 +137,7 @@ static void cups_printer_get_hard_margins (GtkPrinter ...@@ -137,6 +137,7 @@ static void cups_printer_get_hard_margins (GtkPrinter
double *bottom, double *bottom,
double *left, double *left,
double *right); double *right);
static GtkPrintCapabilities cups_printer_get_capabilities (GtkPrinter *printer);
static void set_option_from_settings (GtkPrinterOption *option, static void set_option_from_settings (GtkPrinterOption *option,
GtkPrintSettings *setting); GtkPrintSettings *setting);
static void cups_begin_polling_info (GtkPrintBackendCups *print_backend, static void cups_begin_polling_info (GtkPrintBackendCups *print_backend,
...@@ -241,6 +242,7 @@ gtk_print_backend_cups_class_init (GtkPrintBackendCupsClass *class) ...@@ -241,6 +242,7 @@ gtk_print_backend_cups_class_init (GtkPrintBackendCupsClass *class)
backend_class->printer_prepare_for_print = cups_printer_prepare_for_print; backend_class->printer_prepare_for_print = cups_printer_prepare_for_print;
backend_class->printer_list_papers = cups_printer_list_papers; backend_class->printer_list_papers = cups_printer_list_papers;
backend_class->printer_get_hard_margins = cups_printer_get_hard_margins; backend_class->printer_get_hard_margins = cups_printer_get_hard_margins;
backend_class->printer_get_capabilities = cups_printer_get_capabilities;
} }
static cairo_status_t static cairo_status_t
...@@ -2593,3 +2595,12 @@ cups_printer_get_hard_margins (GtkPrinter *printer, ...@@ -2593,3 +2595,12 @@ cups_printer_get_hard_margins (GtkPrinter *printer,
*right = ppd_file->custom_margins[2]; *right = ppd_file->custom_margins[2];
*top = ppd_file->custom_margins[3]; *top = ppd_file->custom_margins[3];
} }
static GtkPrintCapabilities
cups_printer_get_capabilities (GtkPrinter *printer)
{
return
GTK_PRINT_CAPABILITY_COPIES |
GTK_PRINT_CAPABILITY_COLLATE |
GTK_PRINT_CAPABILITY_REVERSE;
}
...@@ -66,8 +66,6 @@ static void gtk_print_backend_lpr_init (GtkPrintBacke ...@@ -66,8 +66,6 @@ static void gtk_print_backend_lpr_init (GtkPrintBacke
static void lpr_printer_get_settings_from_options (GtkPrinter *printer, static void lpr_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options, GtkPrinterOptionSet *options,
GtkPrintSettings *settings); GtkPrintSettings *settings);
static gboolean lpr_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options);
static GtkPrinterOptionSet *lpr_printer_get_options (GtkPrinter *printer, static GtkPrinterOptionSet *lpr_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings, GtkPrintSettings *settings,
GtkPageSetup *page_setup); GtkPageSetup *page_setup);
...@@ -75,13 +73,6 @@ static void lpr_printer_prepare_for_print (GtkPrinter ...@@ -75,13 +73,6 @@ static void lpr_printer_prepare_for_print (GtkPrinter
GtkPrintJob *print_job, GtkPrintJob *print_job,
GtkPrintSettings *settings, GtkPrintSettings *settings,
GtkPageSetup *page_setup); GtkPageSetup *page_setup);
static void lpr_printer_get_hard_margins (GtkPrinter *printer,
double *top,
double *bottom,
double *left,
double *right);
static void lpr_printer_request_details (GtkPrinter *printer);
static GList * lpr_printer_list_papers (GtkPrinter *printer);
static cairo_surface_t * lpr_printer_create_cairo_surface (GtkPrinter *printer, static cairo_surface_t * lpr_printer_create_cairo_surface (GtkPrinter *printer,
gdouble width, gdouble width,
gdouble height, gdouble height,
...@@ -165,14 +156,10 @@ gtk_print_backend_lpr_class_init (GtkPrintBackendLprClass *class) ...@@ -165,14 +156,10 @@ gtk_print_backend_lpr_class_init (GtkPrintBackendLprClass *class)
backend_parent_class = g_type_class_peek_parent (class); backend_parent_class = g_type_class_peek_parent (class);
backend_class->print_stream = gtk_print_backend_lpr_print_stream; backend_class->print_stream = gtk_print_backend_lpr_print_stream;
backend_class->printer_request_details = lpr_printer_request_details;
backend_class->printer_create_cairo_surface = lpr_printer_create_cairo_surface; backend_class->printer_create_cairo_surface = lpr_printer_create_cairo_surface;
backend_class->printer_get_options = lpr_printer_get_options; backend_class->printer_get_options = lpr_printer_get_options;
backend_class->printer_mark_conflicts = lpr_printer_mark_conflicts;
backend_class->printer_get_settings_from_options = lpr_printer_get_settings_from_options; backend_class->printer_get_settings_from_options = lpr_printer_get_settings_from_options;
backend_class->printer_prepare_for_print = lpr_printer_prepare_for_print; backend_class->printer_prepare_for_print = lpr_printer_prepare_for_print;
backend_class->printer_list_papers = lpr_printer_list_papers;
backend_class->printer_get_hard_margins = lpr_printer_get_hard_margins;
} }
static cairo_status_t static cairo_status_t
...@@ -394,11 +381,6 @@ gtk_print_backend_lpr_init (GtkPrintBackendLpr *backend) ...@@ -394,11 +381,6 @@ gtk_print_backend_lpr_init (GtkPrintBackendLpr *backend)
g_object_unref (printer); g_object_unref (printer);
} }
static void
lpr_printer_request_details (GtkPrinter *printer)
{
}
static GtkPrinterOptionSet * static GtkPrinterOptionSet *
lpr_printer_get_options (GtkPrinter *printer, lpr_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings, GtkPrintSettings *settings,
...@@ -430,14 +412,6 @@ lpr_printer_get_options (GtkPrinter *printer, ...@@ -430,14 +412,6 @@ lpr_printer_get_options (GtkPrinter *printer,
return set; return set;
} }
static gboolean
lpr_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options)
{
return FALSE;
}
static void static void
lpr_printer_get_settings_from_options (GtkPrinter *printer, lpr_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options, GtkPrinterOptionSet *options,
...@@ -477,22 +451,3 @@ lpr_printer_prepare_for_print (GtkPrinter *printer, ...@@ -477,22 +451,3 @@ lpr_printer_prepare_for_print (GtkPrinter *printer,
print_job->page_set = gtk_print_settings_get_page_set (settings); print_job->page_set = gtk_print_settings_get_page_set (settings);
print_job->rotate_to_orientation = TRUE; print_job->rotate_to_orientation = TRUE;
} }
static void
lpr_printer_get_hard_margins (GtkPrinter *printer,
double *top,
double *bottom,
double *left,
double *right)
{
*top = 0;
*bottom = 0;
*left = 0;
*right = 0;
}
static GList *
lpr_printer_list_papers (GtkPrinter *printer)
{
return NULL;
}
...@@ -67,8 +67,6 @@ static void gtk_print_backend_pdf_init (GtkPrintBacke ...@@ -67,8 +67,6 @@ static void gtk_print_backend_pdf_init (GtkPrintBacke
static void pdf_printer_get_settings_from_options (GtkPrinter *printer, static void pdf_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options, GtkPrinterOptionSet *options,
GtkPrintSettings *settings); GtkPrintSettings *settings);
static gboolean pdf_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options);
static GtkPrinterOptionSet *pdf_printer_get_options (GtkPrinter *printer, static GtkPrinterOptionSet *pdf_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings, GtkPrintSettings *settings,
GtkPageSetup *page_setup); GtkPageSetup *page_setup);
...@@ -76,13 +74,6 @@ static void pdf_printer_prepare_for_print (GtkPrinter ...@@ -76,13 +74,6 @@ static void pdf_printer_prepare_for_print (GtkPrinter
GtkPrintJob *print_job, GtkPrintJob *print_job,
GtkPrintSettings *settings, GtkPrintSettings *settings,
GtkPageSetup *page_setup); GtkPageSetup *page_setup);
static void pdf_printer_get_hard_margins (GtkPrinter *printer,
double *top,
double *bottom,
double *left,
double *right);
static void pdf_printer_request_details (GtkPrinter *printer);
static GList * pdf_printer_list_papers (GtkPrinter *printer);
static void gtk_print_backend_pdf_print_stream (GtkPrintBackend *print_backend, static void gtk_print_backend_pdf_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job, GtkPrintJob *job,
gint data_fd, gint data_fd,
...@@ -166,14 +157,10 @@ gtk_print_backend_pdf_class_init (GtkPrintBackendPdfClass *class) ...@@ -166,14 +157,10 @@ gtk_print_backend_pdf_class_init (GtkPrintBackendPdfClass *class)
backend_parent_class = g_type_class_peek_parent (class); backend_parent_class = g_type_class_peek_parent (class);
backend_class->print_stream = gtk_print_backend_pdf_print_stream; backend_class->print_stream = gtk_print_backend_pdf_print_stream;
backend_class->printer_request_details = pdf_printer_request_details;
backend_class->printer_create_cairo_surface = pdf_printer_create_cairo_surface; backend_class->printer_create_cairo_surface = pdf_printer_create_cairo_surface;
backend_class->printer_get_options = pdf_printer_get_options; backend_class->printer_get_options = pdf_printer_get_options;