Skip to main content

gtk/auto/
print_operation.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    PageSetup, PrintContext, PrintOperationAction, PrintOperationPreview, PrintOperationResult,
7    PrintSettings, PrintStatus, Unit, Widget, Window, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// GtkPrintOperation is the high-level, portable printing API.
19    /// It looks a bit different than other GTK+ dialogs such as the
20    /// [`FileChooser`][crate::FileChooser], since some platforms don’t expose enough
21    /// infrastructure to implement a good print dialog. On such
22    /// platforms, GtkPrintOperation uses the native print dialog.
23    /// On platforms which do not provide a native print dialog, GTK+
24    /// uses its own, see `GtkPrintUnixDialog`.
25    ///
26    /// The typical way to use the high-level printing API is to create
27    /// a GtkPrintOperation object with [`new()`][Self::new()] when
28    /// the user selects to print. Then you set some properties on it,
29    /// e.g. the page size, any [`PrintSettings`][crate::PrintSettings] from previous print
30    /// operations, the number of pages, the current page, etc.
31    ///
32    /// Then you start the print operation by calling [`PrintOperationExt::run()`][crate::prelude::PrintOperationExt::run()].
33    /// It will then show a dialog, let the user select a printer and
34    /// options. When the user finished the dialog various signals will
35    /// be emitted on the [`PrintOperation`][crate::PrintOperation], the main one being
36    /// [`draw-page`][struct@crate::PrintOperation#draw-page], which you are supposed to catch
37    /// and render the page on the provided [`PrintContext`][crate::PrintContext] using Cairo.
38    ///
39    /// # The high-level printing API
40    ///
41    ///
42    ///
43    /// **⚠️ The following code is in C ⚠️**
44    ///
45    /// ```C
46    /// static GtkPrintSettings *settings = NULL;
47    ///
48    /// static void
49    /// do_print (void)
50    /// {
51    ///   GtkPrintOperation *print;
52    ///   GtkPrintOperationResult res;
53    ///
54    ///   print = gtk_print_operation_new ();
55    ///
56    ///   if (settings != NULL)
57    ///     gtk_print_operation_set_print_settings (print, settings);
58    ///
59    ///   g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
60    ///   g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);
61    ///
62    ///   res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
63    ///                                  GTK_WINDOW (main_window), NULL);
64    ///
65    ///   if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
66    ///     {
67    ///       if (settings != NULL)
68    ///         g_object_unref (settings);
69    ///       settings = g_object_ref (gtk_print_operation_get_print_settings (print));
70    ///     }
71    ///
72    ///   g_object_unref (print);
73    /// }
74    /// ```
75    ///
76    /// By default GtkPrintOperation uses an external application to do
77    /// print preview. To implement a custom print preview, an application
78    /// must connect to the preview signal. The functions
79    /// [`PrintOperationPreviewExt::render_page()`][crate::prelude::PrintOperationPreviewExt::render_page()],
80    /// [`PrintOperationPreviewExt::end_preview()`][crate::prelude::PrintOperationPreviewExt::end_preview()] and
81    /// [`PrintOperationPreviewExt::is_selected()`][crate::prelude::PrintOperationPreviewExt::is_selected()]
82    /// are useful when implementing a print preview.
83    ///
84    /// ## Properties
85    ///
86    ///
87    /// #### `allow-async`
88    ///  Determines whether the print operation may run asynchronously or not.
89    ///
90    /// Some systems don't support asynchronous printing, but those that do
91    /// will return [`PrintOperationResult::InProgress`][crate::PrintOperationResult::InProgress] as the status, and
92    /// emit the [`done`][struct@crate::PrintOperation#done] signal when the operation is actually
93    /// done.
94    ///
95    /// The Windows port does not support asynchronous operation at all (this
96    /// is unlikely to change). On other platforms, all actions except for
97    /// [`PrintOperationAction::Export`][crate::PrintOperationAction::Export] support asynchronous operation.
98    ///
99    /// Readable | Writable
100    ///
101    ///
102    /// #### `current-page`
103    ///  The current page in the document.
104    ///
105    /// If this is set before [`PrintOperationExt::run()`][crate::prelude::PrintOperationExt::run()],
106    /// the user will be able to select to print only the current page.
107    ///
108    /// Note that this only makes sense for pre-paginated documents.
109    ///
110    /// Readable | Writable
111    ///
112    ///
113    /// #### `custom-tab-label`
114    ///  Used as the label of the tab containing custom widgets.
115    /// Note that this property may be ignored on some platforms.
116    ///
117    /// If this is [`None`], GTK+ uses a default label.
118    ///
119    /// Readable | Writable
120    ///
121    ///
122    /// #### `default-page-setup`
123    ///  The [`PageSetup`][crate::PageSetup] used by default.
124    ///
125    /// This page setup will be used by [`PrintOperationExt::run()`][crate::prelude::PrintOperationExt::run()],
126    /// but it can be overridden on a per-page basis by connecting
127    /// to the [`request-page-setup`][struct@crate::PrintOperation#request-page-setup] signal.
128    ///
129    /// Readable | Writable
130    ///
131    ///
132    /// #### `embed-page-setup`
133    ///  If [`true`], page size combo box and orientation combo box are embedded into page setup page.
134    ///
135    /// Readable | Writable
136    ///
137    ///
138    /// #### `export-filename`
139    ///  The name of a file to generate instead of showing the print dialog.
140    /// Currently, PDF is the only supported format.
141    ///
142    /// The intended use of this property is for implementing
143    /// “Export to PDF” actions.
144    ///
145    /// “Print to PDF” support is independent of this and is done
146    /// by letting the user pick the “Print to PDF” item from the
147    /// list of printers in the print dialog.
148    ///
149    /// Readable | Writable
150    ///
151    ///
152    /// #### `has-selection`
153    ///  Determines whether there is a selection in your application.
154    /// This can allow your application to print the selection.
155    /// This is typically used to make a "Selection" button sensitive.
156    ///
157    /// Readable | Writable
158    ///
159    ///
160    /// #### `job-name`
161    ///  A string used to identify the job (e.g. in monitoring
162    /// applications like eggcups).
163    ///
164    /// If you don't set a job name, GTK+ picks a default one
165    /// by numbering successive print jobs.
166    ///
167    /// Readable | Writable
168    ///
169    ///
170    /// #### `n-pages`
171    ///  The number of pages in the document.
172    ///
173    /// This must be set to a positive number
174    /// before the rendering starts. It may be set in a
175    /// [`begin-print`][struct@crate::PrintOperation#begin-print] signal hander.
176    ///
177    /// Note that the page numbers passed to the
178    /// [`request-page-setup`][struct@crate::PrintOperation#request-page-setup] and
179    /// [`draw-page`][struct@crate::PrintOperation#draw-page] signals are 0-based, i.e. if
180    /// the user chooses to print all pages, the last ::draw-page signal
181    /// will be for page `n_pages` - 1.
182    ///
183    /// Readable | Writable
184    ///
185    ///
186    /// #### `n-pages-to-print`
187    ///  The number of pages that will be printed.
188    ///
189    /// Note that this value is set during print preparation phase
190    /// ([`PrintStatus::Preparing`][crate::PrintStatus::Preparing]), so this value should never be
191    /// get before the data generation phase ([`PrintStatus::GeneratingData`][crate::PrintStatus::GeneratingData]).
192    /// You can connect to the [`status-changed`][struct@crate::PrintOperation#status-changed] signal
193    /// and call [`PrintOperationExt::n_pages_to_print()`][crate::prelude::PrintOperationExt::n_pages_to_print()] when
194    /// print status is [`PrintStatus::GeneratingData`][crate::PrintStatus::GeneratingData].
195    /// This is typically used to track the progress of print operation.
196    ///
197    /// Readable
198    ///
199    ///
200    /// #### `print-settings`
201    ///  The [`PrintSettings`][crate::PrintSettings] used for initializing the dialog.
202    ///
203    /// Setting this property is typically used to re-establish
204    /// print settings from a previous print operation, see
205    /// [`PrintOperationExt::run()`][crate::prelude::PrintOperationExt::run()].
206    ///
207    /// Readable | Writable
208    ///
209    ///
210    /// #### `show-progress`
211    ///  Determines whether to show a progress dialog during the
212    /// print operation.
213    ///
214    /// Readable | Writable
215    ///
216    ///
217    /// #### `status`
218    ///  The status of the print operation.
219    ///
220    /// Readable
221    ///
222    ///
223    /// #### `status-string`
224    ///  A string representation of the status of the print operation.
225    /// The string is translated and suitable for displaying the print
226    /// status e.g. in a [`Statusbar`][crate::Statusbar].
227    ///
228    /// See the [`status`][struct@crate::PrintOperation#status] property for a status value that
229    /// is suitable for programmatic use.
230    ///
231    /// Readable
232    ///
233    ///
234    /// #### `support-selection`
235    ///  If [`true`], the print operation will support print of selection.
236    /// This allows the print dialog to show a "Selection" button.
237    ///
238    /// Readable | Writable
239    ///
240    ///
241    /// #### `track-print-status`
242    ///  If [`true`], the print operation will try to continue report on
243    /// the status of the print job in the printer queues and printer.
244    /// This can allow your application to show things like “out of paper”
245    /// issues, and when the print job actually reaches the printer.
246    /// However, this is often implemented using polling, and should
247    /// not be enabled unless needed.
248    ///
249    /// Readable | Writable
250    ///
251    ///
252    /// #### `unit`
253    ///  The transformation for the cairo context obtained from
254    /// [`PrintContext`][crate::PrintContext] is set up in such a way that distances
255    /// are measured in units of `unit`.
256    ///
257    /// Readable | Writable
258    ///
259    ///
260    /// #### `use-full-page`
261    ///  If [`true`], the transformation for the cairo context obtained
262    /// from [`PrintContext`][crate::PrintContext] puts the origin at the top left corner
263    /// of the page (which may not be the top left corner of the sheet,
264    /// depending on page orientation and the number of pages per sheet).
265    /// Otherwise, the origin is at the top left corner of the imageable
266    /// area (i.e. inside the margins).
267    ///
268    /// Readable | Writable
269    ///
270    /// ## Signals
271    ///
272    ///
273    /// #### `begin-print`
274    ///  Emitted after the user has finished changing print settings
275    /// in the dialog, before the actual rendering starts.
276    ///
277    /// A typical use for ::begin-print is to use the parameters from the
278    /// [`PrintContext`][crate::PrintContext] and paginate the document accordingly, and then
279    /// set the number of pages with [`PrintOperationExt::set_n_pages()`][crate::prelude::PrintOperationExt::set_n_pages()].
280    ///
281    ///
282    ///
283    ///
284    /// #### `create-custom-widget`
285    ///  Emitted when displaying the print dialog. If you return a
286    /// widget in a handler for this signal it will be added to a custom
287    /// tab in the print dialog. You typically return a container widget
288    /// with multiple widgets in it.
289    ///
290    /// The print dialog owns the returned widget, and its lifetime is not
291    /// controlled by the application. However, the widget is guaranteed
292    /// to stay around until the [`custom-widget-apply`][struct@crate::PrintOperation#custom-widget-apply]
293    /// signal is emitted on the operation. Then you can read out any
294    /// information you need from the widgets.
295    ///
296    ///
297    ///
298    ///
299    /// #### `custom-widget-apply`
300    ///  Emitted right before [`begin-print`][struct@crate::PrintOperation#begin-print] if you added
301    /// a custom widget in the [`create-custom-widget`][struct@crate::PrintOperation#create-custom-widget] handler.
302    /// When you get this signal you should read the information from the
303    /// custom widgets, as the widgets are not guaraneed to be around at a
304    /// later time.
305    ///
306    ///
307    ///
308    ///
309    /// #### `done`
310    ///  Emitted when the print operation run has finished doing
311    /// everything required for printing.
312    ///
313    /// `result` gives you information about what happened during the run.
314    /// If `result` is [`PrintOperationResult::Error`][crate::PrintOperationResult::Error] then you can call
315    /// `gtk_print_operation_get_error()` for more information.
316    ///
317    /// If you enabled print status tracking then
318    /// [`PrintOperationExt::is_finished()`][crate::prelude::PrintOperationExt::is_finished()] may still return [`false`]
319    /// after [`done`][struct@crate::PrintOperation#done] was emitted.
320    ///
321    ///
322    ///
323    ///
324    /// #### `draw-page`
325    ///  Emitted for every page that is printed. The signal handler
326    /// must render the `page_nr`'s page onto the cairo context obtained
327    /// from `context` using [`PrintContext::cairo_context()`][crate::PrintContext::cairo_context()].
328    ///
329    ///
330    /// **⚠️ The following code is in C ⚠️**
331    ///
332    /// ```C
333    /// static void
334    /// draw_page (GtkPrintOperation *operation,
335    ///            GtkPrintContext   *context,
336    ///            gint               page_nr,
337    ///            gpointer           user_data)
338    /// {
339    ///   cairo_t *cr;
340    ///   PangoLayout *layout;
341    ///   gdouble width, text_height;
342    ///   gint layout_height;
343    ///   PangoFontDescription *desc;
344    ///
345    ///   cr = gtk_print_context_get_cairo_context (context);
346    ///   width = gtk_print_context_get_width (context);
347    ///
348    ///   cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
349    ///
350    ///   cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
351    ///   cairo_fill (cr);
352    ///
353    ///   layout = gtk_print_context_create_pango_layout (context);
354    ///
355    ///   desc = pango_font_description_from_string ("sans 14");
356    ///   pango_layout_set_font_description (layout, desc);
357    ///   pango_font_description_free (desc);
358    ///
359    ///   pango_layout_set_text (layout, "some text", -1);
360    ///   pango_layout_set_width (layout, width * PANGO_SCALE);
361    ///   pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
362    ///
363    ///   pango_layout_get_size (layout, NULL, &layout_height);
364    ///   text_height = (gdouble)layout_height / PANGO_SCALE;
365    ///
366    ///   cairo_move_to (cr, width / 2,  (HEADER_HEIGHT - text_height) / 2);
367    ///   pango_cairo_show_layout (cr, layout);
368    ///
369    ///   g_object_unref (layout);
370    /// }
371    /// ```
372    ///
373    /// Use [`PrintOperationExt::set_use_full_page()`][crate::prelude::PrintOperationExt::set_use_full_page()] and
374    /// [`PrintOperationExt::set_unit()`][crate::prelude::PrintOperationExt::set_unit()] before starting the print operation
375    /// to set up the transformation of the cairo context according to your
376    /// needs.
377    ///
378    ///
379    ///
380    ///
381    /// #### `end-print`
382    ///  Emitted after all pages have been rendered.
383    /// A handler for this signal can clean up any resources that have
384    /// been allocated in the [`begin-print`][struct@crate::PrintOperation#begin-print] handler.
385    ///
386    ///
387    ///
388    ///
389    /// #### `paginate`
390    ///  Emitted after the [`begin-print`][struct@crate::PrintOperation#begin-print] signal, but before
391    /// the actual rendering starts. It keeps getting emitted until a connected
392    /// signal handler returns [`true`].
393    ///
394    /// The ::paginate signal is intended to be used for paginating a document
395    /// in small chunks, to avoid blocking the user interface for a long
396    /// time. The signal handler should update the number of pages using
397    /// [`PrintOperationExt::set_n_pages()`][crate::prelude::PrintOperationExt::set_n_pages()], and return [`true`] if the document
398    /// has been completely paginated.
399    ///
400    /// If you don't need to do pagination in chunks, you can simply do
401    /// it all in the ::begin-print handler, and set the number of pages
402    /// from there.
403    ///
404    ///
405    ///
406    ///
407    /// #### `preview`
408    ///  Gets emitted when a preview is requested from the native dialog.
409    ///
410    /// The default handler for this signal uses an external viewer
411    /// application to preview.
412    ///
413    /// To implement a custom print preview, an application must return
414    /// [`true`] from its handler for this signal. In order to use the
415    /// provided `context` for the preview implementation, it must be
416    /// given a suitable cairo context with [`PrintContext::set_cairo_context()`][crate::PrintContext::set_cairo_context()].
417    ///
418    /// The custom preview implementation can use
419    /// [`PrintOperationPreviewExt::is_selected()`][crate::prelude::PrintOperationPreviewExt::is_selected()] and
420    /// [`PrintOperationPreviewExt::render_page()`][crate::prelude::PrintOperationPreviewExt::render_page()] to find pages which
421    /// are selected for print and render them. The preview must be
422    /// finished by calling [`PrintOperationPreviewExt::end_preview()`][crate::prelude::PrintOperationPreviewExt::end_preview()]
423    /// (typically in response to the user clicking a close button).
424    ///
425    ///
426    ///
427    ///
428    /// #### `request-page-setup`
429    ///  Emitted once for every page that is printed, to give
430    /// the application a chance to modify the page setup. Any changes
431    /// done to `setup` will be in force only for printing this page.
432    ///
433    ///
434    ///
435    ///
436    /// #### `status-changed`
437    ///  Emitted at between the various phases of the print operation.
438    /// See [`PrintStatus`][crate::PrintStatus] for the phases that are being discriminated.
439    /// Use [`PrintOperationExt::status()`][crate::prelude::PrintOperationExt::status()] to find out the current
440    /// status.
441    ///
442    ///
443    ///
444    ///
445    /// #### `update-custom-widget`
446    ///  Emitted after change of selected printer. The actual page setup and
447    /// print settings are passed to the custom widget, which can actualize
448    /// itself according to this change.
449    ///
450    ///
451    /// <details><summary><h4>PrintOperationPreview</h4></summary>
452    ///
453    ///
454    /// #### `got-page-size`
455    ///  The ::got-page-size signal is emitted once for each page
456    /// that gets rendered to the preview.
457    ///
458    /// A handler for this signal should update the `context`
459    /// according to `page_setup` and set up a suitable cairo
460    /// context, using [`PrintContext::set_cairo_context()`][crate::PrintContext::set_cairo_context()].
461    ///
462    ///
463    ///
464    ///
465    /// #### `ready`
466    ///  The ::ready signal gets emitted once per preview operation,
467    /// before the first page is rendered.
468    ///
469    /// A handler for this signal can be used for setup tasks.
470    ///
471    ///
472    /// </details>
473    ///
474    /// # Implements
475    ///
476    /// [`PrintOperationExt`][trait@crate::prelude::PrintOperationExt], [`trait@glib::ObjectExt`], [`PrintOperationPreviewExt`][trait@crate::prelude::PrintOperationPreviewExt]
477    #[doc(alias = "GtkPrintOperation")]
478    pub struct PrintOperation(Object<ffi::GtkPrintOperation, ffi::GtkPrintOperationClass>) @implements PrintOperationPreview;
479
480    match fn {
481        type_ => || ffi::gtk_print_operation_get_type(),
482    }
483}
484
485impl PrintOperation {
486    pub const NONE: Option<&'static PrintOperation> = None;
487
488    /// Creates a new [`PrintOperation`][crate::PrintOperation].
489    ///
490    /// # Returns
491    ///
492    /// a new [`PrintOperation`][crate::PrintOperation]
493    #[doc(alias = "gtk_print_operation_new")]
494    pub fn new() -> PrintOperation {
495        assert_initialized_main_thread!();
496        unsafe { from_glib_full(ffi::gtk_print_operation_new()) }
497    }
498
499    // rustdoc-stripper-ignore-next
500    /// Creates a new builder-pattern struct instance to construct [`PrintOperation`] objects.
501    ///
502    /// This method returns an instance of [`PrintOperationBuilder`](crate::builders::PrintOperationBuilder) which can be used to create [`PrintOperation`] objects.
503    pub fn builder() -> PrintOperationBuilder {
504        PrintOperationBuilder::new()
505    }
506}
507
508impl Default for PrintOperation {
509    fn default() -> Self {
510        Self::new()
511    }
512}
513
514// rustdoc-stripper-ignore-next
515/// A [builder-pattern] type to construct [`PrintOperation`] objects.
516///
517/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
518#[must_use = "The builder must be built to be used"]
519pub struct PrintOperationBuilder {
520    builder: glib::object::ObjectBuilder<'static, PrintOperation>,
521}
522
523impl PrintOperationBuilder {
524    fn new() -> Self {
525        Self {
526            builder: glib::object::Object::builder(),
527        }
528    }
529
530    /// Determines whether the print operation may run asynchronously or not.
531    ///
532    /// Some systems don't support asynchronous printing, but those that do
533    /// will return [`PrintOperationResult::InProgress`][crate::PrintOperationResult::InProgress] as the status, and
534    /// emit the [`done`][struct@crate::PrintOperation#done] signal when the operation is actually
535    /// done.
536    ///
537    /// The Windows port does not support asynchronous operation at all (this
538    /// is unlikely to change). On other platforms, all actions except for
539    /// [`PrintOperationAction::Export`][crate::PrintOperationAction::Export] support asynchronous operation.
540    pub fn allow_async(self, allow_async: bool) -> Self {
541        Self {
542            builder: self.builder.property("allow-async", allow_async),
543        }
544    }
545
546    /// The current page in the document.
547    ///
548    /// If this is set before [`PrintOperationExt::run()`][crate::prelude::PrintOperationExt::run()],
549    /// the user will be able to select to print only the current page.
550    ///
551    /// Note that this only makes sense for pre-paginated documents.
552    pub fn current_page(self, current_page: i32) -> Self {
553        Self {
554            builder: self.builder.property("current-page", current_page),
555        }
556    }
557
558    /// Used as the label of the tab containing custom widgets.
559    /// Note that this property may be ignored on some platforms.
560    ///
561    /// If this is [`None`], GTK+ uses a default label.
562    pub fn custom_tab_label(self, custom_tab_label: impl Into<glib::GString>) -> Self {
563        Self {
564            builder: self
565                .builder
566                .property("custom-tab-label", custom_tab_label.into()),
567        }
568    }
569
570    /// The [`PageSetup`][crate::PageSetup] used by default.
571    ///
572    /// This page setup will be used by [`PrintOperationExt::run()`][crate::prelude::PrintOperationExt::run()],
573    /// but it can be overridden on a per-page basis by connecting
574    /// to the [`request-page-setup`][struct@crate::PrintOperation#request-page-setup] signal.
575    pub fn default_page_setup(self, default_page_setup: &PageSetup) -> Self {
576        Self {
577            builder: self
578                .builder
579                .property("default-page-setup", default_page_setup.clone()),
580        }
581    }
582
583    /// If [`true`], page size combo box and orientation combo box are embedded into page setup page.
584    pub fn embed_page_setup(self, embed_page_setup: bool) -> Self {
585        Self {
586            builder: self.builder.property("embed-page-setup", embed_page_setup),
587        }
588    }
589
590    /// The name of a file to generate instead of showing the print dialog.
591    /// Currently, PDF is the only supported format.
592    ///
593    /// The intended use of this property is for implementing
594    /// “Export to PDF” actions.
595    ///
596    /// “Print to PDF” support is independent of this and is done
597    /// by letting the user pick the “Print to PDF” item from the
598    /// list of printers in the print dialog.
599    pub fn export_filename(self, export_filename: impl Into<glib::GString>) -> Self {
600        Self {
601            builder: self
602                .builder
603                .property("export-filename", export_filename.into()),
604        }
605    }
606
607    /// Determines whether there is a selection in your application.
608    /// This can allow your application to print the selection.
609    /// This is typically used to make a "Selection" button sensitive.
610    pub fn has_selection(self, has_selection: bool) -> Self {
611        Self {
612            builder: self.builder.property("has-selection", has_selection),
613        }
614    }
615
616    /// A string used to identify the job (e.g. in monitoring
617    /// applications like eggcups).
618    ///
619    /// If you don't set a job name, GTK+ picks a default one
620    /// by numbering successive print jobs.
621    pub fn job_name(self, job_name: impl Into<glib::GString>) -> Self {
622        Self {
623            builder: self.builder.property("job-name", job_name.into()),
624        }
625    }
626
627    /// The number of pages in the document.
628    ///
629    /// This must be set to a positive number
630    /// before the rendering starts. It may be set in a
631    /// [`begin-print`][struct@crate::PrintOperation#begin-print] signal hander.
632    ///
633    /// Note that the page numbers passed to the
634    /// [`request-page-setup`][struct@crate::PrintOperation#request-page-setup] and
635    /// [`draw-page`][struct@crate::PrintOperation#draw-page] signals are 0-based, i.e. if
636    /// the user chooses to print all pages, the last ::draw-page signal
637    /// will be for page `n_pages` - 1.
638    pub fn n_pages(self, n_pages: i32) -> Self {
639        Self {
640            builder: self.builder.property("n-pages", n_pages),
641        }
642    }
643
644    /// The [`PrintSettings`][crate::PrintSettings] used for initializing the dialog.
645    ///
646    /// Setting this property is typically used to re-establish
647    /// print settings from a previous print operation, see
648    /// [`PrintOperationExt::run()`][crate::prelude::PrintOperationExt::run()].
649    pub fn print_settings(self, print_settings: &PrintSettings) -> Self {
650        Self {
651            builder: self
652                .builder
653                .property("print-settings", print_settings.clone()),
654        }
655    }
656
657    /// Determines whether to show a progress dialog during the
658    /// print operation.
659    pub fn show_progress(self, show_progress: bool) -> Self {
660        Self {
661            builder: self.builder.property("show-progress", show_progress),
662        }
663    }
664
665    /// If [`true`], the print operation will support print of selection.
666    /// This allows the print dialog to show a "Selection" button.
667    pub fn support_selection(self, support_selection: bool) -> Self {
668        Self {
669            builder: self
670                .builder
671                .property("support-selection", support_selection),
672        }
673    }
674
675    /// If [`true`], the print operation will try to continue report on
676    /// the status of the print job in the printer queues and printer.
677    /// This can allow your application to show things like “out of paper”
678    /// issues, and when the print job actually reaches the printer.
679    /// However, this is often implemented using polling, and should
680    /// not be enabled unless needed.
681    pub fn track_print_status(self, track_print_status: bool) -> Self {
682        Self {
683            builder: self
684                .builder
685                .property("track-print-status", track_print_status),
686        }
687    }
688
689    /// The transformation for the cairo context obtained from
690    /// [`PrintContext`][crate::PrintContext] is set up in such a way that distances
691    /// are measured in units of `unit`.
692    pub fn unit(self, unit: Unit) -> Self {
693        Self {
694            builder: self.builder.property("unit", unit),
695        }
696    }
697
698    /// If [`true`], the transformation for the cairo context obtained
699    /// from [`PrintContext`][crate::PrintContext] puts the origin at the top left corner
700    /// of the page (which may not be the top left corner of the sheet,
701    /// depending on page orientation and the number of pages per sheet).
702    /// Otherwise, the origin is at the top left corner of the imageable
703    /// area (i.e. inside the margins).
704    pub fn use_full_page(self, use_full_page: bool) -> Self {
705        Self {
706            builder: self.builder.property("use-full-page", use_full_page),
707        }
708    }
709
710    // rustdoc-stripper-ignore-next
711    /// Build the [`PrintOperation`].
712    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
713    pub fn build(self) -> PrintOperation {
714        assert_initialized_main_thread!();
715        self.builder.build()
716    }
717}
718
719/// Trait containing all [`struct@PrintOperation`] methods.
720///
721/// # Implementors
722///
723/// [`PrintOperation`][struct@crate::PrintOperation]
724pub trait PrintOperationExt: IsA<PrintOperation> + 'static {
725    /// Cancels a running print operation. This function may
726    /// be called from a [`begin-print`][struct@crate::PrintOperation#begin-print],
727    /// [`paginate`][struct@crate::PrintOperation#paginate] or [`draw-page`][struct@crate::PrintOperation#draw-page]
728    /// signal handler to stop the currently running print
729    /// operation.
730    #[doc(alias = "gtk_print_operation_cancel")]
731    fn cancel(&self) {
732        unsafe {
733            ffi::gtk_print_operation_cancel(self.as_ref().to_glib_none().0);
734        }
735    }
736
737    /// Signalize that drawing of particular page is complete.
738    ///
739    /// It is called after completion of page drawing (e.g. drawing in another
740    /// thread).
741    /// If [`set_defer_drawing()`][Self::set_defer_drawing()] was called before, then this function
742    /// has to be called by application. In another case it is called by the library
743    /// itself.
744    #[doc(alias = "gtk_print_operation_draw_page_finish")]
745    fn draw_page_finish(&self) {
746        unsafe {
747            ffi::gtk_print_operation_draw_page_finish(self.as_ref().to_glib_none().0);
748        }
749    }
750
751    /// Returns the default page setup, see
752    /// [`set_default_page_setup()`][Self::set_default_page_setup()].
753    ///
754    /// # Returns
755    ///
756    /// the default page setup
757    #[doc(alias = "gtk_print_operation_get_default_page_setup")]
758    #[doc(alias = "get_default_page_setup")]
759    #[doc(alias = "default-page-setup")]
760    fn default_page_setup(&self) -> Option<PageSetup> {
761        unsafe {
762            from_glib_none(ffi::gtk_print_operation_get_default_page_setup(
763                self.as_ref().to_glib_none().0,
764            ))
765        }
766    }
767
768    /// Gets the value of [`embed-page-setup`][struct@crate::PrintOperation#embed-page-setup] property.
769    ///
770    /// # Returns
771    ///
772    /// whether page setup selection combos are embedded
773    #[doc(alias = "gtk_print_operation_get_embed_page_setup")]
774    #[doc(alias = "get_embed_page_setup")]
775    #[doc(alias = "embed-page-setup")]
776    fn embeds_page_setup(&self) -> bool {
777        unsafe {
778            from_glib(ffi::gtk_print_operation_get_embed_page_setup(
779                self.as_ref().to_glib_none().0,
780            ))
781        }
782    }
783
784    /// Gets the value of [`has-selection`][struct@crate::PrintOperation#has-selection] property.
785    ///
786    /// # Returns
787    ///
788    /// whether there is a selection
789    #[doc(alias = "gtk_print_operation_get_has_selection")]
790    #[doc(alias = "get_has_selection")]
791    #[doc(alias = "has-selection")]
792    fn has_selection(&self) -> bool {
793        unsafe {
794            from_glib(ffi::gtk_print_operation_get_has_selection(
795                self.as_ref().to_glib_none().0,
796            ))
797        }
798    }
799
800    /// Returns the number of pages that will be printed.
801    ///
802    /// Note that this value is set during print preparation phase
803    /// ([`PrintStatus::Preparing`][crate::PrintStatus::Preparing]), so this function should never be
804    /// called before the data generation phase ([`PrintStatus::GeneratingData`][crate::PrintStatus::GeneratingData]).
805    /// You can connect to the [`status-changed`][struct@crate::PrintOperation#status-changed] signal
806    /// and call [`n_pages_to_print()`][Self::n_pages_to_print()] when
807    /// print status is [`PrintStatus::GeneratingData`][crate::PrintStatus::GeneratingData].
808    /// This is typically used to track the progress of print operation.
809    ///
810    /// # Returns
811    ///
812    /// the number of pages that will be printed
813    #[doc(alias = "gtk_print_operation_get_n_pages_to_print")]
814    #[doc(alias = "get_n_pages_to_print")]
815    #[doc(alias = "n-pages-to-print")]
816    fn n_pages_to_print(&self) -> i32 {
817        unsafe { ffi::gtk_print_operation_get_n_pages_to_print(self.as_ref().to_glib_none().0) }
818    }
819
820    /// Returns the current print settings.
821    ///
822    /// Note that the return value is [`None`] until either
823    /// [`set_print_settings()`][Self::set_print_settings()] or
824    /// [`run()`][Self::run()] have been called.
825    ///
826    /// # Returns
827    ///
828    /// the current print settings of `self`.
829    #[doc(alias = "gtk_print_operation_get_print_settings")]
830    #[doc(alias = "get_print_settings")]
831    #[doc(alias = "print-settings")]
832    fn print_settings(&self) -> Option<PrintSettings> {
833        unsafe {
834            from_glib_none(ffi::gtk_print_operation_get_print_settings(
835                self.as_ref().to_glib_none().0,
836            ))
837        }
838    }
839
840    /// Returns the status of the print operation.
841    /// Also see [`status_string()`][Self::status_string()].
842    ///
843    /// # Returns
844    ///
845    /// the status of the print operation
846    #[doc(alias = "gtk_print_operation_get_status")]
847    #[doc(alias = "get_status")]
848    fn status(&self) -> PrintStatus {
849        unsafe {
850            from_glib(ffi::gtk_print_operation_get_status(
851                self.as_ref().to_glib_none().0,
852            ))
853        }
854    }
855
856    /// Returns a string representation of the status of the
857    /// print operation. The string is translated and suitable
858    /// for displaying the print status e.g. in a [`Statusbar`][crate::Statusbar].
859    ///
860    /// Use [`status()`][Self::status()] to obtain a status
861    /// value that is suitable for programmatic use.
862    ///
863    /// # Returns
864    ///
865    /// a string representation of the status
866    ///  of the print operation
867    #[doc(alias = "gtk_print_operation_get_status_string")]
868    #[doc(alias = "get_status_string")]
869    #[doc(alias = "status-string")]
870    fn status_string(&self) -> Option<glib::GString> {
871        unsafe {
872            from_glib_none(ffi::gtk_print_operation_get_status_string(
873                self.as_ref().to_glib_none().0,
874            ))
875        }
876    }
877
878    /// Gets the value of [`support-selection`][struct@crate::PrintOperation#support-selection] property.
879    ///
880    /// # Returns
881    ///
882    /// whether the application supports print of selection
883    #[doc(alias = "gtk_print_operation_get_support_selection")]
884    #[doc(alias = "get_support_selection")]
885    #[doc(alias = "support-selection")]
886    fn supports_selection(&self) -> bool {
887        unsafe {
888            from_glib(ffi::gtk_print_operation_get_support_selection(
889                self.as_ref().to_glib_none().0,
890            ))
891        }
892    }
893
894    /// A convenience function to find out if the print operation
895    /// is finished, either successfully ([`PrintStatus::Finished`][crate::PrintStatus::Finished])
896    /// or unsuccessfully ([`PrintStatus::FinishedAborted`][crate::PrintStatus::FinishedAborted]).
897    ///
898    /// Note: when you enable print status tracking the print operation
899    /// can be in a non-finished state even after done has been called, as
900    /// the operation status then tracks the print job status on the printer.
901    ///
902    /// # Returns
903    ///
904    /// [`true`], if the print operation is finished.
905    #[doc(alias = "gtk_print_operation_is_finished")]
906    fn is_finished(&self) -> bool {
907        unsafe {
908            from_glib(ffi::gtk_print_operation_is_finished(
909                self.as_ref().to_glib_none().0,
910            ))
911        }
912    }
913
914    /// Runs the print operation, by first letting the user modify
915    /// print settings in the print dialog, and then print the document.
916    ///
917    /// Normally that this function does not return until the rendering of all
918    /// pages is complete. You can connect to the
919    /// [`status-changed`][struct@crate::PrintOperation#status-changed] signal on `self` to obtain some
920    /// information about the progress of the print operation.
921    /// Furthermore, it may use a recursive mainloop to show the print dialog.
922    ///
923    /// If you call [`set_allow_async()`][Self::set_allow_async()] or set the
924    /// [`allow-async`][struct@crate::PrintOperation#allow-async] property the operation will run
925    /// asynchronously if this is supported on the platform. The
926    /// [`done`][struct@crate::PrintOperation#done] signal will be emitted with the result of the
927    /// operation when the it is done (i.e. when the dialog is canceled, or when
928    /// the print succeeds or fails).
929    ///
930    ///
931    /// **⚠️ The following code is in C ⚠️**
932    ///
933    /// ```C
934    /// if (settings != NULL)
935    ///   gtk_print_operation_set_print_settings (print, settings);
936    ///
937    /// if (page_setup != NULL)
938    ///   gtk_print_operation_set_default_page_setup (print, page_setup);
939    ///
940    /// g_signal_connect (print, "begin-print",
941    ///                   G_CALLBACK (begin_print), &data);
942    /// g_signal_connect (print, "draw-page",
943    ///                   G_CALLBACK (draw_page), &data);
944    ///
945    /// res = gtk_print_operation_run (print,
946    ///                                GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
947    ///                                parent,
948    ///                                &error);
949    ///
950    /// if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
951    ///  {
952    ///    error_dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
953    ///                                    GTK_DIALOG_DESTROY_WITH_PARENT,
954    ///                          GTK_MESSAGE_ERROR,
955    ///                          GTK_BUTTONS_CLOSE,
956    ///                          "Error printing file:\n%s",
957    ///                          error->message);
958    ///    g_signal_connect (error_dialog, "response",
959    ///                      G_CALLBACK (gtk_widget_destroy), NULL);
960    ///    gtk_widget_show (error_dialog);
961    ///    g_error_free (error);
962    ///  }
963    /// else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
964    ///  {
965    ///    if (settings != NULL)
966    /// g_object_unref (settings);
967    ///    settings = g_object_ref (gtk_print_operation_get_print_settings (print));
968    ///  }
969    /// ```
970    ///
971    /// Note that [`run()`][Self::run()] can only be called once on a
972    /// given [`PrintOperation`][crate::PrintOperation].
973    /// ## `action`
974    /// the action to start
975    /// ## `parent`
976    /// Transient parent of the dialog
977    ///
978    /// # Returns
979    ///
980    /// the result of the print operation. A return value of
981    ///  [`PrintOperationResult::Apply`][crate::PrintOperationResult::Apply] indicates that the printing was
982    ///  completed successfully. In this case, it is a good idea to obtain
983    ///  the used print settings with [`print_settings()`][Self::print_settings()]
984    ///  and store them for reuse with the next print operation. A value of
985    ///  [`PrintOperationResult::InProgress`][crate::PrintOperationResult::InProgress] means the operation is running
986    ///  asynchronously, and will emit the [`done`][struct@crate::PrintOperation#done] signal when
987    ///  done.
988    #[doc(alias = "gtk_print_operation_run")]
989    fn run(
990        &self,
991        action: PrintOperationAction,
992        parent: Option<&impl IsA<Window>>,
993    ) -> Result<PrintOperationResult, glib::Error> {
994        unsafe {
995            let mut error = std::ptr::null_mut();
996            let ret = ffi::gtk_print_operation_run(
997                self.as_ref().to_glib_none().0,
998                action.into_glib(),
999                parent.map(|p| p.as_ref()).to_glib_none().0,
1000                &mut error,
1001            );
1002            if error.is_null() {
1003                Ok(from_glib(ret))
1004            } else {
1005                Err(from_glib_full(error))
1006            }
1007        }
1008    }
1009
1010    /// Sets whether the [`run()`][Self::run()] may return
1011    /// before the print operation is completed. Note that
1012    /// some platforms may not allow asynchronous operation.
1013    /// ## `allow_async`
1014    /// [`true`] to allow asynchronous operation
1015    #[doc(alias = "gtk_print_operation_set_allow_async")]
1016    #[doc(alias = "allow-async")]
1017    fn set_allow_async(&self, allow_async: bool) {
1018        unsafe {
1019            ffi::gtk_print_operation_set_allow_async(
1020                self.as_ref().to_glib_none().0,
1021                allow_async.into_glib(),
1022            );
1023        }
1024    }
1025
1026    /// Sets the current page.
1027    ///
1028    /// If this is called before [`run()`][Self::run()],
1029    /// the user will be able to select to print only the current page.
1030    ///
1031    /// Note that this only makes sense for pre-paginated documents.
1032    /// ## `current_page`
1033    /// the current page, 0-based
1034    #[doc(alias = "gtk_print_operation_set_current_page")]
1035    #[doc(alias = "current-page")]
1036    fn set_current_page(&self, current_page: i32) {
1037        unsafe {
1038            ffi::gtk_print_operation_set_current_page(self.as_ref().to_glib_none().0, current_page);
1039        }
1040    }
1041
1042    /// Sets the label for the tab holding custom widgets.
1043    /// ## `label`
1044    /// the label to use, or [`None`] to use the default label
1045    #[doc(alias = "gtk_print_operation_set_custom_tab_label")]
1046    #[doc(alias = "custom-tab-label")]
1047    fn set_custom_tab_label(&self, label: Option<&str>) {
1048        unsafe {
1049            ffi::gtk_print_operation_set_custom_tab_label(
1050                self.as_ref().to_glib_none().0,
1051                label.to_glib_none().0,
1052            );
1053        }
1054    }
1055
1056    /// Makes `default_page_setup` the default page setup for `self`.
1057    ///
1058    /// This page setup will be used by [`run()`][Self::run()],
1059    /// but it can be overridden on a per-page basis by connecting
1060    /// to the [`request-page-setup`][struct@crate::PrintOperation#request-page-setup] signal.
1061    /// ## `default_page_setup`
1062    /// a [`PageSetup`][crate::PageSetup], or [`None`]
1063    #[doc(alias = "gtk_print_operation_set_default_page_setup")]
1064    #[doc(alias = "default-page-setup")]
1065    fn set_default_page_setup(&self, default_page_setup: Option<&PageSetup>) {
1066        unsafe {
1067            ffi::gtk_print_operation_set_default_page_setup(
1068                self.as_ref().to_glib_none().0,
1069                default_page_setup.to_glib_none().0,
1070            );
1071        }
1072    }
1073
1074    /// Sets up the [`PrintOperation`][crate::PrintOperation] to wait for calling of
1075    /// [`draw_page_finish()`][Self::draw_page_finish()] from application. It can
1076    /// be used for drawing page in another thread.
1077    ///
1078    /// This function must be called in the callback of “draw-page” signal.
1079    #[doc(alias = "gtk_print_operation_set_defer_drawing")]
1080    fn set_defer_drawing(&self) {
1081        unsafe {
1082            ffi::gtk_print_operation_set_defer_drawing(self.as_ref().to_glib_none().0);
1083        }
1084    }
1085
1086    /// Embed page size combo box and orientation combo box into page setup page.
1087    /// Selected page setup is stored as default page setup in [`PrintOperation`][crate::PrintOperation].
1088    /// ## `embed`
1089    /// [`true`] to embed page setup selection in the `GtkPrintUnixDialog`
1090    #[doc(alias = "gtk_print_operation_set_embed_page_setup")]
1091    #[doc(alias = "embed-page-setup")]
1092    fn set_embed_page_setup(&self, embed: bool) {
1093        unsafe {
1094            ffi::gtk_print_operation_set_embed_page_setup(
1095                self.as_ref().to_glib_none().0,
1096                embed.into_glib(),
1097            );
1098        }
1099    }
1100
1101    /// Sets up the [`PrintOperation`][crate::PrintOperation] to generate a file instead
1102    /// of showing the print dialog. The indended use of this function
1103    /// is for implementing “Export to PDF” actions. Currently, PDF
1104    /// is the only supported format.
1105    ///
1106    /// “Print to PDF” support is independent of this and is done
1107    /// by letting the user pick the “Print to PDF” item from the list
1108    /// of printers in the print dialog.
1109    /// ## `filename`
1110    /// the filename for the exported file
1111    #[doc(alias = "gtk_print_operation_set_export_filename")]
1112    #[doc(alias = "export-filename")]
1113    fn set_export_filename(&self, filename: impl AsRef<std::path::Path>) {
1114        unsafe {
1115            ffi::gtk_print_operation_set_export_filename(
1116                self.as_ref().to_glib_none().0,
1117                filename.as_ref().to_glib_none().0,
1118            );
1119        }
1120    }
1121
1122    /// Sets whether there is a selection to print.
1123    ///
1124    /// Application has to set number of pages to which the selection
1125    /// will draw by [`set_n_pages()`][Self::set_n_pages()] in a callback of
1126    /// [`begin-print`][struct@crate::PrintOperation#begin-print].
1127    /// ## `has_selection`
1128    /// [`true`] indicates that a selection exists
1129    #[doc(alias = "gtk_print_operation_set_has_selection")]
1130    #[doc(alias = "has-selection")]
1131    fn set_has_selection(&self, has_selection: bool) {
1132        unsafe {
1133            ffi::gtk_print_operation_set_has_selection(
1134                self.as_ref().to_glib_none().0,
1135                has_selection.into_glib(),
1136            );
1137        }
1138    }
1139
1140    /// Sets the name of the print job. The name is used to identify
1141    /// the job (e.g. in monitoring applications like eggcups).
1142    ///
1143    /// If you don’t set a job name, GTK+ picks a default one by
1144    /// numbering successive print jobs.
1145    /// ## `job_name`
1146    /// a string that identifies the print job
1147    #[doc(alias = "gtk_print_operation_set_job_name")]
1148    #[doc(alias = "job-name")]
1149    fn set_job_name(&self, job_name: &str) {
1150        unsafe {
1151            ffi::gtk_print_operation_set_job_name(
1152                self.as_ref().to_glib_none().0,
1153                job_name.to_glib_none().0,
1154            );
1155        }
1156    }
1157
1158    /// Sets the number of pages in the document.
1159    ///
1160    /// This must be set to a positive number
1161    /// before the rendering starts. It may be set in a
1162    /// [`begin-print`][struct@crate::PrintOperation#begin-print] signal hander.
1163    ///
1164    /// Note that the page numbers passed to the
1165    /// [`request-page-setup`][struct@crate::PrintOperation#request-page-setup]
1166    /// and [`draw-page`][struct@crate::PrintOperation#draw-page] signals are 0-based, i.e. if
1167    /// the user chooses to print all pages, the last ::draw-page signal
1168    /// will be for page `n_pages` - 1.
1169    /// ## `n_pages`
1170    /// the number of pages
1171    #[doc(alias = "gtk_print_operation_set_n_pages")]
1172    #[doc(alias = "n-pages")]
1173    fn set_n_pages(&self, n_pages: i32) {
1174        unsafe {
1175            ffi::gtk_print_operation_set_n_pages(self.as_ref().to_glib_none().0, n_pages);
1176        }
1177    }
1178
1179    /// Sets the print settings for `self`. This is typically used to
1180    /// re-establish print settings from a previous print operation,
1181    /// see [`run()`][Self::run()].
1182    /// ## `print_settings`
1183    /// [`PrintSettings`][crate::PrintSettings]
1184    #[doc(alias = "gtk_print_operation_set_print_settings")]
1185    #[doc(alias = "print-settings")]
1186    fn set_print_settings(&self, print_settings: Option<&PrintSettings>) {
1187        unsafe {
1188            ffi::gtk_print_operation_set_print_settings(
1189                self.as_ref().to_glib_none().0,
1190                print_settings.to_glib_none().0,
1191            );
1192        }
1193    }
1194
1195    /// If `show_progress` is [`true`], the print operation will show a
1196    /// progress dialog during the print operation.
1197    /// ## `show_progress`
1198    /// [`true`] to show a progress dialog
1199    #[doc(alias = "gtk_print_operation_set_show_progress")]
1200    #[doc(alias = "show-progress")]
1201    fn set_show_progress(&self, show_progress: bool) {
1202        unsafe {
1203            ffi::gtk_print_operation_set_show_progress(
1204                self.as_ref().to_glib_none().0,
1205                show_progress.into_glib(),
1206            );
1207        }
1208    }
1209
1210    /// Sets whether selection is supported by [`PrintOperation`][crate::PrintOperation].
1211    /// ## `support_selection`
1212    /// [`true`] to support selection
1213    #[doc(alias = "gtk_print_operation_set_support_selection")]
1214    #[doc(alias = "support-selection")]
1215    fn set_support_selection(&self, support_selection: bool) {
1216        unsafe {
1217            ffi::gtk_print_operation_set_support_selection(
1218                self.as_ref().to_glib_none().0,
1219                support_selection.into_glib(),
1220            );
1221        }
1222    }
1223
1224    /// If track_status is [`true`], the print operation will try to continue report
1225    /// on the status of the print job in the printer queues and printer. This
1226    /// can allow your application to show things like “out of paper” issues,
1227    /// and when the print job actually reaches the printer.
1228    ///
1229    /// This function is often implemented using some form of polling, so it should
1230    /// not be enabled unless needed.
1231    /// ## `track_status`
1232    /// [`true`] to track status after printing
1233    #[doc(alias = "gtk_print_operation_set_track_print_status")]
1234    #[doc(alias = "track-print-status")]
1235    fn set_track_print_status(&self, track_status: bool) {
1236        unsafe {
1237            ffi::gtk_print_operation_set_track_print_status(
1238                self.as_ref().to_glib_none().0,
1239                track_status.into_glib(),
1240            );
1241        }
1242    }
1243
1244    /// Sets up the transformation for the cairo context obtained from
1245    /// [`PrintContext`][crate::PrintContext] in such a way that distances are measured in
1246    /// units of `unit`.
1247    /// ## `unit`
1248    /// the unit to use
1249    #[doc(alias = "gtk_print_operation_set_unit")]
1250    #[doc(alias = "unit")]
1251    fn set_unit(&self, unit: Unit) {
1252        unsafe {
1253            ffi::gtk_print_operation_set_unit(self.as_ref().to_glib_none().0, unit.into_glib());
1254        }
1255    }
1256
1257    /// If `full_page` is [`true`], the transformation for the cairo context
1258    /// obtained from [`PrintContext`][crate::PrintContext] puts the origin at the top left
1259    /// corner of the page (which may not be the top left corner of the
1260    /// sheet, depending on page orientation and the number of pages per
1261    /// sheet). Otherwise, the origin is at the top left corner of the
1262    /// imageable area (i.e. inside the margins).
1263    /// ## `full_page`
1264    /// [`true`] to set up the [`PrintContext`][crate::PrintContext] for the full page
1265    #[doc(alias = "gtk_print_operation_set_use_full_page")]
1266    #[doc(alias = "use-full-page")]
1267    fn set_use_full_page(&self, full_page: bool) {
1268        unsafe {
1269            ffi::gtk_print_operation_set_use_full_page(
1270                self.as_ref().to_glib_none().0,
1271                full_page.into_glib(),
1272            );
1273        }
1274    }
1275
1276    /// Determines whether the print operation may run asynchronously or not.
1277    ///
1278    /// Some systems don't support asynchronous printing, but those that do
1279    /// will return [`PrintOperationResult::InProgress`][crate::PrintOperationResult::InProgress] as the status, and
1280    /// emit the [`done`][struct@crate::PrintOperation#done] signal when the operation is actually
1281    /// done.
1282    ///
1283    /// The Windows port does not support asynchronous operation at all (this
1284    /// is unlikely to change). On other platforms, all actions except for
1285    /// [`PrintOperationAction::Export`][crate::PrintOperationAction::Export] support asynchronous operation.
1286    #[doc(alias = "allow-async")]
1287    fn allows_async(&self) -> bool {
1288        ObjectExt::property(self.as_ref(), "allow-async")
1289    }
1290
1291    /// The current page in the document.
1292    ///
1293    /// If this is set before [`run()`][Self::run()],
1294    /// the user will be able to select to print only the current page.
1295    ///
1296    /// Note that this only makes sense for pre-paginated documents.
1297    #[doc(alias = "current-page")]
1298    fn current_page(&self) -> i32 {
1299        ObjectExt::property(self.as_ref(), "current-page")
1300    }
1301
1302    /// Used as the label of the tab containing custom widgets.
1303    /// Note that this property may be ignored on some platforms.
1304    ///
1305    /// If this is [`None`], GTK+ uses a default label.
1306    #[doc(alias = "custom-tab-label")]
1307    fn custom_tab_label(&self) -> Option<glib::GString> {
1308        ObjectExt::property(self.as_ref(), "custom-tab-label")
1309    }
1310
1311    /// The name of a file to generate instead of showing the print dialog.
1312    /// Currently, PDF is the only supported format.
1313    ///
1314    /// The intended use of this property is for implementing
1315    /// “Export to PDF” actions.
1316    ///
1317    /// “Print to PDF” support is independent of this and is done
1318    /// by letting the user pick the “Print to PDF” item from the
1319    /// list of printers in the print dialog.
1320    #[doc(alias = "export-filename")]
1321    fn export_filename(&self) -> Option<glib::GString> {
1322        ObjectExt::property(self.as_ref(), "export-filename")
1323    }
1324
1325    /// A string used to identify the job (e.g. in monitoring
1326    /// applications like eggcups).
1327    ///
1328    /// If you don't set a job name, GTK+ picks a default one
1329    /// by numbering successive print jobs.
1330    #[doc(alias = "job-name")]
1331    fn job_name(&self) -> Option<glib::GString> {
1332        ObjectExt::property(self.as_ref(), "job-name")
1333    }
1334
1335    /// The number of pages in the document.
1336    ///
1337    /// This must be set to a positive number
1338    /// before the rendering starts. It may be set in a
1339    /// [`begin-print`][struct@crate::PrintOperation#begin-print] signal hander.
1340    ///
1341    /// Note that the page numbers passed to the
1342    /// [`request-page-setup`][struct@crate::PrintOperation#request-page-setup] and
1343    /// [`draw-page`][struct@crate::PrintOperation#draw-page] signals are 0-based, i.e. if
1344    /// the user chooses to print all pages, the last ::draw-page signal
1345    /// will be for page `n_pages` - 1.
1346    #[doc(alias = "n-pages")]
1347    fn n_pages(&self) -> i32 {
1348        ObjectExt::property(self.as_ref(), "n-pages")
1349    }
1350
1351    /// Determines whether to show a progress dialog during the
1352    /// print operation.
1353    #[doc(alias = "show-progress")]
1354    fn shows_progress(&self) -> bool {
1355        ObjectExt::property(self.as_ref(), "show-progress")
1356    }
1357
1358    /// If [`true`], the print operation will try to continue report on
1359    /// the status of the print job in the printer queues and printer.
1360    /// This can allow your application to show things like “out of paper”
1361    /// issues, and when the print job actually reaches the printer.
1362    /// However, this is often implemented using polling, and should
1363    /// not be enabled unless needed.
1364    #[doc(alias = "track-print-status")]
1365    fn tracks_print_status(&self) -> bool {
1366        ObjectExt::property(self.as_ref(), "track-print-status")
1367    }
1368
1369    /// The transformation for the cairo context obtained from
1370    /// [`PrintContext`][crate::PrintContext] is set up in such a way that distances
1371    /// are measured in units of `unit`.
1372    fn unit(&self) -> Unit {
1373        ObjectExt::property(self.as_ref(), "unit")
1374    }
1375
1376    /// If [`true`], the transformation for the cairo context obtained
1377    /// from [`PrintContext`][crate::PrintContext] puts the origin at the top left corner
1378    /// of the page (which may not be the top left corner of the sheet,
1379    /// depending on page orientation and the number of pages per sheet).
1380    /// Otherwise, the origin is at the top left corner of the imageable
1381    /// area (i.e. inside the margins).
1382    #[doc(alias = "use-full-page")]
1383    fn uses_full_page(&self) -> bool {
1384        ObjectExt::property(self.as_ref(), "use-full-page")
1385    }
1386
1387    /// Emitted after the user has finished changing print settings
1388    /// in the dialog, before the actual rendering starts.
1389    ///
1390    /// A typical use for ::begin-print is to use the parameters from the
1391    /// [`PrintContext`][crate::PrintContext] and paginate the document accordingly, and then
1392    /// set the number of pages with [`set_n_pages()`][Self::set_n_pages()].
1393    /// ## `context`
1394    /// the [`PrintContext`][crate::PrintContext] for the current operation
1395    #[doc(alias = "begin-print")]
1396    fn connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId {
1397        unsafe extern "C" fn begin_print_trampoline<
1398            P: IsA<PrintOperation>,
1399            F: Fn(&P, &PrintContext) + 'static,
1400        >(
1401            this: *mut ffi::GtkPrintOperation,
1402            context: *mut ffi::GtkPrintContext,
1403            f: glib::ffi::gpointer,
1404        ) {
1405            unsafe {
1406                let f: &F = &*(f as *const F);
1407                f(
1408                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1409                    &from_glib_borrow(context),
1410                )
1411            }
1412        }
1413        unsafe {
1414            let f: Box_<F> = Box_::new(f);
1415            connect_raw(
1416                self.as_ptr() as *mut _,
1417                c"begin-print".as_ptr(),
1418                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1419                    begin_print_trampoline::<Self, F> as *const (),
1420                )),
1421                Box_::into_raw(f),
1422            )
1423        }
1424    }
1425
1426    /// Emitted when displaying the print dialog. If you return a
1427    /// widget in a handler for this signal it will be added to a custom
1428    /// tab in the print dialog. You typically return a container widget
1429    /// with multiple widgets in it.
1430    ///
1431    /// The print dialog owns the returned widget, and its lifetime is not
1432    /// controlled by the application. However, the widget is guaranteed
1433    /// to stay around until the [`custom-widget-apply`][struct@crate::PrintOperation#custom-widget-apply]
1434    /// signal is emitted on the operation. Then you can read out any
1435    /// information you need from the widgets.
1436    ///
1437    /// # Returns
1438    ///
1439    /// A custom widget that gets embedded in
1440    ///  the print dialog, or [`None`]
1441    #[doc(alias = "create-custom-widget")]
1442    fn connect_create_custom_widget<F: Fn(&Self) -> glib::Object + 'static>(
1443        &self,
1444        f: F,
1445    ) -> SignalHandlerId {
1446        unsafe extern "C" fn create_custom_widget_trampoline<
1447            P: IsA<PrintOperation>,
1448            F: Fn(&P) -> glib::Object + 'static,
1449        >(
1450            this: *mut ffi::GtkPrintOperation,
1451            f: glib::ffi::gpointer,
1452        ) -> *mut glib::gobject_ffi::GObject {
1453            unsafe {
1454                let f: &F = &*(f as *const F);
1455                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) /*Not checked*/
1456                    .to_glib_none()
1457                    .0
1458            }
1459        }
1460        unsafe {
1461            let f: Box_<F> = Box_::new(f);
1462            connect_raw(
1463                self.as_ptr() as *mut _,
1464                c"create-custom-widget".as_ptr(),
1465                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1466                    create_custom_widget_trampoline::<Self, F> as *const (),
1467                )),
1468                Box_::into_raw(f),
1469            )
1470        }
1471    }
1472
1473    /// Emitted right before [`begin-print`][struct@crate::PrintOperation#begin-print] if you added
1474    /// a custom widget in the [`create-custom-widget`][struct@crate::PrintOperation#create-custom-widget] handler.
1475    /// When you get this signal you should read the information from the
1476    /// custom widgets, as the widgets are not guaraneed to be around at a
1477    /// later time.
1478    /// ## `widget`
1479    /// the custom widget added in create-custom-widget
1480    #[doc(alias = "custom-widget-apply")]
1481    fn connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>(
1482        &self,
1483        f: F,
1484    ) -> SignalHandlerId {
1485        unsafe extern "C" fn custom_widget_apply_trampoline<
1486            P: IsA<PrintOperation>,
1487            F: Fn(&P, &Widget) + 'static,
1488        >(
1489            this: *mut ffi::GtkPrintOperation,
1490            widget: *mut ffi::GtkWidget,
1491            f: glib::ffi::gpointer,
1492        ) {
1493            unsafe {
1494                let f: &F = &*(f as *const F);
1495                f(
1496                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1497                    &from_glib_borrow(widget),
1498                )
1499            }
1500        }
1501        unsafe {
1502            let f: Box_<F> = Box_::new(f);
1503            connect_raw(
1504                self.as_ptr() as *mut _,
1505                c"custom-widget-apply".as_ptr(),
1506                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1507                    custom_widget_apply_trampoline::<Self, F> as *const (),
1508                )),
1509                Box_::into_raw(f),
1510            )
1511        }
1512    }
1513
1514    /// Emitted when the print operation run has finished doing
1515    /// everything required for printing.
1516    ///
1517    /// `result` gives you information about what happened during the run.
1518    /// If `result` is [`PrintOperationResult::Error`][crate::PrintOperationResult::Error] then you can call
1519    /// `gtk_print_operation_get_error()` for more information.
1520    ///
1521    /// If you enabled print status tracking then
1522    /// [`is_finished()`][Self::is_finished()] may still return [`false`]
1523    /// after [`done`][struct@crate::PrintOperation#done] was emitted.
1524    /// ## `result`
1525    /// the result of the print operation
1526    #[doc(alias = "done")]
1527    fn connect_done<F: Fn(&Self, PrintOperationResult) + 'static>(&self, f: F) -> SignalHandlerId {
1528        unsafe extern "C" fn done_trampoline<
1529            P: IsA<PrintOperation>,
1530            F: Fn(&P, PrintOperationResult) + 'static,
1531        >(
1532            this: *mut ffi::GtkPrintOperation,
1533            result: ffi::GtkPrintOperationResult,
1534            f: glib::ffi::gpointer,
1535        ) {
1536            unsafe {
1537                let f: &F = &*(f as *const F);
1538                f(
1539                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1540                    from_glib(result),
1541                )
1542            }
1543        }
1544        unsafe {
1545            let f: Box_<F> = Box_::new(f);
1546            connect_raw(
1547                self.as_ptr() as *mut _,
1548                c"done".as_ptr(),
1549                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1550                    done_trampoline::<Self, F> as *const (),
1551                )),
1552                Box_::into_raw(f),
1553            )
1554        }
1555    }
1556
1557    /// Emitted for every page that is printed. The signal handler
1558    /// must render the `page_nr`'s page onto the cairo context obtained
1559    /// from `context` using [`PrintContext::cairo_context()`][crate::PrintContext::cairo_context()].
1560    ///
1561    ///
1562    /// **⚠️ The following code is in C ⚠️**
1563    ///
1564    /// ```C
1565    /// static void
1566    /// draw_page (GtkPrintOperation *operation,
1567    ///            GtkPrintContext   *context,
1568    ///            gint               page_nr,
1569    ///            gpointer           user_data)
1570    /// {
1571    ///   cairo_t *cr;
1572    ///   PangoLayout *layout;
1573    ///   gdouble width, text_height;
1574    ///   gint layout_height;
1575    ///   PangoFontDescription *desc;
1576    ///
1577    ///   cr = gtk_print_context_get_cairo_context (context);
1578    ///   width = gtk_print_context_get_width (context);
1579    ///
1580    ///   cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
1581    ///
1582    ///   cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
1583    ///   cairo_fill (cr);
1584    ///
1585    ///   layout = gtk_print_context_create_pango_layout (context);
1586    ///
1587    ///   desc = pango_font_description_from_string ("sans 14");
1588    ///   pango_layout_set_font_description (layout, desc);
1589    ///   pango_font_description_free (desc);
1590    ///
1591    ///   pango_layout_set_text (layout, "some text", -1);
1592    ///   pango_layout_set_width (layout, width * PANGO_SCALE);
1593    ///   pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
1594    ///
1595    ///   pango_layout_get_size (layout, NULL, &layout_height);
1596    ///   text_height = (gdouble)layout_height / PANGO_SCALE;
1597    ///
1598    ///   cairo_move_to (cr, width / 2,  (HEADER_HEIGHT - text_height) / 2);
1599    ///   pango_cairo_show_layout (cr, layout);
1600    ///
1601    ///   g_object_unref (layout);
1602    /// }
1603    /// ```
1604    ///
1605    /// Use [`set_use_full_page()`][Self::set_use_full_page()] and
1606    /// [`set_unit()`][Self::set_unit()] before starting the print operation
1607    /// to set up the transformation of the cairo context according to your
1608    /// needs.
1609    /// ## `context`
1610    /// the [`PrintContext`][crate::PrintContext] for the current operation
1611    /// ## `page_nr`
1612    /// the number of the currently printed page (0-based)
1613    #[doc(alias = "draw-page")]
1614    fn connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>(
1615        &self,
1616        f: F,
1617    ) -> SignalHandlerId {
1618        unsafe extern "C" fn draw_page_trampoline<
1619            P: IsA<PrintOperation>,
1620            F: Fn(&P, &PrintContext, i32) + 'static,
1621        >(
1622            this: *mut ffi::GtkPrintOperation,
1623            context: *mut ffi::GtkPrintContext,
1624            page_nr: std::ffi::c_int,
1625            f: glib::ffi::gpointer,
1626        ) {
1627            unsafe {
1628                let f: &F = &*(f as *const F);
1629                f(
1630                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1631                    &from_glib_borrow(context),
1632                    page_nr,
1633                )
1634            }
1635        }
1636        unsafe {
1637            let f: Box_<F> = Box_::new(f);
1638            connect_raw(
1639                self.as_ptr() as *mut _,
1640                c"draw-page".as_ptr(),
1641                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1642                    draw_page_trampoline::<Self, F> as *const (),
1643                )),
1644                Box_::into_raw(f),
1645            )
1646        }
1647    }
1648
1649    /// Emitted after all pages have been rendered.
1650    /// A handler for this signal can clean up any resources that have
1651    /// been allocated in the [`begin-print`][struct@crate::PrintOperation#begin-print] handler.
1652    /// ## `context`
1653    /// the [`PrintContext`][crate::PrintContext] for the current operation
1654    #[doc(alias = "end-print")]
1655    fn connect_end_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId {
1656        unsafe extern "C" fn end_print_trampoline<
1657            P: IsA<PrintOperation>,
1658            F: Fn(&P, &PrintContext) + 'static,
1659        >(
1660            this: *mut ffi::GtkPrintOperation,
1661            context: *mut ffi::GtkPrintContext,
1662            f: glib::ffi::gpointer,
1663        ) {
1664            unsafe {
1665                let f: &F = &*(f as *const F);
1666                f(
1667                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1668                    &from_glib_borrow(context),
1669                )
1670            }
1671        }
1672        unsafe {
1673            let f: Box_<F> = Box_::new(f);
1674            connect_raw(
1675                self.as_ptr() as *mut _,
1676                c"end-print".as_ptr(),
1677                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1678                    end_print_trampoline::<Self, F> as *const (),
1679                )),
1680                Box_::into_raw(f),
1681            )
1682        }
1683    }
1684
1685    /// Emitted after the [`begin-print`][struct@crate::PrintOperation#begin-print] signal, but before
1686    /// the actual rendering starts. It keeps getting emitted until a connected
1687    /// signal handler returns [`true`].
1688    ///
1689    /// The ::paginate signal is intended to be used for paginating a document
1690    /// in small chunks, to avoid blocking the user interface for a long
1691    /// time. The signal handler should update the number of pages using
1692    /// [`set_n_pages()`][Self::set_n_pages()], and return [`true`] if the document
1693    /// has been completely paginated.
1694    ///
1695    /// If you don't need to do pagination in chunks, you can simply do
1696    /// it all in the ::begin-print handler, and set the number of pages
1697    /// from there.
1698    /// ## `context`
1699    /// the [`PrintContext`][crate::PrintContext] for the current operation
1700    ///
1701    /// # Returns
1702    ///
1703    /// [`true`] if pagination is complete
1704    #[doc(alias = "paginate")]
1705    fn connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>(
1706        &self,
1707        f: F,
1708    ) -> SignalHandlerId {
1709        unsafe extern "C" fn paginate_trampoline<
1710            P: IsA<PrintOperation>,
1711            F: Fn(&P, &PrintContext) -> bool + 'static,
1712        >(
1713            this: *mut ffi::GtkPrintOperation,
1714            context: *mut ffi::GtkPrintContext,
1715            f: glib::ffi::gpointer,
1716        ) -> glib::ffi::gboolean {
1717            unsafe {
1718                let f: &F = &*(f as *const F);
1719                f(
1720                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1721                    &from_glib_borrow(context),
1722                )
1723                .into_glib()
1724            }
1725        }
1726        unsafe {
1727            let f: Box_<F> = Box_::new(f);
1728            connect_raw(
1729                self.as_ptr() as *mut _,
1730                c"paginate".as_ptr(),
1731                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1732                    paginate_trampoline::<Self, F> as *const (),
1733                )),
1734                Box_::into_raw(f),
1735            )
1736        }
1737    }
1738
1739    /// Gets emitted when a preview is requested from the native dialog.
1740    ///
1741    /// The default handler for this signal uses an external viewer
1742    /// application to preview.
1743    ///
1744    /// To implement a custom print preview, an application must return
1745    /// [`true`] from its handler for this signal. In order to use the
1746    /// provided `context` for the preview implementation, it must be
1747    /// given a suitable cairo context with [`PrintContext::set_cairo_context()`][crate::PrintContext::set_cairo_context()].
1748    ///
1749    /// The custom preview implementation can use
1750    /// [`PrintOperationPreviewExt::is_selected()`][crate::prelude::PrintOperationPreviewExt::is_selected()] and
1751    /// [`PrintOperationPreviewExt::render_page()`][crate::prelude::PrintOperationPreviewExt::render_page()] to find pages which
1752    /// are selected for print and render them. The preview must be
1753    /// finished by calling [`PrintOperationPreviewExt::end_preview()`][crate::prelude::PrintOperationPreviewExt::end_preview()]
1754    /// (typically in response to the user clicking a close button).
1755    /// ## `preview`
1756    /// the [`PrintOperationPreview`][crate::PrintOperationPreview] for the current operation
1757    /// ## `context`
1758    /// the [`PrintContext`][crate::PrintContext] that will be used
1759    /// ## `parent`
1760    /// the [`Window`][crate::Window] to use as window parent, or [`None`]
1761    ///
1762    /// # Returns
1763    ///
1764    /// [`true`] if the listener wants to take over control of the preview
1765    #[doc(alias = "preview")]
1766    fn connect_preview<
1767        F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static,
1768    >(
1769        &self,
1770        f: F,
1771    ) -> SignalHandlerId {
1772        unsafe extern "C" fn preview_trampoline<
1773            P: IsA<PrintOperation>,
1774            F: Fn(&P, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static,
1775        >(
1776            this: *mut ffi::GtkPrintOperation,
1777            preview: *mut ffi::GtkPrintOperationPreview,
1778            context: *mut ffi::GtkPrintContext,
1779            parent: *mut ffi::GtkWindow,
1780            f: glib::ffi::gpointer,
1781        ) -> glib::ffi::gboolean {
1782            unsafe {
1783                let f: &F = &*(f as *const F);
1784                f(
1785                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1786                    &from_glib_borrow(preview),
1787                    &from_glib_borrow(context),
1788                    Option::<Window>::from_glib_borrow(parent).as_ref().as_ref(),
1789                )
1790                .into_glib()
1791            }
1792        }
1793        unsafe {
1794            let f: Box_<F> = Box_::new(f);
1795            connect_raw(
1796                self.as_ptr() as *mut _,
1797                c"preview".as_ptr(),
1798                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1799                    preview_trampoline::<Self, F> as *const (),
1800                )),
1801                Box_::into_raw(f),
1802            )
1803        }
1804    }
1805
1806    /// Emitted once for every page that is printed, to give
1807    /// the application a chance to modify the page setup. Any changes
1808    /// done to `setup` will be in force only for printing this page.
1809    /// ## `context`
1810    /// the [`PrintContext`][crate::PrintContext] for the current operation
1811    /// ## `page_nr`
1812    /// the number of the currently printed page (0-based)
1813    /// ## `setup`
1814    /// the [`PageSetup`][crate::PageSetup]
1815    #[doc(alias = "request-page-setup")]
1816    fn connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>(
1817        &self,
1818        f: F,
1819    ) -> SignalHandlerId {
1820        unsafe extern "C" fn request_page_setup_trampoline<
1821            P: IsA<PrintOperation>,
1822            F: Fn(&P, &PrintContext, i32, &PageSetup) + 'static,
1823        >(
1824            this: *mut ffi::GtkPrintOperation,
1825            context: *mut ffi::GtkPrintContext,
1826            page_nr: std::ffi::c_int,
1827            setup: *mut ffi::GtkPageSetup,
1828            f: glib::ffi::gpointer,
1829        ) {
1830            unsafe {
1831                let f: &F = &*(f as *const F);
1832                f(
1833                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1834                    &from_glib_borrow(context),
1835                    page_nr,
1836                    &from_glib_borrow(setup),
1837                )
1838            }
1839        }
1840        unsafe {
1841            let f: Box_<F> = Box_::new(f);
1842            connect_raw(
1843                self.as_ptr() as *mut _,
1844                c"request-page-setup".as_ptr(),
1845                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1846                    request_page_setup_trampoline::<Self, F> as *const (),
1847                )),
1848                Box_::into_raw(f),
1849            )
1850        }
1851    }
1852
1853    /// Emitted at between the various phases of the print operation.
1854    /// See [`PrintStatus`][crate::PrintStatus] for the phases that are being discriminated.
1855    /// Use [`status()`][Self::status()] to find out the current
1856    /// status.
1857    #[doc(alias = "status-changed")]
1858    fn connect_status_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1859        unsafe extern "C" fn status_changed_trampoline<
1860            P: IsA<PrintOperation>,
1861            F: Fn(&P) + 'static,
1862        >(
1863            this: *mut ffi::GtkPrintOperation,
1864            f: glib::ffi::gpointer,
1865        ) {
1866            unsafe {
1867                let f: &F = &*(f as *const F);
1868                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
1869            }
1870        }
1871        unsafe {
1872            let f: Box_<F> = Box_::new(f);
1873            connect_raw(
1874                self.as_ptr() as *mut _,
1875                c"status-changed".as_ptr(),
1876                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1877                    status_changed_trampoline::<Self, F> as *const (),
1878                )),
1879                Box_::into_raw(f),
1880            )
1881        }
1882    }
1883
1884    /// Emitted after change of selected printer. The actual page setup and
1885    /// print settings are passed to the custom widget, which can actualize
1886    /// itself according to this change.
1887    /// ## `widget`
1888    /// the custom widget added in create-custom-widget
1889    /// ## `setup`
1890    /// actual page setup
1891    /// ## `settings`
1892    /// actual print settings
1893    #[doc(alias = "update-custom-widget")]
1894    fn connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>(
1895        &self,
1896        f: F,
1897    ) -> SignalHandlerId {
1898        unsafe extern "C" fn update_custom_widget_trampoline<
1899            P: IsA<PrintOperation>,
1900            F: Fn(&P, &Widget, &PageSetup, &PrintSettings) + 'static,
1901        >(
1902            this: *mut ffi::GtkPrintOperation,
1903            widget: *mut ffi::GtkWidget,
1904            setup: *mut ffi::GtkPageSetup,
1905            settings: *mut ffi::GtkPrintSettings,
1906            f: glib::ffi::gpointer,
1907        ) {
1908            unsafe {
1909                let f: &F = &*(f as *const F);
1910                f(
1911                    PrintOperation::from_glib_borrow(this).unsafe_cast_ref(),
1912                    &from_glib_borrow(widget),
1913                    &from_glib_borrow(setup),
1914                    &from_glib_borrow(settings),
1915                )
1916            }
1917        }
1918        unsafe {
1919            let f: Box_<F> = Box_::new(f);
1920            connect_raw(
1921                self.as_ptr() as *mut _,
1922                c"update-custom-widget".as_ptr(),
1923                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1924                    update_custom_widget_trampoline::<Self, F> as *const (),
1925                )),
1926                Box_::into_raw(f),
1927            )
1928        }
1929    }
1930
1931    #[doc(alias = "allow-async")]
1932    fn connect_allow_async_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1933        unsafe extern "C" fn notify_allow_async_trampoline<
1934            P: IsA<PrintOperation>,
1935            F: Fn(&P) + 'static,
1936        >(
1937            this: *mut ffi::GtkPrintOperation,
1938            _param_spec: glib::ffi::gpointer,
1939            f: glib::ffi::gpointer,
1940        ) {
1941            unsafe {
1942                let f: &F = &*(f as *const F);
1943                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
1944            }
1945        }
1946        unsafe {
1947            let f: Box_<F> = Box_::new(f);
1948            connect_raw(
1949                self.as_ptr() as *mut _,
1950                c"notify::allow-async".as_ptr(),
1951                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1952                    notify_allow_async_trampoline::<Self, F> as *const (),
1953                )),
1954                Box_::into_raw(f),
1955            )
1956        }
1957    }
1958
1959    #[doc(alias = "current-page")]
1960    fn connect_current_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1961        unsafe extern "C" fn notify_current_page_trampoline<
1962            P: IsA<PrintOperation>,
1963            F: Fn(&P) + 'static,
1964        >(
1965            this: *mut ffi::GtkPrintOperation,
1966            _param_spec: glib::ffi::gpointer,
1967            f: glib::ffi::gpointer,
1968        ) {
1969            unsafe {
1970                let f: &F = &*(f as *const F);
1971                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
1972            }
1973        }
1974        unsafe {
1975            let f: Box_<F> = Box_::new(f);
1976            connect_raw(
1977                self.as_ptr() as *mut _,
1978                c"notify::current-page".as_ptr(),
1979                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1980                    notify_current_page_trampoline::<Self, F> as *const (),
1981                )),
1982                Box_::into_raw(f),
1983            )
1984        }
1985    }
1986
1987    #[doc(alias = "custom-tab-label")]
1988    fn connect_custom_tab_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1989        unsafe extern "C" fn notify_custom_tab_label_trampoline<
1990            P: IsA<PrintOperation>,
1991            F: Fn(&P) + 'static,
1992        >(
1993            this: *mut ffi::GtkPrintOperation,
1994            _param_spec: glib::ffi::gpointer,
1995            f: glib::ffi::gpointer,
1996        ) {
1997            unsafe {
1998                let f: &F = &*(f as *const F);
1999                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2000            }
2001        }
2002        unsafe {
2003            let f: Box_<F> = Box_::new(f);
2004            connect_raw(
2005                self.as_ptr() as *mut _,
2006                c"notify::custom-tab-label".as_ptr(),
2007                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2008                    notify_custom_tab_label_trampoline::<Self, F> as *const (),
2009                )),
2010                Box_::into_raw(f),
2011            )
2012        }
2013    }
2014
2015    #[doc(alias = "default-page-setup")]
2016    fn connect_default_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2017        unsafe extern "C" fn notify_default_page_setup_trampoline<
2018            P: IsA<PrintOperation>,
2019            F: Fn(&P) + 'static,
2020        >(
2021            this: *mut ffi::GtkPrintOperation,
2022            _param_spec: glib::ffi::gpointer,
2023            f: glib::ffi::gpointer,
2024        ) {
2025            unsafe {
2026                let f: &F = &*(f as *const F);
2027                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2028            }
2029        }
2030        unsafe {
2031            let f: Box_<F> = Box_::new(f);
2032            connect_raw(
2033                self.as_ptr() as *mut _,
2034                c"notify::default-page-setup".as_ptr(),
2035                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2036                    notify_default_page_setup_trampoline::<Self, F> as *const (),
2037                )),
2038                Box_::into_raw(f),
2039            )
2040        }
2041    }
2042
2043    #[doc(alias = "embed-page-setup")]
2044    fn connect_embed_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2045        unsafe extern "C" fn notify_embed_page_setup_trampoline<
2046            P: IsA<PrintOperation>,
2047            F: Fn(&P) + 'static,
2048        >(
2049            this: *mut ffi::GtkPrintOperation,
2050            _param_spec: glib::ffi::gpointer,
2051            f: glib::ffi::gpointer,
2052        ) {
2053            unsafe {
2054                let f: &F = &*(f as *const F);
2055                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2056            }
2057        }
2058        unsafe {
2059            let f: Box_<F> = Box_::new(f);
2060            connect_raw(
2061                self.as_ptr() as *mut _,
2062                c"notify::embed-page-setup".as_ptr(),
2063                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2064                    notify_embed_page_setup_trampoline::<Self, F> as *const (),
2065                )),
2066                Box_::into_raw(f),
2067            )
2068        }
2069    }
2070
2071    #[doc(alias = "export-filename")]
2072    fn connect_export_filename_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2073        unsafe extern "C" fn notify_export_filename_trampoline<
2074            P: IsA<PrintOperation>,
2075            F: Fn(&P) + 'static,
2076        >(
2077            this: *mut ffi::GtkPrintOperation,
2078            _param_spec: glib::ffi::gpointer,
2079            f: glib::ffi::gpointer,
2080        ) {
2081            unsafe {
2082                let f: &F = &*(f as *const F);
2083                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2084            }
2085        }
2086        unsafe {
2087            let f: Box_<F> = Box_::new(f);
2088            connect_raw(
2089                self.as_ptr() as *mut _,
2090                c"notify::export-filename".as_ptr(),
2091                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2092                    notify_export_filename_trampoline::<Self, F> as *const (),
2093                )),
2094                Box_::into_raw(f),
2095            )
2096        }
2097    }
2098
2099    #[doc(alias = "has-selection")]
2100    fn connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2101        unsafe extern "C" fn notify_has_selection_trampoline<
2102            P: IsA<PrintOperation>,
2103            F: Fn(&P) + 'static,
2104        >(
2105            this: *mut ffi::GtkPrintOperation,
2106            _param_spec: glib::ffi::gpointer,
2107            f: glib::ffi::gpointer,
2108        ) {
2109            unsafe {
2110                let f: &F = &*(f as *const F);
2111                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2112            }
2113        }
2114        unsafe {
2115            let f: Box_<F> = Box_::new(f);
2116            connect_raw(
2117                self.as_ptr() as *mut _,
2118                c"notify::has-selection".as_ptr(),
2119                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2120                    notify_has_selection_trampoline::<Self, F> as *const (),
2121                )),
2122                Box_::into_raw(f),
2123            )
2124        }
2125    }
2126
2127    #[doc(alias = "job-name")]
2128    fn connect_job_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2129        unsafe extern "C" fn notify_job_name_trampoline<
2130            P: IsA<PrintOperation>,
2131            F: Fn(&P) + 'static,
2132        >(
2133            this: *mut ffi::GtkPrintOperation,
2134            _param_spec: glib::ffi::gpointer,
2135            f: glib::ffi::gpointer,
2136        ) {
2137            unsafe {
2138                let f: &F = &*(f as *const F);
2139                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2140            }
2141        }
2142        unsafe {
2143            let f: Box_<F> = Box_::new(f);
2144            connect_raw(
2145                self.as_ptr() as *mut _,
2146                c"notify::job-name".as_ptr(),
2147                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2148                    notify_job_name_trampoline::<Self, F> as *const (),
2149                )),
2150                Box_::into_raw(f),
2151            )
2152        }
2153    }
2154
2155    #[doc(alias = "n-pages")]
2156    fn connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2157        unsafe extern "C" fn notify_n_pages_trampoline<
2158            P: IsA<PrintOperation>,
2159            F: Fn(&P) + 'static,
2160        >(
2161            this: *mut ffi::GtkPrintOperation,
2162            _param_spec: glib::ffi::gpointer,
2163            f: glib::ffi::gpointer,
2164        ) {
2165            unsafe {
2166                let f: &F = &*(f as *const F);
2167                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2168            }
2169        }
2170        unsafe {
2171            let f: Box_<F> = Box_::new(f);
2172            connect_raw(
2173                self.as_ptr() as *mut _,
2174                c"notify::n-pages".as_ptr(),
2175                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2176                    notify_n_pages_trampoline::<Self, F> as *const (),
2177                )),
2178                Box_::into_raw(f),
2179            )
2180        }
2181    }
2182
2183    #[doc(alias = "n-pages-to-print")]
2184    fn connect_n_pages_to_print_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2185        unsafe extern "C" fn notify_n_pages_to_print_trampoline<
2186            P: IsA<PrintOperation>,
2187            F: Fn(&P) + 'static,
2188        >(
2189            this: *mut ffi::GtkPrintOperation,
2190            _param_spec: glib::ffi::gpointer,
2191            f: glib::ffi::gpointer,
2192        ) {
2193            unsafe {
2194                let f: &F = &*(f as *const F);
2195                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2196            }
2197        }
2198        unsafe {
2199            let f: Box_<F> = Box_::new(f);
2200            connect_raw(
2201                self.as_ptr() as *mut _,
2202                c"notify::n-pages-to-print".as_ptr(),
2203                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2204                    notify_n_pages_to_print_trampoline::<Self, F> as *const (),
2205                )),
2206                Box_::into_raw(f),
2207            )
2208        }
2209    }
2210
2211    #[doc(alias = "print-settings")]
2212    fn connect_print_settings_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2213        unsafe extern "C" fn notify_print_settings_trampoline<
2214            P: IsA<PrintOperation>,
2215            F: Fn(&P) + 'static,
2216        >(
2217            this: *mut ffi::GtkPrintOperation,
2218            _param_spec: glib::ffi::gpointer,
2219            f: glib::ffi::gpointer,
2220        ) {
2221            unsafe {
2222                let f: &F = &*(f as *const F);
2223                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2224            }
2225        }
2226        unsafe {
2227            let f: Box_<F> = Box_::new(f);
2228            connect_raw(
2229                self.as_ptr() as *mut _,
2230                c"notify::print-settings".as_ptr(),
2231                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2232                    notify_print_settings_trampoline::<Self, F> as *const (),
2233                )),
2234                Box_::into_raw(f),
2235            )
2236        }
2237    }
2238
2239    #[doc(alias = "show-progress")]
2240    fn connect_show_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2241        unsafe extern "C" fn notify_show_progress_trampoline<
2242            P: IsA<PrintOperation>,
2243            F: Fn(&P) + 'static,
2244        >(
2245            this: *mut ffi::GtkPrintOperation,
2246            _param_spec: glib::ffi::gpointer,
2247            f: glib::ffi::gpointer,
2248        ) {
2249            unsafe {
2250                let f: &F = &*(f as *const F);
2251                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2252            }
2253        }
2254        unsafe {
2255            let f: Box_<F> = Box_::new(f);
2256            connect_raw(
2257                self.as_ptr() as *mut _,
2258                c"notify::show-progress".as_ptr(),
2259                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2260                    notify_show_progress_trampoline::<Self, F> as *const (),
2261                )),
2262                Box_::into_raw(f),
2263            )
2264        }
2265    }
2266
2267    #[doc(alias = "status")]
2268    fn connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2269        unsafe extern "C" fn notify_status_trampoline<
2270            P: IsA<PrintOperation>,
2271            F: Fn(&P) + 'static,
2272        >(
2273            this: *mut ffi::GtkPrintOperation,
2274            _param_spec: glib::ffi::gpointer,
2275            f: glib::ffi::gpointer,
2276        ) {
2277            unsafe {
2278                let f: &F = &*(f as *const F);
2279                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2280            }
2281        }
2282        unsafe {
2283            let f: Box_<F> = Box_::new(f);
2284            connect_raw(
2285                self.as_ptr() as *mut _,
2286                c"notify::status".as_ptr(),
2287                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2288                    notify_status_trampoline::<Self, F> as *const (),
2289                )),
2290                Box_::into_raw(f),
2291            )
2292        }
2293    }
2294
2295    #[doc(alias = "status-string")]
2296    fn connect_status_string_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2297        unsafe extern "C" fn notify_status_string_trampoline<
2298            P: IsA<PrintOperation>,
2299            F: Fn(&P) + 'static,
2300        >(
2301            this: *mut ffi::GtkPrintOperation,
2302            _param_spec: glib::ffi::gpointer,
2303            f: glib::ffi::gpointer,
2304        ) {
2305            unsafe {
2306                let f: &F = &*(f as *const F);
2307                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2308            }
2309        }
2310        unsafe {
2311            let f: Box_<F> = Box_::new(f);
2312            connect_raw(
2313                self.as_ptr() as *mut _,
2314                c"notify::status-string".as_ptr(),
2315                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2316                    notify_status_string_trampoline::<Self, F> as *const (),
2317                )),
2318                Box_::into_raw(f),
2319            )
2320        }
2321    }
2322
2323    #[doc(alias = "support-selection")]
2324    fn connect_support_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2325        unsafe extern "C" fn notify_support_selection_trampoline<
2326            P: IsA<PrintOperation>,
2327            F: Fn(&P) + 'static,
2328        >(
2329            this: *mut ffi::GtkPrintOperation,
2330            _param_spec: glib::ffi::gpointer,
2331            f: glib::ffi::gpointer,
2332        ) {
2333            unsafe {
2334                let f: &F = &*(f as *const F);
2335                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2336            }
2337        }
2338        unsafe {
2339            let f: Box_<F> = Box_::new(f);
2340            connect_raw(
2341                self.as_ptr() as *mut _,
2342                c"notify::support-selection".as_ptr(),
2343                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2344                    notify_support_selection_trampoline::<Self, F> as *const (),
2345                )),
2346                Box_::into_raw(f),
2347            )
2348        }
2349    }
2350
2351    #[doc(alias = "track-print-status")]
2352    fn connect_track_print_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2353        unsafe extern "C" fn notify_track_print_status_trampoline<
2354            P: IsA<PrintOperation>,
2355            F: Fn(&P) + 'static,
2356        >(
2357            this: *mut ffi::GtkPrintOperation,
2358            _param_spec: glib::ffi::gpointer,
2359            f: glib::ffi::gpointer,
2360        ) {
2361            unsafe {
2362                let f: &F = &*(f as *const F);
2363                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2364            }
2365        }
2366        unsafe {
2367            let f: Box_<F> = Box_::new(f);
2368            connect_raw(
2369                self.as_ptr() as *mut _,
2370                c"notify::track-print-status".as_ptr(),
2371                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2372                    notify_track_print_status_trampoline::<Self, F> as *const (),
2373                )),
2374                Box_::into_raw(f),
2375            )
2376        }
2377    }
2378
2379    #[doc(alias = "unit")]
2380    fn connect_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2381        unsafe extern "C" fn notify_unit_trampoline<P: IsA<PrintOperation>, F: Fn(&P) + 'static>(
2382            this: *mut ffi::GtkPrintOperation,
2383            _param_spec: glib::ffi::gpointer,
2384            f: glib::ffi::gpointer,
2385        ) {
2386            unsafe {
2387                let f: &F = &*(f as *const F);
2388                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2389            }
2390        }
2391        unsafe {
2392            let f: Box_<F> = Box_::new(f);
2393            connect_raw(
2394                self.as_ptr() as *mut _,
2395                c"notify::unit".as_ptr(),
2396                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2397                    notify_unit_trampoline::<Self, F> as *const (),
2398                )),
2399                Box_::into_raw(f),
2400            )
2401        }
2402    }
2403
2404    #[doc(alias = "use-full-page")]
2405    fn connect_use_full_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2406        unsafe extern "C" fn notify_use_full_page_trampoline<
2407            P: IsA<PrintOperation>,
2408            F: Fn(&P) + 'static,
2409        >(
2410            this: *mut ffi::GtkPrintOperation,
2411            _param_spec: glib::ffi::gpointer,
2412            f: glib::ffi::gpointer,
2413        ) {
2414            unsafe {
2415                let f: &F = &*(f as *const F);
2416                f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref())
2417            }
2418        }
2419        unsafe {
2420            let f: Box_<F> = Box_::new(f);
2421            connect_raw(
2422                self.as_ptr() as *mut _,
2423                c"notify::use-full-page".as_ptr(),
2424                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2425                    notify_use_full_page_trampoline::<Self, F> as *const (),
2426                )),
2427                Box_::into_raw(f),
2428            )
2429        }
2430    }
2431}
2432
2433impl<O: IsA<PrintOperation>> PrintOperationExt for O {}