1use glib;
6use glib::object::Cast;
7use glib::object::IsA;
8use glib::signal::connect_raw;
9use glib::signal::SignalHandlerId;
10use glib::translate::*;
11use glib::GString;
12use glib::StaticType;
13use glib::ToValue;
14use glib::Value;
15use glib_sys;
16use gobject_sys;
17use gtk_sys;
18use libc;
19use std;
20use std::boxed::Box as Box_;
21use std::fmt;
22use std::mem::transmute;
23use std::ptr;
24use Error;
25use PageSetup;
26use PrintContext;
27use PrintOperationAction;
28use PrintOperationPreview;
29use PrintOperationResult;
30use PrintSettings;
31use PrintStatus;
32use Unit;
33use Widget;
34use Window;
35
36glib_wrapper! {
37 pub struct PrintOperation(Object<gtk_sys::GtkPrintOperation, gtk_sys::GtkPrintOperationClass, PrintOperationClass>) @implements PrintOperationPreview;
38
39 match fn {
40 get_type => || gtk_sys::gtk_print_operation_get_type(),
41 }
42}
43
44impl PrintOperation {
45 pub fn new() -> PrintOperation {
46 assert_initialized_main_thread!();
47 unsafe { from_glib_full(gtk_sys::gtk_print_operation_new()) }
48 }
49}
50
51impl Default for PrintOperation {
52 fn default() -> Self {
53 Self::new()
54 }
55}
56
57pub struct PrintOperationBuilder {
58 allow_async: Option<bool>,
59 current_page: Option<i32>,
60 custom_tab_label: Option<String>,
61 default_page_setup: Option<PageSetup>,
62 embed_page_setup: Option<bool>,
63 export_filename: Option<String>,
64 has_selection: Option<bool>,
65 job_name: Option<String>,
66 n_pages: Option<i32>,
67 print_settings: Option<PrintSettings>,
68 show_progress: Option<bool>,
69 support_selection: Option<bool>,
70 track_print_status: Option<bool>,
71 unit: Option<Unit>,
72 use_full_page: Option<bool>,
73}
74
75impl PrintOperationBuilder {
76 pub fn new() -> Self {
77 Self {
78 allow_async: None,
79 current_page: None,
80 custom_tab_label: None,
81 default_page_setup: None,
82 embed_page_setup: None,
83 export_filename: None,
84 has_selection: None,
85 job_name: None,
86 n_pages: None,
87 print_settings: None,
88 show_progress: None,
89 support_selection: None,
90 track_print_status: None,
91 unit: None,
92 use_full_page: None,
93 }
94 }
95
96 pub fn build(self) -> PrintOperation {
97 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
98 if let Some(ref allow_async) = self.allow_async {
99 properties.push(("allow-async", allow_async));
100 }
101 if let Some(ref current_page) = self.current_page {
102 properties.push(("current-page", current_page));
103 }
104 if let Some(ref custom_tab_label) = self.custom_tab_label {
105 properties.push(("custom-tab-label", custom_tab_label));
106 }
107 if let Some(ref default_page_setup) = self.default_page_setup {
108 properties.push(("default-page-setup", default_page_setup));
109 }
110 if let Some(ref embed_page_setup) = self.embed_page_setup {
111 properties.push(("embed-page-setup", embed_page_setup));
112 }
113 if let Some(ref export_filename) = self.export_filename {
114 properties.push(("export-filename", export_filename));
115 }
116 if let Some(ref has_selection) = self.has_selection {
117 properties.push(("has-selection", has_selection));
118 }
119 if let Some(ref job_name) = self.job_name {
120 properties.push(("job-name", job_name));
121 }
122 if let Some(ref n_pages) = self.n_pages {
123 properties.push(("n-pages", n_pages));
124 }
125 if let Some(ref print_settings) = self.print_settings {
126 properties.push(("print-settings", print_settings));
127 }
128 if let Some(ref show_progress) = self.show_progress {
129 properties.push(("show-progress", show_progress));
130 }
131 if let Some(ref support_selection) = self.support_selection {
132 properties.push(("support-selection", support_selection));
133 }
134 if let Some(ref track_print_status) = self.track_print_status {
135 properties.push(("track-print-status", track_print_status));
136 }
137 if let Some(ref unit) = self.unit {
138 properties.push(("unit", unit));
139 }
140 if let Some(ref use_full_page) = self.use_full_page {
141 properties.push(("use-full-page", use_full_page));
142 }
143 glib::Object::new(PrintOperation::static_type(), &properties)
144 .expect("object new")
145 .downcast()
146 .expect("downcast")
147 }
148
149 pub fn allow_async(mut self, allow_async: bool) -> Self {
150 self.allow_async = Some(allow_async);
151 self
152 }
153
154 pub fn current_page(mut self, current_page: i32) -> Self {
155 self.current_page = Some(current_page);
156 self
157 }
158
159 pub fn custom_tab_label(mut self, custom_tab_label: &str) -> Self {
160 self.custom_tab_label = Some(custom_tab_label.to_string());
161 self
162 }
163
164 pub fn default_page_setup(mut self, default_page_setup: &PageSetup) -> Self {
165 self.default_page_setup = Some(default_page_setup.clone());
166 self
167 }
168
169 pub fn embed_page_setup(mut self, embed_page_setup: bool) -> Self {
170 self.embed_page_setup = Some(embed_page_setup);
171 self
172 }
173
174 pub fn export_filename(mut self, export_filename: &str) -> Self {
175 self.export_filename = Some(export_filename.to_string());
176 self
177 }
178
179 pub fn has_selection(mut self, has_selection: bool) -> Self {
180 self.has_selection = Some(has_selection);
181 self
182 }
183
184 pub fn job_name(mut self, job_name: &str) -> Self {
185 self.job_name = Some(job_name.to_string());
186 self
187 }
188
189 pub fn n_pages(mut self, n_pages: i32) -> Self {
190 self.n_pages = Some(n_pages);
191 self
192 }
193
194 pub fn print_settings(mut self, print_settings: &PrintSettings) -> Self {
195 self.print_settings = Some(print_settings.clone());
196 self
197 }
198
199 pub fn show_progress(mut self, show_progress: bool) -> Self {
200 self.show_progress = Some(show_progress);
201 self
202 }
203
204 pub fn support_selection(mut self, support_selection: bool) -> Self {
205 self.support_selection = Some(support_selection);
206 self
207 }
208
209 pub fn track_print_status(mut self, track_print_status: bool) -> Self {
210 self.track_print_status = Some(track_print_status);
211 self
212 }
213
214 pub fn unit(mut self, unit: Unit) -> Self {
215 self.unit = Some(unit);
216 self
217 }
218
219 pub fn use_full_page(mut self, use_full_page: bool) -> Self {
220 self.use_full_page = Some(use_full_page);
221 self
222 }
223}
224
225pub const NONE_PRINT_OPERATION: Option<&PrintOperation> = None;
226
227pub trait PrintOperationExt: 'static {
228 fn cancel(&self);
229
230 fn draw_page_finish(&self);
231
232 fn get_default_page_setup(&self) -> Option<PageSetup>;
233
234 fn get_embed_page_setup(&self) -> bool;
235
236 fn get_error(&self) -> Result<(), Error>;
237
238 fn get_has_selection(&self) -> bool;
239
240 fn get_n_pages_to_print(&self) -> i32;
241
242 fn get_print_settings(&self) -> Option<PrintSettings>;
243
244 fn get_status(&self) -> PrintStatus;
245
246 fn get_status_string(&self) -> Option<GString>;
247
248 fn get_support_selection(&self) -> bool;
249
250 fn is_finished(&self) -> bool;
251
252 fn run<P: IsA<Window>>(
253 &self,
254 action: PrintOperationAction,
255 parent: Option<&P>,
256 ) -> Result<PrintOperationResult, Error>;
257
258 fn set_allow_async(&self, allow_async: bool);
259
260 fn set_current_page(&self, current_page: i32);
261
262 fn set_custom_tab_label(&self, label: Option<&str>);
263
264 fn set_default_page_setup(&self, default_page_setup: Option<&PageSetup>);
265
266 fn set_defer_drawing(&self);
267
268 fn set_embed_page_setup(&self, embed: bool);
269
270 fn set_export_filename<P: AsRef<std::path::Path>>(&self, filename: P);
271
272 fn set_has_selection(&self, has_selection: bool);
273
274 fn set_job_name(&self, job_name: &str);
275
276 fn set_n_pages(&self, n_pages: i32);
277
278 fn set_print_settings(&self, print_settings: Option<&PrintSettings>);
279
280 fn set_show_progress(&self, show_progress: bool);
281
282 fn set_support_selection(&self, support_selection: bool);
283
284 fn set_track_print_status(&self, track_status: bool);
285
286 fn set_unit(&self, unit: Unit);
287
288 fn set_use_full_page(&self, full_page: bool);
289
290 fn get_property_allow_async(&self) -> bool;
291
292 fn get_property_current_page(&self) -> i32;
293
294 fn get_property_custom_tab_label(&self) -> Option<GString>;
295
296 fn get_property_export_filename(&self) -> Option<GString>;
297
298 fn get_property_job_name(&self) -> Option<GString>;
299
300 fn get_property_n_pages(&self) -> i32;
301
302 fn get_property_show_progress(&self) -> bool;
303
304 fn get_property_track_print_status(&self) -> bool;
305
306 fn get_property_unit(&self) -> Unit;
307
308 fn get_property_use_full_page(&self) -> bool;
309
310 fn connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId;
311
312 fn connect_create_custom_widget<F: Fn(&Self) -> glib::Object + 'static>(
313 &self,
314 f: F,
315 ) -> SignalHandlerId;
316
317 fn connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>(&self, f: F)
318 -> SignalHandlerId;
319
320 fn connect_done<F: Fn(&Self, PrintOperationResult) + 'static>(&self, f: F) -> SignalHandlerId;
321
322 fn connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>(
323 &self,
324 f: F,
325 ) -> SignalHandlerId;
326
327 fn connect_end_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId;
328
329 fn connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>(
330 &self,
331 f: F,
332 ) -> SignalHandlerId;
333
334 fn connect_preview<
335 F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static,
336 >(
337 &self,
338 f: F,
339 ) -> SignalHandlerId;
340
341 fn connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>(
342 &self,
343 f: F,
344 ) -> SignalHandlerId;
345
346 fn connect_status_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
347
348 fn connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>(
349 &self,
350 f: F,
351 ) -> SignalHandlerId;
352
353 fn connect_property_allow_async_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
354
355 fn connect_property_current_page_notify<F: Fn(&Self) + 'static>(&self, f: F)
356 -> SignalHandlerId;
357
358 fn connect_property_custom_tab_label_notify<F: Fn(&Self) + 'static>(
359 &self,
360 f: F,
361 ) -> SignalHandlerId;
362
363 fn connect_property_default_page_setup_notify<F: Fn(&Self) + 'static>(
364 &self,
365 f: F,
366 ) -> SignalHandlerId;
367
368 fn connect_property_embed_page_setup_notify<F: Fn(&Self) + 'static>(
369 &self,
370 f: F,
371 ) -> SignalHandlerId;
372
373 fn connect_property_export_filename_notify<F: Fn(&Self) + 'static>(
374 &self,
375 f: F,
376 ) -> SignalHandlerId;
377
378 fn connect_property_has_selection_notify<F: Fn(&Self) + 'static>(
379 &self,
380 f: F,
381 ) -> SignalHandlerId;
382
383 fn connect_property_job_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
384
385 fn connect_property_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
386
387 fn connect_property_n_pages_to_print_notify<F: Fn(&Self) + 'static>(
388 &self,
389 f: F,
390 ) -> SignalHandlerId;
391
392 fn connect_property_print_settings_notify<F: Fn(&Self) + 'static>(
393 &self,
394 f: F,
395 ) -> SignalHandlerId;
396
397 fn connect_property_show_progress_notify<F: Fn(&Self) + 'static>(
398 &self,
399 f: F,
400 ) -> SignalHandlerId;
401
402 fn connect_property_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
403
404 fn connect_property_status_string_notify<F: Fn(&Self) + 'static>(
405 &self,
406 f: F,
407 ) -> SignalHandlerId;
408
409 fn connect_property_support_selection_notify<F: Fn(&Self) + 'static>(
410 &self,
411 f: F,
412 ) -> SignalHandlerId;
413
414 fn connect_property_track_print_status_notify<F: Fn(&Self) + 'static>(
415 &self,
416 f: F,
417 ) -> SignalHandlerId;
418
419 fn connect_property_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
420
421 fn connect_property_use_full_page_notify<F: Fn(&Self) + 'static>(
422 &self,
423 f: F,
424 ) -> SignalHandlerId;
425}
426
427impl<O: IsA<PrintOperation>> PrintOperationExt for O {
428 fn cancel(&self) {
429 unsafe {
430 gtk_sys::gtk_print_operation_cancel(self.as_ref().to_glib_none().0);
431 }
432 }
433
434 fn draw_page_finish(&self) {
435 unsafe {
436 gtk_sys::gtk_print_operation_draw_page_finish(self.as_ref().to_glib_none().0);
437 }
438 }
439
440 fn get_default_page_setup(&self) -> Option<PageSetup> {
441 unsafe {
442 from_glib_none(gtk_sys::gtk_print_operation_get_default_page_setup(
443 self.as_ref().to_glib_none().0,
444 ))
445 }
446 }
447
448 fn get_embed_page_setup(&self) -> bool {
449 unsafe {
450 from_glib(gtk_sys::gtk_print_operation_get_embed_page_setup(
451 self.as_ref().to_glib_none().0,
452 ))
453 }
454 }
455
456 fn get_error(&self) -> Result<(), Error> {
457 unsafe {
458 let mut error = ptr::null_mut();
459 let _ =
460 gtk_sys::gtk_print_operation_get_error(self.as_ref().to_glib_none().0, &mut error);
461 if error.is_null() {
462 Ok(())
463 } else {
464 Err(from_glib_full(error))
465 }
466 }
467 }
468
469 fn get_has_selection(&self) -> bool {
470 unsafe {
471 from_glib(gtk_sys::gtk_print_operation_get_has_selection(
472 self.as_ref().to_glib_none().0,
473 ))
474 }
475 }
476
477 fn get_n_pages_to_print(&self) -> i32 {
478 unsafe { gtk_sys::gtk_print_operation_get_n_pages_to_print(self.as_ref().to_glib_none().0) }
479 }
480
481 fn get_print_settings(&self) -> Option<PrintSettings> {
482 unsafe {
483 from_glib_none(gtk_sys::gtk_print_operation_get_print_settings(
484 self.as_ref().to_glib_none().0,
485 ))
486 }
487 }
488
489 fn get_status(&self) -> PrintStatus {
490 unsafe {
491 from_glib(gtk_sys::gtk_print_operation_get_status(
492 self.as_ref().to_glib_none().0,
493 ))
494 }
495 }
496
497 fn get_status_string(&self) -> Option<GString> {
498 unsafe {
499 from_glib_none(gtk_sys::gtk_print_operation_get_status_string(
500 self.as_ref().to_glib_none().0,
501 ))
502 }
503 }
504
505 fn get_support_selection(&self) -> bool {
506 unsafe {
507 from_glib(gtk_sys::gtk_print_operation_get_support_selection(
508 self.as_ref().to_glib_none().0,
509 ))
510 }
511 }
512
513 fn is_finished(&self) -> bool {
514 unsafe {
515 from_glib(gtk_sys::gtk_print_operation_is_finished(
516 self.as_ref().to_glib_none().0,
517 ))
518 }
519 }
520
521 fn run<P: IsA<Window>>(
522 &self,
523 action: PrintOperationAction,
524 parent: Option<&P>,
525 ) -> Result<PrintOperationResult, Error> {
526 unsafe {
527 let mut error = ptr::null_mut();
528 let ret = gtk_sys::gtk_print_operation_run(
529 self.as_ref().to_glib_none().0,
530 action.to_glib(),
531 parent.map(|p| p.as_ref()).to_glib_none().0,
532 &mut error,
533 );
534 if error.is_null() {
535 Ok(from_glib(ret))
536 } else {
537 Err(from_glib_full(error))
538 }
539 }
540 }
541
542 fn set_allow_async(&self, allow_async: bool) {
543 unsafe {
544 gtk_sys::gtk_print_operation_set_allow_async(
545 self.as_ref().to_glib_none().0,
546 allow_async.to_glib(),
547 );
548 }
549 }
550
551 fn set_current_page(&self, current_page: i32) {
552 unsafe {
553 gtk_sys::gtk_print_operation_set_current_page(
554 self.as_ref().to_glib_none().0,
555 current_page,
556 );
557 }
558 }
559
560 fn set_custom_tab_label(&self, label: Option<&str>) {
561 unsafe {
562 gtk_sys::gtk_print_operation_set_custom_tab_label(
563 self.as_ref().to_glib_none().0,
564 label.to_glib_none().0,
565 );
566 }
567 }
568
569 fn set_default_page_setup(&self, default_page_setup: Option<&PageSetup>) {
570 unsafe {
571 gtk_sys::gtk_print_operation_set_default_page_setup(
572 self.as_ref().to_glib_none().0,
573 default_page_setup.to_glib_none().0,
574 );
575 }
576 }
577
578 fn set_defer_drawing(&self) {
579 unsafe {
580 gtk_sys::gtk_print_operation_set_defer_drawing(self.as_ref().to_glib_none().0);
581 }
582 }
583
584 fn set_embed_page_setup(&self, embed: bool) {
585 unsafe {
586 gtk_sys::gtk_print_operation_set_embed_page_setup(
587 self.as_ref().to_glib_none().0,
588 embed.to_glib(),
589 );
590 }
591 }
592
593 fn set_export_filename<P: AsRef<std::path::Path>>(&self, filename: P) {
594 unsafe {
595 gtk_sys::gtk_print_operation_set_export_filename(
596 self.as_ref().to_glib_none().0,
597 filename.as_ref().to_glib_none().0,
598 );
599 }
600 }
601
602 fn set_has_selection(&self, has_selection: bool) {
603 unsafe {
604 gtk_sys::gtk_print_operation_set_has_selection(
605 self.as_ref().to_glib_none().0,
606 has_selection.to_glib(),
607 );
608 }
609 }
610
611 fn set_job_name(&self, job_name: &str) {
612 unsafe {
613 gtk_sys::gtk_print_operation_set_job_name(
614 self.as_ref().to_glib_none().0,
615 job_name.to_glib_none().0,
616 );
617 }
618 }
619
620 fn set_n_pages(&self, n_pages: i32) {
621 unsafe {
622 gtk_sys::gtk_print_operation_set_n_pages(self.as_ref().to_glib_none().0, n_pages);
623 }
624 }
625
626 fn set_print_settings(&self, print_settings: Option<&PrintSettings>) {
627 unsafe {
628 gtk_sys::gtk_print_operation_set_print_settings(
629 self.as_ref().to_glib_none().0,
630 print_settings.to_glib_none().0,
631 );
632 }
633 }
634
635 fn set_show_progress(&self, show_progress: bool) {
636 unsafe {
637 gtk_sys::gtk_print_operation_set_show_progress(
638 self.as_ref().to_glib_none().0,
639 show_progress.to_glib(),
640 );
641 }
642 }
643
644 fn set_support_selection(&self, support_selection: bool) {
645 unsafe {
646 gtk_sys::gtk_print_operation_set_support_selection(
647 self.as_ref().to_glib_none().0,
648 support_selection.to_glib(),
649 );
650 }
651 }
652
653 fn set_track_print_status(&self, track_status: bool) {
654 unsafe {
655 gtk_sys::gtk_print_operation_set_track_print_status(
656 self.as_ref().to_glib_none().0,
657 track_status.to_glib(),
658 );
659 }
660 }
661
662 fn set_unit(&self, unit: Unit) {
663 unsafe {
664 gtk_sys::gtk_print_operation_set_unit(self.as_ref().to_glib_none().0, unit.to_glib());
665 }
666 }
667
668 fn set_use_full_page(&self, full_page: bool) {
669 unsafe {
670 gtk_sys::gtk_print_operation_set_use_full_page(
671 self.as_ref().to_glib_none().0,
672 full_page.to_glib(),
673 );
674 }
675 }
676
677 fn get_property_allow_async(&self) -> bool {
678 unsafe {
679 let mut value = Value::from_type(<bool as StaticType>::static_type());
680 gobject_sys::g_object_get_property(
681 self.to_glib_none().0 as *mut gobject_sys::GObject,
682 b"allow-async\0".as_ptr() as *const _,
683 value.to_glib_none_mut().0,
684 );
685 value.get().unwrap()
686 }
687 }
688
689 fn get_property_current_page(&self) -> i32 {
690 unsafe {
691 let mut value = Value::from_type(<i32 as StaticType>::static_type());
692 gobject_sys::g_object_get_property(
693 self.to_glib_none().0 as *mut gobject_sys::GObject,
694 b"current-page\0".as_ptr() as *const _,
695 value.to_glib_none_mut().0,
696 );
697 value.get().unwrap()
698 }
699 }
700
701 fn get_property_custom_tab_label(&self) -> Option<GString> {
702 unsafe {
703 let mut value = Value::from_type(<GString as StaticType>::static_type());
704 gobject_sys::g_object_get_property(
705 self.to_glib_none().0 as *mut gobject_sys::GObject,
706 b"custom-tab-label\0".as_ptr() as *const _,
707 value.to_glib_none_mut().0,
708 );
709 value.get()
710 }
711 }
712
713 fn get_property_export_filename(&self) -> Option<GString> {
714 unsafe {
715 let mut value = Value::from_type(<GString as StaticType>::static_type());
716 gobject_sys::g_object_get_property(
717 self.to_glib_none().0 as *mut gobject_sys::GObject,
718 b"export-filename\0".as_ptr() as *const _,
719 value.to_glib_none_mut().0,
720 );
721 value.get()
722 }
723 }
724
725 fn get_property_job_name(&self) -> Option<GString> {
726 unsafe {
727 let mut value = Value::from_type(<GString as StaticType>::static_type());
728 gobject_sys::g_object_get_property(
729 self.to_glib_none().0 as *mut gobject_sys::GObject,
730 b"job-name\0".as_ptr() as *const _,
731 value.to_glib_none_mut().0,
732 );
733 value.get()
734 }
735 }
736
737 fn get_property_n_pages(&self) -> i32 {
738 unsafe {
739 let mut value = Value::from_type(<i32 as StaticType>::static_type());
740 gobject_sys::g_object_get_property(
741 self.to_glib_none().0 as *mut gobject_sys::GObject,
742 b"n-pages\0".as_ptr() as *const _,
743 value.to_glib_none_mut().0,
744 );
745 value.get().unwrap()
746 }
747 }
748
749 fn get_property_show_progress(&self) -> bool {
750 unsafe {
751 let mut value = Value::from_type(<bool as StaticType>::static_type());
752 gobject_sys::g_object_get_property(
753 self.to_glib_none().0 as *mut gobject_sys::GObject,
754 b"show-progress\0".as_ptr() as *const _,
755 value.to_glib_none_mut().0,
756 );
757 value.get().unwrap()
758 }
759 }
760
761 fn get_property_track_print_status(&self) -> bool {
762 unsafe {
763 let mut value = Value::from_type(<bool as StaticType>::static_type());
764 gobject_sys::g_object_get_property(
765 self.to_glib_none().0 as *mut gobject_sys::GObject,
766 b"track-print-status\0".as_ptr() as *const _,
767 value.to_glib_none_mut().0,
768 );
769 value.get().unwrap()
770 }
771 }
772
773 fn get_property_unit(&self) -> Unit {
774 unsafe {
775 let mut value = Value::from_type(<Unit as StaticType>::static_type());
776 gobject_sys::g_object_get_property(
777 self.to_glib_none().0 as *mut gobject_sys::GObject,
778 b"unit\0".as_ptr() as *const _,
779 value.to_glib_none_mut().0,
780 );
781 value.get().unwrap()
782 }
783 }
784
785 fn get_property_use_full_page(&self) -> bool {
786 unsafe {
787 let mut value = Value::from_type(<bool as StaticType>::static_type());
788 gobject_sys::g_object_get_property(
789 self.to_glib_none().0 as *mut gobject_sys::GObject,
790 b"use-full-page\0".as_ptr() as *const _,
791 value.to_glib_none_mut().0,
792 );
793 value.get().unwrap()
794 }
795 }
796
797 fn connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId {
798 unsafe extern "C" fn begin_print_trampoline<P, F: Fn(&P, &PrintContext) + 'static>(
799 this: *mut gtk_sys::GtkPrintOperation,
800 context: *mut gtk_sys::GtkPrintContext,
801 f: glib_sys::gpointer,
802 ) where
803 P: IsA<PrintOperation>,
804 {
805 let f: &F = &*(f as *const F);
806 f(
807 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
808 &from_glib_borrow(context),
809 )
810 }
811 unsafe {
812 let f: Box_<F> = Box_::new(f);
813 connect_raw(
814 self.as_ptr() as *mut _,
815 b"begin-print\0".as_ptr() as *const _,
816 Some(transmute(begin_print_trampoline::<Self, F> as usize)),
817 Box_::into_raw(f),
818 )
819 }
820 }
821
822 fn connect_create_custom_widget<F: Fn(&Self) -> glib::Object + 'static>(
823 &self,
824 f: F,
825 ) -> SignalHandlerId {
826 unsafe extern "C" fn create_custom_widget_trampoline<
827 P,
828 F: Fn(&P) -> glib::Object + 'static,
829 >(
830 this: *mut gtk_sys::GtkPrintOperation,
831 f: glib_sys::gpointer,
832 ) -> *mut gobject_sys::GObject
833 where
834 P: IsA<PrintOperation>,
835 {
836 let f: &F = &*(f as *const F);
837 f(&PrintOperation::from_glib_borrow(this).unsafe_cast()) .to_glib_none()
839 .0
840 }
841 unsafe {
842 let f: Box_<F> = Box_::new(f);
843 connect_raw(
844 self.as_ptr() as *mut _,
845 b"create-custom-widget\0".as_ptr() as *const _,
846 Some(transmute(
847 create_custom_widget_trampoline::<Self, F> as usize,
848 )),
849 Box_::into_raw(f),
850 )
851 }
852 }
853
854 fn connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>(
855 &self,
856 f: F,
857 ) -> SignalHandlerId {
858 unsafe extern "C" fn custom_widget_apply_trampoline<P, F: Fn(&P, &Widget) + 'static>(
859 this: *mut gtk_sys::GtkPrintOperation,
860 widget: *mut gtk_sys::GtkWidget,
861 f: glib_sys::gpointer,
862 ) where
863 P: IsA<PrintOperation>,
864 {
865 let f: &F = &*(f as *const F);
866 f(
867 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
868 &from_glib_borrow(widget),
869 )
870 }
871 unsafe {
872 let f: Box_<F> = Box_::new(f);
873 connect_raw(
874 self.as_ptr() as *mut _,
875 b"custom-widget-apply\0".as_ptr() as *const _,
876 Some(transmute(
877 custom_widget_apply_trampoline::<Self, F> as usize,
878 )),
879 Box_::into_raw(f),
880 )
881 }
882 }
883
884 fn connect_done<F: Fn(&Self, PrintOperationResult) + 'static>(&self, f: F) -> SignalHandlerId {
885 unsafe extern "C" fn done_trampoline<P, F: Fn(&P, PrintOperationResult) + 'static>(
886 this: *mut gtk_sys::GtkPrintOperation,
887 result: gtk_sys::GtkPrintOperationResult,
888 f: glib_sys::gpointer,
889 ) where
890 P: IsA<PrintOperation>,
891 {
892 let f: &F = &*(f as *const F);
893 f(
894 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
895 from_glib(result),
896 )
897 }
898 unsafe {
899 let f: Box_<F> = Box_::new(f);
900 connect_raw(
901 self.as_ptr() as *mut _,
902 b"done\0".as_ptr() as *const _,
903 Some(transmute(done_trampoline::<Self, F> as usize)),
904 Box_::into_raw(f),
905 )
906 }
907 }
908
909 fn connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>(
910 &self,
911 f: F,
912 ) -> SignalHandlerId {
913 unsafe extern "C" fn draw_page_trampoline<P, F: Fn(&P, &PrintContext, i32) + 'static>(
914 this: *mut gtk_sys::GtkPrintOperation,
915 context: *mut gtk_sys::GtkPrintContext,
916 page_nr: libc::c_int,
917 f: glib_sys::gpointer,
918 ) where
919 P: IsA<PrintOperation>,
920 {
921 let f: &F = &*(f as *const F);
922 f(
923 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
924 &from_glib_borrow(context),
925 page_nr,
926 )
927 }
928 unsafe {
929 let f: Box_<F> = Box_::new(f);
930 connect_raw(
931 self.as_ptr() as *mut _,
932 b"draw-page\0".as_ptr() as *const _,
933 Some(transmute(draw_page_trampoline::<Self, F> as usize)),
934 Box_::into_raw(f),
935 )
936 }
937 }
938
939 fn connect_end_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId {
940 unsafe extern "C" fn end_print_trampoline<P, F: Fn(&P, &PrintContext) + 'static>(
941 this: *mut gtk_sys::GtkPrintOperation,
942 context: *mut gtk_sys::GtkPrintContext,
943 f: glib_sys::gpointer,
944 ) where
945 P: IsA<PrintOperation>,
946 {
947 let f: &F = &*(f as *const F);
948 f(
949 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
950 &from_glib_borrow(context),
951 )
952 }
953 unsafe {
954 let f: Box_<F> = Box_::new(f);
955 connect_raw(
956 self.as_ptr() as *mut _,
957 b"end-print\0".as_ptr() as *const _,
958 Some(transmute(end_print_trampoline::<Self, F> as usize)),
959 Box_::into_raw(f),
960 )
961 }
962 }
963
964 fn connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>(
965 &self,
966 f: F,
967 ) -> SignalHandlerId {
968 unsafe extern "C" fn paginate_trampoline<P, F: Fn(&P, &PrintContext) -> bool + 'static>(
969 this: *mut gtk_sys::GtkPrintOperation,
970 context: *mut gtk_sys::GtkPrintContext,
971 f: glib_sys::gpointer,
972 ) -> glib_sys::gboolean
973 where
974 P: IsA<PrintOperation>,
975 {
976 let f: &F = &*(f as *const F);
977 f(
978 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
979 &from_glib_borrow(context),
980 )
981 .to_glib()
982 }
983 unsafe {
984 let f: Box_<F> = Box_::new(f);
985 connect_raw(
986 self.as_ptr() as *mut _,
987 b"paginate\0".as_ptr() as *const _,
988 Some(transmute(paginate_trampoline::<Self, F> as usize)),
989 Box_::into_raw(f),
990 )
991 }
992 }
993
994 fn connect_preview<
995 F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static,
996 >(
997 &self,
998 f: F,
999 ) -> SignalHandlerId {
1000 unsafe extern "C" fn preview_trampoline<
1001 P,
1002 F: Fn(&P, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static,
1003 >(
1004 this: *mut gtk_sys::GtkPrintOperation,
1005 preview: *mut gtk_sys::GtkPrintOperationPreview,
1006 context: *mut gtk_sys::GtkPrintContext,
1007 parent: *mut gtk_sys::GtkWindow,
1008 f: glib_sys::gpointer,
1009 ) -> glib_sys::gboolean
1010 where
1011 P: IsA<PrintOperation>,
1012 {
1013 let f: &F = &*(f as *const F);
1014 f(
1015 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
1016 &from_glib_borrow(preview),
1017 &from_glib_borrow(context),
1018 Option::<Window>::from_glib_borrow(parent).as_ref(),
1019 )
1020 .to_glib()
1021 }
1022 unsafe {
1023 let f: Box_<F> = Box_::new(f);
1024 connect_raw(
1025 self.as_ptr() as *mut _,
1026 b"preview\0".as_ptr() as *const _,
1027 Some(transmute(preview_trampoline::<Self, F> as usize)),
1028 Box_::into_raw(f),
1029 )
1030 }
1031 }
1032
1033 fn connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>(
1034 &self,
1035 f: F,
1036 ) -> SignalHandlerId {
1037 unsafe extern "C" fn request_page_setup_trampoline<
1038 P,
1039 F: Fn(&P, &PrintContext, i32, &PageSetup) + 'static,
1040 >(
1041 this: *mut gtk_sys::GtkPrintOperation,
1042 context: *mut gtk_sys::GtkPrintContext,
1043 page_nr: libc::c_int,
1044 setup: *mut gtk_sys::GtkPageSetup,
1045 f: glib_sys::gpointer,
1046 ) where
1047 P: IsA<PrintOperation>,
1048 {
1049 let f: &F = &*(f as *const F);
1050 f(
1051 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
1052 &from_glib_borrow(context),
1053 page_nr,
1054 &from_glib_borrow(setup),
1055 )
1056 }
1057 unsafe {
1058 let f: Box_<F> = Box_::new(f);
1059 connect_raw(
1060 self.as_ptr() as *mut _,
1061 b"request-page-setup\0".as_ptr() as *const _,
1062 Some(transmute(request_page_setup_trampoline::<Self, F> as usize)),
1063 Box_::into_raw(f),
1064 )
1065 }
1066 }
1067
1068 fn connect_status_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1069 unsafe extern "C" fn status_changed_trampoline<P, F: Fn(&P) + 'static>(
1070 this: *mut gtk_sys::GtkPrintOperation,
1071 f: glib_sys::gpointer,
1072 ) where
1073 P: IsA<PrintOperation>,
1074 {
1075 let f: &F = &*(f as *const F);
1076 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1077 }
1078 unsafe {
1079 let f: Box_<F> = Box_::new(f);
1080 connect_raw(
1081 self.as_ptr() as *mut _,
1082 b"status-changed\0".as_ptr() as *const _,
1083 Some(transmute(status_changed_trampoline::<Self, F> as usize)),
1084 Box_::into_raw(f),
1085 )
1086 }
1087 }
1088
1089 fn connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>(
1090 &self,
1091 f: F,
1092 ) -> SignalHandlerId {
1093 unsafe extern "C" fn update_custom_widget_trampoline<
1094 P,
1095 F: Fn(&P, &Widget, &PageSetup, &PrintSettings) + 'static,
1096 >(
1097 this: *mut gtk_sys::GtkPrintOperation,
1098 widget: *mut gtk_sys::GtkWidget,
1099 setup: *mut gtk_sys::GtkPageSetup,
1100 settings: *mut gtk_sys::GtkPrintSettings,
1101 f: glib_sys::gpointer,
1102 ) where
1103 P: IsA<PrintOperation>,
1104 {
1105 let f: &F = &*(f as *const F);
1106 f(
1107 &PrintOperation::from_glib_borrow(this).unsafe_cast(),
1108 &from_glib_borrow(widget),
1109 &from_glib_borrow(setup),
1110 &from_glib_borrow(settings),
1111 )
1112 }
1113 unsafe {
1114 let f: Box_<F> = Box_::new(f);
1115 connect_raw(
1116 self.as_ptr() as *mut _,
1117 b"update-custom-widget\0".as_ptr() as *const _,
1118 Some(transmute(
1119 update_custom_widget_trampoline::<Self, F> as usize,
1120 )),
1121 Box_::into_raw(f),
1122 )
1123 }
1124 }
1125
1126 fn connect_property_allow_async_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1127 unsafe extern "C" fn notify_allow_async_trampoline<P, F: Fn(&P) + 'static>(
1128 this: *mut gtk_sys::GtkPrintOperation,
1129 _param_spec: glib_sys::gpointer,
1130 f: glib_sys::gpointer,
1131 ) where
1132 P: IsA<PrintOperation>,
1133 {
1134 let f: &F = &*(f as *const F);
1135 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1136 }
1137 unsafe {
1138 let f: Box_<F> = Box_::new(f);
1139 connect_raw(
1140 self.as_ptr() as *mut _,
1141 b"notify::allow-async\0".as_ptr() as *const _,
1142 Some(transmute(notify_allow_async_trampoline::<Self, F> as usize)),
1143 Box_::into_raw(f),
1144 )
1145 }
1146 }
1147
1148 fn connect_property_current_page_notify<F: Fn(&Self) + 'static>(
1149 &self,
1150 f: F,
1151 ) -> SignalHandlerId {
1152 unsafe extern "C" fn notify_current_page_trampoline<P, F: Fn(&P) + 'static>(
1153 this: *mut gtk_sys::GtkPrintOperation,
1154 _param_spec: glib_sys::gpointer,
1155 f: glib_sys::gpointer,
1156 ) where
1157 P: IsA<PrintOperation>,
1158 {
1159 let f: &F = &*(f as *const F);
1160 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1161 }
1162 unsafe {
1163 let f: Box_<F> = Box_::new(f);
1164 connect_raw(
1165 self.as_ptr() as *mut _,
1166 b"notify::current-page\0".as_ptr() as *const _,
1167 Some(transmute(
1168 notify_current_page_trampoline::<Self, F> as usize,
1169 )),
1170 Box_::into_raw(f),
1171 )
1172 }
1173 }
1174
1175 fn connect_property_custom_tab_label_notify<F: Fn(&Self) + 'static>(
1176 &self,
1177 f: F,
1178 ) -> SignalHandlerId {
1179 unsafe extern "C" fn notify_custom_tab_label_trampoline<P, F: Fn(&P) + 'static>(
1180 this: *mut gtk_sys::GtkPrintOperation,
1181 _param_spec: glib_sys::gpointer,
1182 f: glib_sys::gpointer,
1183 ) where
1184 P: IsA<PrintOperation>,
1185 {
1186 let f: &F = &*(f as *const F);
1187 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1188 }
1189 unsafe {
1190 let f: Box_<F> = Box_::new(f);
1191 connect_raw(
1192 self.as_ptr() as *mut _,
1193 b"notify::custom-tab-label\0".as_ptr() as *const _,
1194 Some(transmute(
1195 notify_custom_tab_label_trampoline::<Self, F> as usize,
1196 )),
1197 Box_::into_raw(f),
1198 )
1199 }
1200 }
1201
1202 fn connect_property_default_page_setup_notify<F: Fn(&Self) + 'static>(
1203 &self,
1204 f: F,
1205 ) -> SignalHandlerId {
1206 unsafe extern "C" fn notify_default_page_setup_trampoline<P, F: Fn(&P) + 'static>(
1207 this: *mut gtk_sys::GtkPrintOperation,
1208 _param_spec: glib_sys::gpointer,
1209 f: glib_sys::gpointer,
1210 ) where
1211 P: IsA<PrintOperation>,
1212 {
1213 let f: &F = &*(f as *const F);
1214 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1215 }
1216 unsafe {
1217 let f: Box_<F> = Box_::new(f);
1218 connect_raw(
1219 self.as_ptr() as *mut _,
1220 b"notify::default-page-setup\0".as_ptr() as *const _,
1221 Some(transmute(
1222 notify_default_page_setup_trampoline::<Self, F> as usize,
1223 )),
1224 Box_::into_raw(f),
1225 )
1226 }
1227 }
1228
1229 fn connect_property_embed_page_setup_notify<F: Fn(&Self) + 'static>(
1230 &self,
1231 f: F,
1232 ) -> SignalHandlerId {
1233 unsafe extern "C" fn notify_embed_page_setup_trampoline<P, F: Fn(&P) + 'static>(
1234 this: *mut gtk_sys::GtkPrintOperation,
1235 _param_spec: glib_sys::gpointer,
1236 f: glib_sys::gpointer,
1237 ) where
1238 P: IsA<PrintOperation>,
1239 {
1240 let f: &F = &*(f as *const F);
1241 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1242 }
1243 unsafe {
1244 let f: Box_<F> = Box_::new(f);
1245 connect_raw(
1246 self.as_ptr() as *mut _,
1247 b"notify::embed-page-setup\0".as_ptr() as *const _,
1248 Some(transmute(
1249 notify_embed_page_setup_trampoline::<Self, F> as usize,
1250 )),
1251 Box_::into_raw(f),
1252 )
1253 }
1254 }
1255
1256 fn connect_property_export_filename_notify<F: Fn(&Self) + 'static>(
1257 &self,
1258 f: F,
1259 ) -> SignalHandlerId {
1260 unsafe extern "C" fn notify_export_filename_trampoline<P, F: Fn(&P) + 'static>(
1261 this: *mut gtk_sys::GtkPrintOperation,
1262 _param_spec: glib_sys::gpointer,
1263 f: glib_sys::gpointer,
1264 ) where
1265 P: IsA<PrintOperation>,
1266 {
1267 let f: &F = &*(f as *const F);
1268 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1269 }
1270 unsafe {
1271 let f: Box_<F> = Box_::new(f);
1272 connect_raw(
1273 self.as_ptr() as *mut _,
1274 b"notify::export-filename\0".as_ptr() as *const _,
1275 Some(transmute(
1276 notify_export_filename_trampoline::<Self, F> as usize,
1277 )),
1278 Box_::into_raw(f),
1279 )
1280 }
1281 }
1282
1283 fn connect_property_has_selection_notify<F: Fn(&Self) + 'static>(
1284 &self,
1285 f: F,
1286 ) -> SignalHandlerId {
1287 unsafe extern "C" fn notify_has_selection_trampoline<P, F: Fn(&P) + 'static>(
1288 this: *mut gtk_sys::GtkPrintOperation,
1289 _param_spec: glib_sys::gpointer,
1290 f: glib_sys::gpointer,
1291 ) where
1292 P: IsA<PrintOperation>,
1293 {
1294 let f: &F = &*(f as *const F);
1295 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1296 }
1297 unsafe {
1298 let f: Box_<F> = Box_::new(f);
1299 connect_raw(
1300 self.as_ptr() as *mut _,
1301 b"notify::has-selection\0".as_ptr() as *const _,
1302 Some(transmute(
1303 notify_has_selection_trampoline::<Self, F> as usize,
1304 )),
1305 Box_::into_raw(f),
1306 )
1307 }
1308 }
1309
1310 fn connect_property_job_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1311 unsafe extern "C" fn notify_job_name_trampoline<P, F: Fn(&P) + 'static>(
1312 this: *mut gtk_sys::GtkPrintOperation,
1313 _param_spec: glib_sys::gpointer,
1314 f: glib_sys::gpointer,
1315 ) where
1316 P: IsA<PrintOperation>,
1317 {
1318 let f: &F = &*(f as *const F);
1319 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1320 }
1321 unsafe {
1322 let f: Box_<F> = Box_::new(f);
1323 connect_raw(
1324 self.as_ptr() as *mut _,
1325 b"notify::job-name\0".as_ptr() as *const _,
1326 Some(transmute(notify_job_name_trampoline::<Self, F> as usize)),
1327 Box_::into_raw(f),
1328 )
1329 }
1330 }
1331
1332 fn connect_property_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1333 unsafe extern "C" fn notify_n_pages_trampoline<P, F: Fn(&P) + 'static>(
1334 this: *mut gtk_sys::GtkPrintOperation,
1335 _param_spec: glib_sys::gpointer,
1336 f: glib_sys::gpointer,
1337 ) where
1338 P: IsA<PrintOperation>,
1339 {
1340 let f: &F = &*(f as *const F);
1341 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1342 }
1343 unsafe {
1344 let f: Box_<F> = Box_::new(f);
1345 connect_raw(
1346 self.as_ptr() as *mut _,
1347 b"notify::n-pages\0".as_ptr() as *const _,
1348 Some(transmute(notify_n_pages_trampoline::<Self, F> as usize)),
1349 Box_::into_raw(f),
1350 )
1351 }
1352 }
1353
1354 fn connect_property_n_pages_to_print_notify<F: Fn(&Self) + 'static>(
1355 &self,
1356 f: F,
1357 ) -> SignalHandlerId {
1358 unsafe extern "C" fn notify_n_pages_to_print_trampoline<P, F: Fn(&P) + 'static>(
1359 this: *mut gtk_sys::GtkPrintOperation,
1360 _param_spec: glib_sys::gpointer,
1361 f: glib_sys::gpointer,
1362 ) where
1363 P: IsA<PrintOperation>,
1364 {
1365 let f: &F = &*(f as *const F);
1366 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1367 }
1368 unsafe {
1369 let f: Box_<F> = Box_::new(f);
1370 connect_raw(
1371 self.as_ptr() as *mut _,
1372 b"notify::n-pages-to-print\0".as_ptr() as *const _,
1373 Some(transmute(
1374 notify_n_pages_to_print_trampoline::<Self, F> as usize,
1375 )),
1376 Box_::into_raw(f),
1377 )
1378 }
1379 }
1380
1381 fn connect_property_print_settings_notify<F: Fn(&Self) + 'static>(
1382 &self,
1383 f: F,
1384 ) -> SignalHandlerId {
1385 unsafe extern "C" fn notify_print_settings_trampoline<P, F: Fn(&P) + 'static>(
1386 this: *mut gtk_sys::GtkPrintOperation,
1387 _param_spec: glib_sys::gpointer,
1388 f: glib_sys::gpointer,
1389 ) where
1390 P: IsA<PrintOperation>,
1391 {
1392 let f: &F = &*(f as *const F);
1393 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1394 }
1395 unsafe {
1396 let f: Box_<F> = Box_::new(f);
1397 connect_raw(
1398 self.as_ptr() as *mut _,
1399 b"notify::print-settings\0".as_ptr() as *const _,
1400 Some(transmute(
1401 notify_print_settings_trampoline::<Self, F> as usize,
1402 )),
1403 Box_::into_raw(f),
1404 )
1405 }
1406 }
1407
1408 fn connect_property_show_progress_notify<F: Fn(&Self) + 'static>(
1409 &self,
1410 f: F,
1411 ) -> SignalHandlerId {
1412 unsafe extern "C" fn notify_show_progress_trampoline<P, F: Fn(&P) + 'static>(
1413 this: *mut gtk_sys::GtkPrintOperation,
1414 _param_spec: glib_sys::gpointer,
1415 f: glib_sys::gpointer,
1416 ) where
1417 P: IsA<PrintOperation>,
1418 {
1419 let f: &F = &*(f as *const F);
1420 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1421 }
1422 unsafe {
1423 let f: Box_<F> = Box_::new(f);
1424 connect_raw(
1425 self.as_ptr() as *mut _,
1426 b"notify::show-progress\0".as_ptr() as *const _,
1427 Some(transmute(
1428 notify_show_progress_trampoline::<Self, F> as usize,
1429 )),
1430 Box_::into_raw(f),
1431 )
1432 }
1433 }
1434
1435 fn connect_property_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1436 unsafe extern "C" fn notify_status_trampoline<P, F: Fn(&P) + 'static>(
1437 this: *mut gtk_sys::GtkPrintOperation,
1438 _param_spec: glib_sys::gpointer,
1439 f: glib_sys::gpointer,
1440 ) where
1441 P: IsA<PrintOperation>,
1442 {
1443 let f: &F = &*(f as *const F);
1444 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1445 }
1446 unsafe {
1447 let f: Box_<F> = Box_::new(f);
1448 connect_raw(
1449 self.as_ptr() as *mut _,
1450 b"notify::status\0".as_ptr() as *const _,
1451 Some(transmute(notify_status_trampoline::<Self, F> as usize)),
1452 Box_::into_raw(f),
1453 )
1454 }
1455 }
1456
1457 fn connect_property_status_string_notify<F: Fn(&Self) + 'static>(
1458 &self,
1459 f: F,
1460 ) -> SignalHandlerId {
1461 unsafe extern "C" fn notify_status_string_trampoline<P, F: Fn(&P) + 'static>(
1462 this: *mut gtk_sys::GtkPrintOperation,
1463 _param_spec: glib_sys::gpointer,
1464 f: glib_sys::gpointer,
1465 ) where
1466 P: IsA<PrintOperation>,
1467 {
1468 let f: &F = &*(f as *const F);
1469 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1470 }
1471 unsafe {
1472 let f: Box_<F> = Box_::new(f);
1473 connect_raw(
1474 self.as_ptr() as *mut _,
1475 b"notify::status-string\0".as_ptr() as *const _,
1476 Some(transmute(
1477 notify_status_string_trampoline::<Self, F> as usize,
1478 )),
1479 Box_::into_raw(f),
1480 )
1481 }
1482 }
1483
1484 fn connect_property_support_selection_notify<F: Fn(&Self) + 'static>(
1485 &self,
1486 f: F,
1487 ) -> SignalHandlerId {
1488 unsafe extern "C" fn notify_support_selection_trampoline<P, F: Fn(&P) + 'static>(
1489 this: *mut gtk_sys::GtkPrintOperation,
1490 _param_spec: glib_sys::gpointer,
1491 f: glib_sys::gpointer,
1492 ) where
1493 P: IsA<PrintOperation>,
1494 {
1495 let f: &F = &*(f as *const F);
1496 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1497 }
1498 unsafe {
1499 let f: Box_<F> = Box_::new(f);
1500 connect_raw(
1501 self.as_ptr() as *mut _,
1502 b"notify::support-selection\0".as_ptr() as *const _,
1503 Some(transmute(
1504 notify_support_selection_trampoline::<Self, F> as usize,
1505 )),
1506 Box_::into_raw(f),
1507 )
1508 }
1509 }
1510
1511 fn connect_property_track_print_status_notify<F: Fn(&Self) + 'static>(
1512 &self,
1513 f: F,
1514 ) -> SignalHandlerId {
1515 unsafe extern "C" fn notify_track_print_status_trampoline<P, F: Fn(&P) + 'static>(
1516 this: *mut gtk_sys::GtkPrintOperation,
1517 _param_spec: glib_sys::gpointer,
1518 f: glib_sys::gpointer,
1519 ) where
1520 P: IsA<PrintOperation>,
1521 {
1522 let f: &F = &*(f as *const F);
1523 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1524 }
1525 unsafe {
1526 let f: Box_<F> = Box_::new(f);
1527 connect_raw(
1528 self.as_ptr() as *mut _,
1529 b"notify::track-print-status\0".as_ptr() as *const _,
1530 Some(transmute(
1531 notify_track_print_status_trampoline::<Self, F> as usize,
1532 )),
1533 Box_::into_raw(f),
1534 )
1535 }
1536 }
1537
1538 fn connect_property_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1539 unsafe extern "C" fn notify_unit_trampoline<P, F: Fn(&P) + 'static>(
1540 this: *mut gtk_sys::GtkPrintOperation,
1541 _param_spec: glib_sys::gpointer,
1542 f: glib_sys::gpointer,
1543 ) where
1544 P: IsA<PrintOperation>,
1545 {
1546 let f: &F = &*(f as *const F);
1547 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1548 }
1549 unsafe {
1550 let f: Box_<F> = Box_::new(f);
1551 connect_raw(
1552 self.as_ptr() as *mut _,
1553 b"notify::unit\0".as_ptr() as *const _,
1554 Some(transmute(notify_unit_trampoline::<Self, F> as usize)),
1555 Box_::into_raw(f),
1556 )
1557 }
1558 }
1559
1560 fn connect_property_use_full_page_notify<F: Fn(&Self) + 'static>(
1561 &self,
1562 f: F,
1563 ) -> SignalHandlerId {
1564 unsafe extern "C" fn notify_use_full_page_trampoline<P, F: Fn(&P) + 'static>(
1565 this: *mut gtk_sys::GtkPrintOperation,
1566 _param_spec: glib_sys::gpointer,
1567 f: glib_sys::gpointer,
1568 ) where
1569 P: IsA<PrintOperation>,
1570 {
1571 let f: &F = &*(f as *const F);
1572 f(&PrintOperation::from_glib_borrow(this).unsafe_cast())
1573 }
1574 unsafe {
1575 let f: Box_<F> = Box_::new(f);
1576 connect_raw(
1577 self.as_ptr() as *mut _,
1578 b"notify::use-full-page\0".as_ptr() as *const _,
1579 Some(transmute(
1580 notify_use_full_page_trampoline::<Self, F> as usize,
1581 )),
1582 Box_::into_raw(f),
1583 )
1584 }
1585 }
1586}
1587
1588impl fmt::Display for PrintOperation {
1589 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1590 write!(f, "PrintOperation")
1591 }
1592}