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