Skip to main content

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