diff options
author | Christian Persch <chpe@gnome.org> | 2007-04-30 19:12:00 +0000 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2007-04-30 19:12:00 +0000 |
commit | be87e9a8cd6d60250360d99685e368a921a03e05 (patch) | |
tree | 41a5f976a7f8f391dfbfab9027ffbf3f885158e5 /gtk/gtkprinter.c | |
parent | 3cc1085d978db3f698071141fd64133a483d2015 (diff) | |
download | gtk+-be87e9a8cd6d60250360d99685e368a921a03e05.tar.gz |
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
Diffstat (limited to 'gtk/gtkprinter.c')
-rw-r--r-- | gtk/gtkprinter.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c index 7de8ada7f3..65cd6ca421 100644 --- a/gtk/gtkprinter.c +++ b/gtk/gtkprinter.c @@ -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" |