diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | docs/reference/gtk/gtk-sections.txt | 1 | ||||
-rw-r--r-- | gtk/gtk.symbols | 3 | ||||
-rw-r--r-- | gtk/gtkprinter-private.h | 2 | ||||
-rw-r--r-- | gtk/gtkprinter.c | 49 | ||||
-rw-r--r-- | gtk/gtkprinter.h | 16 | ||||
-rw-r--r-- | gtk/gtkprintunixdialog.c | 2 |
7 files changed, 79 insertions, 6 deletions
@@ -1,3 +1,15 @@ +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 diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index df1856b004..2b8f6796a5 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -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 diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 43b74b5b0f..73b9546ca9 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -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 diff --git a/gtk/gtkprinter-private.h b/gtk/gtkprinter-private.h index 6bedb63c26..26146a10a6 100644 --- a/gtk/gtkprinter-private.h +++ b/gtk/gtkprinter-private.h @@ -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, 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" diff --git a/gtk/gtkprinter.h b/gtk/gtkprinter.h index 69865e418a..4c14d21bb9 100644 --- a/gtk/gtkprinter.h +++ b/gtk/gtkprinter.h @@ -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); diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index 17167c47f8..b18af88a1c 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -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, |