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

Make gtk_printer_get_capabilities public, and move the

2007-04-30  Christian Persch  <chpe@gnome.org>

	* docs/reference/gtk/gtk-sections.txt:
	* gtk/gtk.symbols:
	* gtk/gtkprinter-private.h:
	* gtk/gtkprinter.c: (gtk_printer_get_capabilities),
	(gtk_print_capabilities_get_type):
	* gtk/gtkprinter.h:
	* gtk/gtkprintunixdialog.c: (selected_printer_changed):
	Make gtk_printer_get_capabilities public, and move the
	GtkPrintCapabilities definition to gtkprinter.h. Bug #390437.

svn path=/trunk/; revision=17746
parent 3cc1085d
2007-04-30 Christian Persch <chpe@gnome.org>
* docs/reference/gtk/gtk-sections.txt:
* gtk/gtk.symbols:
* gtk/gtkprinter-private.h:
* gtk/gtkprinter.c: (gtk_printer_get_capabilities),
(gtk_print_capabilities_get_type):
* gtk/gtkprinter.h:
* gtk/gtkprintunixdialog.c: (selected_printer_changed):
Make gtk_printer_get_capabilities public, and move the
GtkPrintCapabilities definition to gtkprinter.h. Bug #390437.
2007-04-30 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkexpander.c (gtk_expander_realize): A NO_WINDOW widget
......
......@@ -6216,6 +6216,7 @@ gtk_printer_list_papers
gtk_printer_compare
gtk_printer_has_details
gtk_printer_request_details
gtk_printer_get_capabilities
GtkPrinterFunc
gtk_enumerate_printers
......
......@@ -2629,7 +2629,9 @@ gtk_printer_accepts_ps
gtk_printer_compare
gtk_printer_has_details
gtk_printer_request_details
gtk_printer_get_capabilities
gtk_enumerate_printers
gtk_print_capabilities_get_type G_GNUC_CONST
#endif
#endif
#endif
......@@ -2714,7 +2716,6 @@ gtk_print_job_get_surface
gtk_print_job_send
gtk_print_job_set_track_print_status
gtk_print_job_get_track_print_status
gtk_print_capabilities_get_type G_GNUC_CONST
#endif
#endif
#endif
......
......@@ -54,8 +54,6 @@ void _gtk_printer_get_hard_margins (GtkPrinter
gdouble *left,
gdouble *right);
GHashTable * _gtk_printer_get_custom_widgets (GtkPrinter *printer);
GtkPrintCapabilities _gtk_printer_get_capabilities (GtkPrinter *printer);
/* GtkPrintJob private methods: */
void gtk_print_job_set_status (GtkPrintJob *job,
......
......@@ -844,11 +844,31 @@ _gtk_printer_get_hard_margins (GtkPrinter *printer,
backend_class->printer_get_hard_margins (printer, top, bottom, left, right);
}
/**
* gtk_printer_get_capabilities:
* @printer: a #GtkPrinter
*
* Returns the printer's capabilities.
*
* This is useful when you're using #GtkPrintUnixDialog's manual-capabilities setting
* and need to know which settings the printer can handle and which you must
* handle yourself.
*
* This will return 0 unless the printer's details are available, see
* gtk_printer_has_details() and gtk_printer_request_details().
* *
* Return value: the printer's capabilities
*
* Since: 2.12
*/
GtkPrintCapabilities
_gtk_printer_get_capabilities (GtkPrinter *printer)
gtk_printer_get_capabilities (GtkPrinter *printer)
{
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
GtkPrintBackendClass *backend_class;
g_return_val_if_fail (GTK_IS_PRINTER (printer), 0);
backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_class->printer_get_capabilities (printer);
}
......@@ -1050,6 +1070,31 @@ gtk_enumerate_printers (GtkPrinterFunc func,
}
}
GType
gtk_print_capabilities_get_type (void)
{
static GType etype = 0;
if (G_UNLIKELY (etype == 0))
{
static const GFlagsValue values[] = {
{ GTK_PRINT_CAPABILITY_PAGE_SET, "GTK_PRINT_CAPABILITY_PAGE_SET", "page-set" },
{ GTK_PRINT_CAPABILITY_COPIES, "GTK_PRINT_CAPABILITY_COPIES", "copies" },
{ GTK_PRINT_CAPABILITY_COLLATE, "GTK_PRINT_CAPABILITY_COLLATE", "collate" },
{ GTK_PRINT_CAPABILITY_REVERSE, "GTK_PRINT_CAPABILITY_REVERSE", "reverse" },
{ GTK_PRINT_CAPABILITY_SCALE, "GTK_PRINT_CAPABILITY_SCALE", "scale" },
{ GTK_PRINT_CAPABILITY_GENERATE_PDF, "GTK_PRINT_CAPABILITY_GENERATE_PDF", "generate-pdf" },
{ GTK_PRINT_CAPABILITY_GENERATE_PS, "GTK_PRINT_CAPABILITY_GENERATE_PS", "generate-ps" },
{ GTK_PRINT_CAPABILITY_PREVIEW, "GTK_PRINT_CAPABILITY_PREVIEW", "preview" },
{ 0, NULL, NULL }
};
etype = g_flags_register_static (I_("GtkPrintCapabilities"), values);
}
return etype;
}
#define __GTK_PRINTER_C__
#include "gtkaliasdef.c"
......@@ -33,6 +33,21 @@ G_BEGIN_DECLS
#define GTK_IS_PRINTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINTER))
#define GTK_PRINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINTER, GtkPrinterClass))
/* Note, this type is manually registered with GObject in gtkprinter.c
* If you add any flags, update the registration as well!
*/
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,
GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6,
GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7
} GtkPrintCapabilities;
typedef struct _GtkPrinter GtkPrinter;
typedef struct _GtkPrinterClass GtkPrinterClass;
typedef struct _GtkPrinterPrivate GtkPrinterPrivate;
......@@ -84,6 +99,7 @@ gint gtk_printer_compare (GtkPrinter *a,
GtkPrinter *b);
gboolean gtk_printer_has_details (GtkPrinter *printer);
void gtk_printer_request_details (GtkPrinter *printer);
GtkPrintCapabilities gtk_printer_get_capabilities (GtkPrinter *printer);
typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
gpointer data);
......
......@@ -1283,7 +1283,7 @@ selected_printer_changed (GtkTreeSelection *selection,
if (printer != NULL)
{
priv->printer_capabilities = _gtk_printer_get_capabilities (printer);
priv->printer_capabilities = gtk_printer_get_capabilities (printer);
priv->options = _gtk_printer_get_options (printer,
priv->initial_settings,
priv->page_setup,
......
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