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 
5 use crate::NumberUpLayout;
6 use crate::PageOrientation;
7 use crate::PageRange;
8 use crate::PageSet;
9 use crate::PaperSize;
10 use crate::PrintDuplex;
11 use crate::PrintPages;
12 use crate::PrintQuality;
13 use crate::Unit;
14 use glib::translate::*;
15 use std::fmt;
16 use std::mem;
17 use std::ptr;
18 
19 glib::wrapper! {
20     #[doc(alias = "GtkPrintSettings")]
21     pub struct PrintSettings(Object<ffi::GtkPrintSettings>);
22 
23     match fn {
24         type_ => || ffi::gtk_print_settings_get_type(),
25     }
26 }
27 
28 impl PrintSettings {
29     #[doc(alias = "gtk_print_settings_new")]
new() -> PrintSettings30     pub fn new() -> PrintSettings {
31         assert_initialized_main_thread!();
32         unsafe { from_glib_full(ffi::gtk_print_settings_new()) }
33     }
34 
35     #[doc(alias = "gtk_print_settings_new_from_file")]
36     #[doc(alias = "new_from_file")]
from_file<P: AsRef<std::path::Path>>( file_name: P, ) -> Result<PrintSettings, glib::Error>37     pub fn from_file<P: AsRef<std::path::Path>>(
38         file_name: P,
39     ) -> Result<PrintSettings, glib::Error> {
40         assert_initialized_main_thread!();
41         unsafe {
42             let mut error = ptr::null_mut();
43             let ret = ffi::gtk_print_settings_new_from_file(
44                 file_name.as_ref().to_glib_none().0,
45                 &mut error,
46             );
47             if error.is_null() {
48                 Ok(from_glib_full(ret))
49             } else {
50                 Err(from_glib_full(error))
51             }
52         }
53     }
54 
55     #[cfg(any(feature = "v3_22", feature = "dox"))]
56     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))]
57     #[doc(alias = "gtk_print_settings_new_from_gvariant")]
58     #[doc(alias = "new_from_gvariant")]
from_gvariant(variant: &glib::Variant) -> PrintSettings59     pub fn from_gvariant(variant: &glib::Variant) -> PrintSettings {
60         assert_initialized_main_thread!();
61         unsafe {
62             from_glib_full(ffi::gtk_print_settings_new_from_gvariant(
63                 variant.to_glib_none().0,
64             ))
65         }
66     }
67 
68     #[doc(alias = "gtk_print_settings_new_from_key_file")]
69     #[doc(alias = "new_from_key_file")]
from_key_file( key_file: &glib::KeyFile, group_name: Option<&str>, ) -> Result<PrintSettings, glib::Error>70     pub fn from_key_file(
71         key_file: &glib::KeyFile,
72         group_name: Option<&str>,
73     ) -> Result<PrintSettings, glib::Error> {
74         assert_initialized_main_thread!();
75         unsafe {
76             let mut error = ptr::null_mut();
77             let ret = ffi::gtk_print_settings_new_from_key_file(
78                 key_file.to_glib_none().0,
79                 group_name.to_glib_none().0,
80                 &mut error,
81             );
82             if error.is_null() {
83                 Ok(from_glib_full(ret))
84             } else {
85                 Err(from_glib_full(error))
86             }
87         }
88     }
89 
90     #[doc(alias = "gtk_print_settings_copy")]
copy(&self) -> Option<PrintSettings>91     pub fn copy(&self) -> Option<PrintSettings> {
92         unsafe { from_glib_full(ffi::gtk_print_settings_copy(self.to_glib_none().0)) }
93     }
94 
95     #[doc(alias = "gtk_print_settings_foreach")]
foreach<P: FnMut(&str, &str)>(&self, func: P)96     pub fn foreach<P: FnMut(&str, &str)>(&self, func: P) {
97         let func_data: P = func;
98         unsafe extern "C" fn func_func<P: FnMut(&str, &str)>(
99             key: *const libc::c_char,
100             value: *const libc::c_char,
101             user_data: glib::ffi::gpointer,
102         ) {
103             let key: Borrowed<glib::GString> = from_glib_borrow(key);
104             let value: Borrowed<glib::GString> = from_glib_borrow(value);
105             let callback: *mut P = user_data as *const _ as usize as *mut P;
106             (*callback)(key.as_str(), value.as_str());
107         }
108         let func = Some(func_func::<P> as _);
109         let super_callback0: &P = &func_data;
110         unsafe {
111             ffi::gtk_print_settings_foreach(
112                 self.to_glib_none().0,
113                 func,
114                 super_callback0 as *const _ as usize as *mut _,
115             );
116         }
117     }
118 
119     #[doc(alias = "gtk_print_settings_get")]
get(&self, key: &str) -> Option<glib::GString>120     pub fn get(&self, key: &str) -> Option<glib::GString> {
121         unsafe {
122             from_glib_none(ffi::gtk_print_settings_get(
123                 self.to_glib_none().0,
124                 key.to_glib_none().0,
125             ))
126         }
127     }
128 
129     #[doc(alias = "gtk_print_settings_get_bool")]
130     #[doc(alias = "get_bool")]
bool(&self, key: &str) -> bool131     pub fn bool(&self, key: &str) -> bool {
132         unsafe {
133             from_glib(ffi::gtk_print_settings_get_bool(
134                 self.to_glib_none().0,
135                 key.to_glib_none().0,
136             ))
137         }
138     }
139 
140     #[doc(alias = "gtk_print_settings_get_collate")]
141     #[doc(alias = "get_collate")]
is_collate(&self) -> bool142     pub fn is_collate(&self) -> bool {
143         unsafe { from_glib(ffi::gtk_print_settings_get_collate(self.to_glib_none().0)) }
144     }
145 
146     #[doc(alias = "gtk_print_settings_get_default_source")]
147     #[doc(alias = "get_default_source")]
default_source(&self) -> Option<glib::GString>148     pub fn default_source(&self) -> Option<glib::GString> {
149         unsafe {
150             from_glib_none(ffi::gtk_print_settings_get_default_source(
151                 self.to_glib_none().0,
152             ))
153         }
154     }
155 
156     #[doc(alias = "gtk_print_settings_get_dither")]
157     #[doc(alias = "get_dither")]
dither(&self) -> Option<glib::GString>158     pub fn dither(&self) -> Option<glib::GString> {
159         unsafe { from_glib_none(ffi::gtk_print_settings_get_dither(self.to_glib_none().0)) }
160     }
161 
162     #[doc(alias = "gtk_print_settings_get_double")]
163     #[doc(alias = "get_double")]
double(&self, key: &str) -> f64164     pub fn double(&self, key: &str) -> f64 {
165         unsafe { ffi::gtk_print_settings_get_double(self.to_glib_none().0, key.to_glib_none().0) }
166     }
167 
168     #[doc(alias = "gtk_print_settings_get_double_with_default")]
169     #[doc(alias = "get_double_with_default")]
double_with_default(&self, key: &str, def: f64) -> f64170     pub fn double_with_default(&self, key: &str, def: f64) -> f64 {
171         unsafe {
172             ffi::gtk_print_settings_get_double_with_default(
173                 self.to_glib_none().0,
174                 key.to_glib_none().0,
175                 def,
176             )
177         }
178     }
179 
180     #[doc(alias = "gtk_print_settings_get_duplex")]
181     #[doc(alias = "get_duplex")]
duplex(&self) -> PrintDuplex182     pub fn duplex(&self) -> PrintDuplex {
183         unsafe { from_glib(ffi::gtk_print_settings_get_duplex(self.to_glib_none().0)) }
184     }
185 
186     #[doc(alias = "gtk_print_settings_get_finishings")]
187     #[doc(alias = "get_finishings")]
finishings(&self) -> Option<glib::GString>188     pub fn finishings(&self) -> Option<glib::GString> {
189         unsafe {
190             from_glib_none(ffi::gtk_print_settings_get_finishings(
191                 self.to_glib_none().0,
192             ))
193         }
194     }
195 
196     #[doc(alias = "gtk_print_settings_get_int")]
197     #[doc(alias = "get_int")]
int(&self, key: &str) -> i32198     pub fn int(&self, key: &str) -> i32 {
199         unsafe { ffi::gtk_print_settings_get_int(self.to_glib_none().0, key.to_glib_none().0) }
200     }
201 
202     #[doc(alias = "gtk_print_settings_get_int_with_default")]
203     #[doc(alias = "get_int_with_default")]
int_with_default(&self, key: &str, def: i32) -> i32204     pub fn int_with_default(&self, key: &str, def: i32) -> i32 {
205         unsafe {
206             ffi::gtk_print_settings_get_int_with_default(
207                 self.to_glib_none().0,
208                 key.to_glib_none().0,
209                 def,
210             )
211         }
212     }
213 
214     #[doc(alias = "gtk_print_settings_get_length")]
215     #[doc(alias = "get_length")]
length(&self, key: &str, unit: Unit) -> f64216     pub fn length(&self, key: &str, unit: Unit) -> f64 {
217         unsafe {
218             ffi::gtk_print_settings_get_length(
219                 self.to_glib_none().0,
220                 key.to_glib_none().0,
221                 unit.into_glib(),
222             )
223         }
224     }
225 
226     #[doc(alias = "gtk_print_settings_get_media_type")]
227     #[doc(alias = "get_media_type")]
media_type(&self) -> Option<glib::GString>228     pub fn media_type(&self) -> Option<glib::GString> {
229         unsafe {
230             from_glib_none(ffi::gtk_print_settings_get_media_type(
231                 self.to_glib_none().0,
232             ))
233         }
234     }
235 
236     #[doc(alias = "gtk_print_settings_get_n_copies")]
237     #[doc(alias = "get_n_copies")]
n_copies(&self) -> i32238     pub fn n_copies(&self) -> i32 {
239         unsafe { ffi::gtk_print_settings_get_n_copies(self.to_glib_none().0) }
240     }
241 
242     #[doc(alias = "gtk_print_settings_get_number_up")]
243     #[doc(alias = "get_number_up")]
number_up(&self) -> i32244     pub fn number_up(&self) -> i32 {
245         unsafe { ffi::gtk_print_settings_get_number_up(self.to_glib_none().0) }
246     }
247 
248     #[doc(alias = "gtk_print_settings_get_number_up_layout")]
249     #[doc(alias = "get_number_up_layout")]
number_up_layout(&self) -> NumberUpLayout250     pub fn number_up_layout(&self) -> NumberUpLayout {
251         unsafe {
252             from_glib(ffi::gtk_print_settings_get_number_up_layout(
253                 self.to_glib_none().0,
254             ))
255         }
256     }
257 
258     #[doc(alias = "gtk_print_settings_get_orientation")]
259     #[doc(alias = "get_orientation")]
orientation(&self) -> PageOrientation260     pub fn orientation(&self) -> PageOrientation {
261         unsafe {
262             from_glib(ffi::gtk_print_settings_get_orientation(
263                 self.to_glib_none().0,
264             ))
265         }
266     }
267 
268     #[doc(alias = "gtk_print_settings_get_output_bin")]
269     #[doc(alias = "get_output_bin")]
output_bin(&self) -> Option<glib::GString>270     pub fn output_bin(&self) -> Option<glib::GString> {
271         unsafe {
272             from_glib_none(ffi::gtk_print_settings_get_output_bin(
273                 self.to_glib_none().0,
274             ))
275         }
276     }
277 
278     #[doc(alias = "gtk_print_settings_get_page_ranges")]
279     #[doc(alias = "get_page_ranges")]
page_ranges(&self) -> Vec<PageRange>280     pub fn page_ranges(&self) -> Vec<PageRange> {
281         unsafe {
282             let mut num_ranges = mem::MaybeUninit::uninit();
283             let ret = FromGlibContainer::from_glib_full_num(
284                 ffi::gtk_print_settings_get_page_ranges(
285                     self.to_glib_none().0,
286                     num_ranges.as_mut_ptr(),
287                 ),
288                 num_ranges.assume_init() as usize,
289             );
290             ret
291         }
292     }
293 
294     #[doc(alias = "gtk_print_settings_get_page_set")]
295     #[doc(alias = "get_page_set")]
page_set(&self) -> PageSet296     pub fn page_set(&self) -> PageSet {
297         unsafe { from_glib(ffi::gtk_print_settings_get_page_set(self.to_glib_none().0)) }
298     }
299 
300     #[doc(alias = "gtk_print_settings_get_paper_height")]
301     #[doc(alias = "get_paper_height")]
paper_height(&self, unit: Unit) -> f64302     pub fn paper_height(&self, unit: Unit) -> f64 {
303         unsafe { ffi::gtk_print_settings_get_paper_height(self.to_glib_none().0, unit.into_glib()) }
304     }
305 
306     #[doc(alias = "gtk_print_settings_get_paper_size")]
307     #[doc(alias = "get_paper_size")]
paper_size(&self) -> PaperSize308     pub fn paper_size(&self) -> PaperSize {
309         unsafe {
310             from_glib_full(ffi::gtk_print_settings_get_paper_size(
311                 self.to_glib_none().0,
312             ))
313         }
314     }
315 
316     #[doc(alias = "gtk_print_settings_get_paper_width")]
317     #[doc(alias = "get_paper_width")]
paper_width(&self, unit: Unit) -> f64318     pub fn paper_width(&self, unit: Unit) -> f64 {
319         unsafe { ffi::gtk_print_settings_get_paper_width(self.to_glib_none().0, unit.into_glib()) }
320     }
321 
322     #[doc(alias = "gtk_print_settings_get_print_pages")]
323     #[doc(alias = "get_print_pages")]
print_pages(&self) -> PrintPages324     pub fn print_pages(&self) -> PrintPages {
325         unsafe {
326             from_glib(ffi::gtk_print_settings_get_print_pages(
327                 self.to_glib_none().0,
328             ))
329         }
330     }
331 
332     #[doc(alias = "gtk_print_settings_get_printer")]
333     #[doc(alias = "get_printer")]
printer(&self) -> Option<glib::GString>334     pub fn printer(&self) -> Option<glib::GString> {
335         unsafe { from_glib_none(ffi::gtk_print_settings_get_printer(self.to_glib_none().0)) }
336     }
337 
338     #[doc(alias = "gtk_print_settings_get_printer_lpi")]
339     #[doc(alias = "get_printer_lpi")]
printer_lpi(&self) -> f64340     pub fn printer_lpi(&self) -> f64 {
341         unsafe { ffi::gtk_print_settings_get_printer_lpi(self.to_glib_none().0) }
342     }
343 
344     #[doc(alias = "gtk_print_settings_get_quality")]
345     #[doc(alias = "get_quality")]
quality(&self) -> PrintQuality346     pub fn quality(&self) -> PrintQuality {
347         unsafe { from_glib(ffi::gtk_print_settings_get_quality(self.to_glib_none().0)) }
348     }
349 
350     #[doc(alias = "gtk_print_settings_get_resolution")]
351     #[doc(alias = "get_resolution")]
resolution(&self) -> i32352     pub fn resolution(&self) -> i32 {
353         unsafe { ffi::gtk_print_settings_get_resolution(self.to_glib_none().0) }
354     }
355 
356     #[doc(alias = "gtk_print_settings_get_resolution_x")]
357     #[doc(alias = "get_resolution_x")]
resolution_x(&self) -> i32358     pub fn resolution_x(&self) -> i32 {
359         unsafe { ffi::gtk_print_settings_get_resolution_x(self.to_glib_none().0) }
360     }
361 
362     #[doc(alias = "gtk_print_settings_get_resolution_y")]
363     #[doc(alias = "get_resolution_y")]
resolution_y(&self) -> i32364     pub fn resolution_y(&self) -> i32 {
365         unsafe { ffi::gtk_print_settings_get_resolution_y(self.to_glib_none().0) }
366     }
367 
368     #[doc(alias = "gtk_print_settings_get_reverse")]
369     #[doc(alias = "get_reverse")]
is_reverse(&self) -> bool370     pub fn is_reverse(&self) -> bool {
371         unsafe { from_glib(ffi::gtk_print_settings_get_reverse(self.to_glib_none().0)) }
372     }
373 
374     #[doc(alias = "gtk_print_settings_get_scale")]
375     #[doc(alias = "get_scale")]
scale(&self) -> f64376     pub fn scale(&self) -> f64 {
377         unsafe { ffi::gtk_print_settings_get_scale(self.to_glib_none().0) }
378     }
379 
380     #[doc(alias = "gtk_print_settings_get_use_color")]
381     #[doc(alias = "get_use_color")]
uses_color(&self) -> bool382     pub fn uses_color(&self) -> bool {
383         unsafe { from_glib(ffi::gtk_print_settings_get_use_color(self.to_glib_none().0)) }
384     }
385 
386     #[doc(alias = "gtk_print_settings_has_key")]
has_key(&self, key: &str) -> bool387     pub fn has_key(&self, key: &str) -> bool {
388         unsafe {
389             from_glib(ffi::gtk_print_settings_has_key(
390                 self.to_glib_none().0,
391                 key.to_glib_none().0,
392             ))
393         }
394     }
395 
396     #[doc(alias = "gtk_print_settings_load_file")]
load_file<P: AsRef<std::path::Path>>(&self, file_name: P) -> Result<(), glib::Error>397     pub fn load_file<P: AsRef<std::path::Path>>(&self, file_name: P) -> Result<(), glib::Error> {
398         unsafe {
399             let mut error = ptr::null_mut();
400             let _ = ffi::gtk_print_settings_load_file(
401                 self.to_glib_none().0,
402                 file_name.as_ref().to_glib_none().0,
403                 &mut error,
404             );
405             if error.is_null() {
406                 Ok(())
407             } else {
408                 Err(from_glib_full(error))
409             }
410         }
411     }
412 
413     #[doc(alias = "gtk_print_settings_load_key_file")]
load_key_file( &self, key_file: &glib::KeyFile, group_name: Option<&str>, ) -> Result<(), glib::Error>414     pub fn load_key_file(
415         &self,
416         key_file: &glib::KeyFile,
417         group_name: Option<&str>,
418     ) -> Result<(), glib::Error> {
419         unsafe {
420             let mut error = ptr::null_mut();
421             let _ = ffi::gtk_print_settings_load_key_file(
422                 self.to_glib_none().0,
423                 key_file.to_glib_none().0,
424                 group_name.to_glib_none().0,
425                 &mut error,
426             );
427             if error.is_null() {
428                 Ok(())
429             } else {
430                 Err(from_glib_full(error))
431             }
432         }
433     }
434 
435     #[doc(alias = "gtk_print_settings_set")]
set(&self, key: &str, value: Option<&str>)436     pub fn set(&self, key: &str, value: Option<&str>) {
437         unsafe {
438             ffi::gtk_print_settings_set(
439                 self.to_glib_none().0,
440                 key.to_glib_none().0,
441                 value.to_glib_none().0,
442             );
443         }
444     }
445 
446     #[doc(alias = "gtk_print_settings_set_bool")]
set_bool(&self, key: &str, value: bool)447     pub fn set_bool(&self, key: &str, value: bool) {
448         unsafe {
449             ffi::gtk_print_settings_set_bool(
450                 self.to_glib_none().0,
451                 key.to_glib_none().0,
452                 value.into_glib(),
453             );
454         }
455     }
456 
457     #[doc(alias = "gtk_print_settings_set_collate")]
set_collate(&self, collate: bool)458     pub fn set_collate(&self, collate: bool) {
459         unsafe {
460             ffi::gtk_print_settings_set_collate(self.to_glib_none().0, collate.into_glib());
461         }
462     }
463 
464     #[doc(alias = "gtk_print_settings_set_default_source")]
set_default_source(&self, default_source: &str)465     pub fn set_default_source(&self, default_source: &str) {
466         unsafe {
467             ffi::gtk_print_settings_set_default_source(
468                 self.to_glib_none().0,
469                 default_source.to_glib_none().0,
470             );
471         }
472     }
473 
474     #[doc(alias = "gtk_print_settings_set_dither")]
set_dither(&self, dither: &str)475     pub fn set_dither(&self, dither: &str) {
476         unsafe {
477             ffi::gtk_print_settings_set_dither(self.to_glib_none().0, dither.to_glib_none().0);
478         }
479     }
480 
481     #[doc(alias = "gtk_print_settings_set_double")]
set_double(&self, key: &str, value: f64)482     pub fn set_double(&self, key: &str, value: f64) {
483         unsafe {
484             ffi::gtk_print_settings_set_double(self.to_glib_none().0, key.to_glib_none().0, value);
485         }
486     }
487 
488     #[doc(alias = "gtk_print_settings_set_duplex")]
set_duplex(&self, duplex: PrintDuplex)489     pub fn set_duplex(&self, duplex: PrintDuplex) {
490         unsafe {
491             ffi::gtk_print_settings_set_duplex(self.to_glib_none().0, duplex.into_glib());
492         }
493     }
494 
495     #[doc(alias = "gtk_print_settings_set_finishings")]
set_finishings(&self, finishings: &str)496     pub fn set_finishings(&self, finishings: &str) {
497         unsafe {
498             ffi::gtk_print_settings_set_finishings(
499                 self.to_glib_none().0,
500                 finishings.to_glib_none().0,
501             );
502         }
503     }
504 
505     #[doc(alias = "gtk_print_settings_set_int")]
set_int(&self, key: &str, value: i32)506     pub fn set_int(&self, key: &str, value: i32) {
507         unsafe {
508             ffi::gtk_print_settings_set_int(self.to_glib_none().0, key.to_glib_none().0, value);
509         }
510     }
511 
512     #[doc(alias = "gtk_print_settings_set_length")]
set_length(&self, key: &str, value: f64, unit: Unit)513     pub fn set_length(&self, key: &str, value: f64, unit: Unit) {
514         unsafe {
515             ffi::gtk_print_settings_set_length(
516                 self.to_glib_none().0,
517                 key.to_glib_none().0,
518                 value,
519                 unit.into_glib(),
520             );
521         }
522     }
523 
524     #[doc(alias = "gtk_print_settings_set_media_type")]
set_media_type(&self, media_type: &str)525     pub fn set_media_type(&self, media_type: &str) {
526         unsafe {
527             ffi::gtk_print_settings_set_media_type(
528                 self.to_glib_none().0,
529                 media_type.to_glib_none().0,
530             );
531         }
532     }
533 
534     #[doc(alias = "gtk_print_settings_set_n_copies")]
set_n_copies(&self, num_copies: i32)535     pub fn set_n_copies(&self, num_copies: i32) {
536         unsafe {
537             ffi::gtk_print_settings_set_n_copies(self.to_glib_none().0, num_copies);
538         }
539     }
540 
541     #[doc(alias = "gtk_print_settings_set_number_up")]
set_number_up(&self, number_up: i32)542     pub fn set_number_up(&self, number_up: i32) {
543         unsafe {
544             ffi::gtk_print_settings_set_number_up(self.to_glib_none().0, number_up);
545         }
546     }
547 
548     #[doc(alias = "gtk_print_settings_set_number_up_layout")]
set_number_up_layout(&self, number_up_layout: NumberUpLayout)549     pub fn set_number_up_layout(&self, number_up_layout: NumberUpLayout) {
550         unsafe {
551             ffi::gtk_print_settings_set_number_up_layout(
552                 self.to_glib_none().0,
553                 number_up_layout.into_glib(),
554             );
555         }
556     }
557 
558     #[doc(alias = "gtk_print_settings_set_orientation")]
set_orientation(&self, orientation: PageOrientation)559     pub fn set_orientation(&self, orientation: PageOrientation) {
560         unsafe {
561             ffi::gtk_print_settings_set_orientation(self.to_glib_none().0, orientation.into_glib());
562         }
563     }
564 
565     #[doc(alias = "gtk_print_settings_set_output_bin")]
set_output_bin(&self, output_bin: &str)566     pub fn set_output_bin(&self, output_bin: &str) {
567         unsafe {
568             ffi::gtk_print_settings_set_output_bin(
569                 self.to_glib_none().0,
570                 output_bin.to_glib_none().0,
571             );
572         }
573     }
574 
575     #[doc(alias = "gtk_print_settings_set_page_set")]
set_page_set(&self, page_set: PageSet)576     pub fn set_page_set(&self, page_set: PageSet) {
577         unsafe {
578             ffi::gtk_print_settings_set_page_set(self.to_glib_none().0, page_set.into_glib());
579         }
580     }
581 
582     #[doc(alias = "gtk_print_settings_set_paper_height")]
set_paper_height(&self, height: f64, unit: Unit)583     pub fn set_paper_height(&self, height: f64, unit: Unit) {
584         unsafe {
585             ffi::gtk_print_settings_set_paper_height(
586                 self.to_glib_none().0,
587                 height,
588                 unit.into_glib(),
589             );
590         }
591     }
592 
593     #[doc(alias = "gtk_print_settings_set_paper_size")]
set_paper_size(&self, paper_size: &PaperSize)594     pub fn set_paper_size(&self, paper_size: &PaperSize) {
595         unsafe {
596             ffi::gtk_print_settings_set_paper_size(
597                 self.to_glib_none().0,
598                 mut_override(paper_size.to_glib_none().0),
599             );
600         }
601     }
602 
603     #[doc(alias = "gtk_print_settings_set_paper_width")]
set_paper_width(&self, width: f64, unit: Unit)604     pub fn set_paper_width(&self, width: f64, unit: Unit) {
605         unsafe {
606             ffi::gtk_print_settings_set_paper_width(self.to_glib_none().0, width, unit.into_glib());
607         }
608     }
609 
610     #[doc(alias = "gtk_print_settings_set_print_pages")]
set_print_pages(&self, pages: PrintPages)611     pub fn set_print_pages(&self, pages: PrintPages) {
612         unsafe {
613             ffi::gtk_print_settings_set_print_pages(self.to_glib_none().0, pages.into_glib());
614         }
615     }
616 
617     #[doc(alias = "gtk_print_settings_set_printer")]
set_printer(&self, printer: &str)618     pub fn set_printer(&self, printer: &str) {
619         unsafe {
620             ffi::gtk_print_settings_set_printer(self.to_glib_none().0, printer.to_glib_none().0);
621         }
622     }
623 
624     #[doc(alias = "gtk_print_settings_set_printer_lpi")]
set_printer_lpi(&self, lpi: f64)625     pub fn set_printer_lpi(&self, lpi: f64) {
626         unsafe {
627             ffi::gtk_print_settings_set_printer_lpi(self.to_glib_none().0, lpi);
628         }
629     }
630 
631     #[doc(alias = "gtk_print_settings_set_quality")]
set_quality(&self, quality: PrintQuality)632     pub fn set_quality(&self, quality: PrintQuality) {
633         unsafe {
634             ffi::gtk_print_settings_set_quality(self.to_glib_none().0, quality.into_glib());
635         }
636     }
637 
638     #[doc(alias = "gtk_print_settings_set_resolution")]
set_resolution(&self, resolution: i32)639     pub fn set_resolution(&self, resolution: i32) {
640         unsafe {
641             ffi::gtk_print_settings_set_resolution(self.to_glib_none().0, resolution);
642         }
643     }
644 
645     #[doc(alias = "gtk_print_settings_set_resolution_xy")]
set_resolution_xy(&self, resolution_x: i32, resolution_y: i32)646     pub fn set_resolution_xy(&self, resolution_x: i32, resolution_y: i32) {
647         unsafe {
648             ffi::gtk_print_settings_set_resolution_xy(
649                 self.to_glib_none().0,
650                 resolution_x,
651                 resolution_y,
652             );
653         }
654     }
655 
656     #[doc(alias = "gtk_print_settings_set_reverse")]
set_reverse(&self, reverse: bool)657     pub fn set_reverse(&self, reverse: bool) {
658         unsafe {
659             ffi::gtk_print_settings_set_reverse(self.to_glib_none().0, reverse.into_glib());
660         }
661     }
662 
663     #[doc(alias = "gtk_print_settings_set_scale")]
set_scale(&self, scale: f64)664     pub fn set_scale(&self, scale: f64) {
665         unsafe {
666             ffi::gtk_print_settings_set_scale(self.to_glib_none().0, scale);
667         }
668     }
669 
670     #[doc(alias = "gtk_print_settings_set_use_color")]
set_use_color(&self, use_color: bool)671     pub fn set_use_color(&self, use_color: bool) {
672         unsafe {
673             ffi::gtk_print_settings_set_use_color(self.to_glib_none().0, use_color.into_glib());
674         }
675     }
676 
677     #[doc(alias = "gtk_print_settings_to_file")]
to_file<P: AsRef<std::path::Path>>(&self, file_name: P) -> Result<(), glib::Error>678     pub fn to_file<P: AsRef<std::path::Path>>(&self, file_name: P) -> Result<(), glib::Error> {
679         unsafe {
680             let mut error = ptr::null_mut();
681             let _ = ffi::gtk_print_settings_to_file(
682                 self.to_glib_none().0,
683                 file_name.as_ref().to_glib_none().0,
684                 &mut error,
685             );
686             if error.is_null() {
687                 Ok(())
688             } else {
689                 Err(from_glib_full(error))
690             }
691         }
692     }
693 
694     #[cfg(any(feature = "v3_22", feature = "dox"))]
695     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))]
696     #[doc(alias = "gtk_print_settings_to_gvariant")]
to_gvariant(&self) -> Option<glib::Variant>697     pub fn to_gvariant(&self) -> Option<glib::Variant> {
698         unsafe { from_glib_none(ffi::gtk_print_settings_to_gvariant(self.to_glib_none().0)) }
699     }
700 
701     #[doc(alias = "gtk_print_settings_to_key_file")]
to_key_file(&self, key_file: &glib::KeyFile, group_name: Option<&str>)702     pub fn to_key_file(&self, key_file: &glib::KeyFile, group_name: Option<&str>) {
703         unsafe {
704             ffi::gtk_print_settings_to_key_file(
705                 self.to_glib_none().0,
706                 key_file.to_glib_none().0,
707                 group_name.to_glib_none().0,
708             );
709         }
710     }
711 
712     #[doc(alias = "gtk_print_settings_unset")]
unset(&self, key: &str)713     pub fn unset(&self, key: &str) {
714         unsafe {
715             ffi::gtk_print_settings_unset(self.to_glib_none().0, key.to_glib_none().0);
716         }
717     }
718 }
719 
720 impl Default for PrintSettings {
default() -> Self721     fn default() -> Self {
722         Self::new()
723     }
724 }
725 
726 impl fmt::Display for PrintSettings {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result727     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
728         f.write_str("PrintSettings")
729     }
730 }
731