From bcbbbe51014219d72afff61cd20aa28ced37947d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 29 Apr 2007 04:42:13 +0000 Subject: [PATCH] Make gtk_printer_has_details() and gtk_printer_request_details() public. 2007-04-29 Matthias Clasen * gtk/gtk.symbols: * gtk/gtkprinter-private.h: * gtk/gtkprinter.[hc]: Make gtk_printer_has_details() and gtk_printer_request_details() public. * gtk/gtkpagesetupunixdialog.c: * gtk/gtkprintunixdialog.c: Update callers. (#389203, Christian Persch) svn path=/trunk/; revision=17690 --- ChangeLog | 11 +++++++++ docs/reference/ChangeLog | 4 ++++ docs/reference/gtk/gtk-sections.txt | 2 ++ gtk/gtk.symbols | 2 ++ gtk/gtkpagesetupunixdialog.c | 8 +++---- gtk/gtkprinter-private.h | 5 ++--- gtk/gtkprinter.c | 35 +++++++++++++++++++++++++---- gtk/gtkprinter.h | 3 ++- gtk/gtkprintunixdialog.c | 4 ++-- 9 files changed, 60 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4d2d07879..40fdf4d332 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-04-29 Matthias Clasen + + * gtk/gtk.symbols: + * gtk/gtkprinter-private.h: + * gtk/gtkprinter.[hc]: Make gtk_printer_has_details() and + gtk_printer_request_details() public. + + * gtk/gtkpagesetupunixdialog.c: + * gtk/gtkprintunixdialog.c: Update callers. (#389203, + Christian Persch) + 2007-04-28 Matthias Clasen * configure.in: Add --enable-test-print-backend, defaulting diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 65d951a117..3d0d4beafe 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2007-04-29 Matthias Clasen + + * gtk/gtk-sections.txt: Add gtk_printer_{has,request}_details + 2007-04-28 Matthias Clasen * gtk/tmpl/gtkdnd.sgml: Document GTK_TARGET_OTHER_* diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index a6a57c89d1..8727f81f23 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -6214,6 +6214,8 @@ gtk_printer_accepts_ps gtk_printer_accepts_pdf gtk_printer_list_papers gtk_printer_compare +gtk_printer_has_details +gtk_printer_request_details GtkPrinterFunc gtk_enumerate_printers diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 1e5c35bacd..cc602ac5f1 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -2620,6 +2620,8 @@ gtk_printer_list_papers gtk_printer_accepts_pdf gtk_printer_accepts_ps gtk_printer_compare +gtk_printer_has_details +gtk_printer_request_details gtk_enumerate_printers #endif #endif diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c index e1cc290521..4bd4a88db0 100644 --- a/gtk/gtkpagesetupunixdialog.c +++ b/gtk/gtkpagesetupunixdialog.c @@ -797,7 +797,7 @@ printer_changed_callback (GtkComboBox *combo_box, gtk_tree_model_get (gtk_combo_box_get_model (combo_box), &iter, PRINTER_LIST_COL_PRINTER, &printer, -1); - if (printer == NULL || _gtk_printer_has_details (printer)) + if (printer == NULL || gtk_printer_has_details (printer)) fill_paper_sizes_from_printer (dialog, printer); else { @@ -805,7 +805,7 @@ printer_changed_callback (GtkComboBox *combo_box, priv->request_details_tag = g_signal_connect (printer, "details-acquired", G_CALLBACK (printer_changed_finished_callback), dialog); - _gtk_printer_request_details (printer); + gtk_printer_request_details (printer); } @@ -1737,7 +1737,7 @@ margins_from_printer_changed (CustomPaperDialog *data) if (printer) { - if (_gtk_printer_has_details (printer)) + if (gtk_printer_has_details (printer)) { set_margins_from_printer (data, printer); gtk_combo_box_set_active (combo, 0); @@ -1748,7 +1748,7 @@ margins_from_printer_changed (CustomPaperDialog *data) data->request_details_tag = g_signal_connect (printer, "details-acquired", G_CALLBACK (get_margins_finished_callback), data); - _gtk_printer_request_details (printer); + gtk_printer_request_details (printer); } g_object_unref (printer); diff --git a/gtk/gtkprinter-private.h b/gtk/gtkprinter-private.h index 568e3bc087..6bedb63c26 100644 --- a/gtk/gtkprinter-private.h +++ b/gtk/gtkprinter-private.h @@ -30,12 +30,11 @@ G_BEGIN_DECLS -gboolean _gtk_printer_has_details (GtkPrinter *printer); -void _gtk_printer_request_details (GtkPrinter *printer); GtkPrinterOptionSet *_gtk_printer_get_options (GtkPrinter *printer, GtkPrintSettings *settings, GtkPageSetup *page_setup, - GtkPrintCapabilities capabilities);gboolean _gtk_printer_mark_conflicts (GtkPrinter *printer, + GtkPrintCapabilities capabilities); +gboolean _gtk_printer_mark_conflicts (GtkPrinter *printer, GtkPrinterOptionSet *options); void _gtk_printer_get_settings_from_options (GtkPrinter *printer, GtkPrinterOptionSet *options, diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c index b8200b8c10..7de8ada7f3 100644 --- a/gtk/gtkprinter.c +++ b/gtk/gtkprinter.c @@ -582,9 +582,21 @@ gtk_printer_set_job_count (GtkPrinter *printer, return TRUE; } +/** + * gtk_printer_has_details: + * @printer: a #GtkPrinter + * + * Returns whether the printer details are available. + * + * Return value: %TRUE if @printer details are available + * + * Since: 2.12 + */ gboolean -_gtk_printer_has_details (GtkPrinter *printer) +gtk_printer_has_details (GtkPrinter *printer) { + g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE); + return printer->priv->has_details; } @@ -727,10 +739,23 @@ gtk_printer_set_is_default (GtkPrinter *printer, printer->priv->is_default = TRUE; } +/** + * gtk_printer_request_details: + * @printer: a #GtkPrinter + * + * Requests the printer details. When the details are available, + * the "details-acquired" signal will be emitted on @printer. + * + * Since: 2.12 + */ void -_gtk_printer_request_details (GtkPrinter *printer) +gtk_printer_request_details (GtkPrinter *printer) { - GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend); + GtkPrintBackendClass *backend_class; + + g_return_if_fail (GTK_IS_PRINTER (printer)); + + backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend); backend_class->printer_request_details (printer); } @@ -788,7 +813,9 @@ _gtk_printer_create_cairo_surface (GtkPrinter *printer, * gtk_printer_list_papers: * @printer: * - * Lists all the page sizes @printer supports. + * Lists all the paper sizes @printer supports. + * This will return and empty list unless the printer's details are available, see + * gtk_printer_has_details() and gtk_printer_request_details(). * * Return value: a newly allocated list of newly allocated #GtkPageSetup:s. * diff --git a/gtk/gtkprinter.h b/gtk/gtkprinter.h index f3050f970e..69865e418a 100644 --- a/gtk/gtkprinter.h +++ b/gtk/gtkprinter.h @@ -80,9 +80,10 @@ gboolean gtk_printer_is_default (GtkPrinter *printer gboolean gtk_printer_accepts_pdf (GtkPrinter *printer); gboolean gtk_printer_accepts_ps (GtkPrinter *printer); GList *gtk_printer_list_papers (GtkPrinter *printer); - gint gtk_printer_compare (GtkPrinter *a, GtkPrinter *b); +gboolean gtk_printer_has_details (GtkPrinter *printer); +void gtk_printer_request_details (GtkPrinter *printer); typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer, gpointer data); diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index e72d7c4b96..0f36f5e5c3 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -1245,13 +1245,13 @@ selected_printer_changed (GtkTreeSelection *selection, -1); } - if (printer != NULL && !_gtk_printer_has_details (printer)) + if (printer != NULL && !gtk_printer_has_details (printer)) { gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); priv->request_details_tag = g_signal_connect (printer, "details-acquired", G_CALLBACK (printer_details_acquired), dialog); - _gtk_printer_request_details (printer); + gtk_printer_request_details (printer); g_object_unref (printer); return; }