1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.PrintSettings;
26 
27 private import glib.ConstructionException;
28 private import glib.ErrorG;
29 private import glib.GException;
30 private import glib.KeyFile;
31 private import glib.Str;
32 private import glib.Variant;
33 private import gobject.ObjectG;
34 private import gtk.PaperSize;
35 private import gtk.c.functions;
36 public  import gtk.c.types;
37 public  import gtkc.gtktypes;
38 
39 
40 /**
41  * A GtkPrintSettings object represents the settings of a print dialog in
42  * a system-independent way. The main use for this object is that once
43  * you’ve printed you can get a settings object that represents the settings
44  * the user chose, and the next time you print you can pass that object in so
45  * that the user doesn’t have to re-set all his settings.
46  * 
47  * Its also possible to enumerate the settings so that you can easily save
48  * the settings for the next time your app runs, or even store them in a
49  * document. The predefined keys try to use shared values as much as possible
50  * so that moving such a document between systems still works.
51  * 
52  * Printing support was added in GTK+ 2.10.
53  */
54 public class PrintSettings : ObjectG
55 {
56 	/** the main Gtk struct */
57 	protected GtkPrintSettings* gtkPrintSettings;
58 
59 	/** Get the main Gtk struct */
60 	public GtkPrintSettings* getPrintSettingsStruct(bool transferOwnership = false)
61 	{
62 		if (transferOwnership)
63 			ownedRef = false;
64 		return gtkPrintSettings;
65 	}
66 
67 	/** the main Gtk struct as a void* */
68 	protected override void* getStruct()
69 	{
70 		return cast(void*)gtkPrintSettings;
71 	}
72 
73 	/**
74 	 * Sets our main struct and passes it to the parent class.
75 	 */
76 	public this (GtkPrintSettings* gtkPrintSettings, bool ownedRef = false)
77 	{
78 		this.gtkPrintSettings = gtkPrintSettings;
79 		super(cast(GObject*)gtkPrintSettings, ownedRef);
80 	}
81 
82 
83 	/** */
84 	public static GType getType()
85 	{
86 		return gtk_print_settings_get_type();
87 	}
88 
89 	/**
90 	 * Creates a new #GtkPrintSettings object.
91 	 *
92 	 * Returns: a new #GtkPrintSettings object
93 	 *
94 	 * Since: 2.10
95 	 *
96 	 * Throws: ConstructionException GTK+ fails to create the object.
97 	 */
98 	public this()
99 	{
100 		auto p = gtk_print_settings_new();
101 
102 		if(p is null)
103 		{
104 			throw new ConstructionException("null returned by new");
105 		}
106 
107 		this(cast(GtkPrintSettings*) p, true);
108 	}
109 
110 	/**
111 	 * Reads the print settings from @file_name. Returns a new #GtkPrintSettings
112 	 * object with the restored settings, or %NULL if an error occurred. If the
113 	 * file could not be loaded then error is set to either a #GFileError or
114 	 * #GKeyFileError.  See gtk_print_settings_to_file().
115 	 *
116 	 * Params:
117 	 *     fileName = the filename to read the settings from
118 	 *
119 	 * Returns: the restored #GtkPrintSettings
120 	 *
121 	 * Since: 2.12
122 	 *
123 	 * Throws: GException on failure.
124 	 * Throws: ConstructionException GTK+ fails to create the object.
125 	 */
126 	public this(string fileName)
127 	{
128 		GError* err = null;
129 
130 		auto p = gtk_print_settings_new_from_file(Str.toStringz(fileName), &err);
131 
132 		if (err !is null)
133 		{
134 			throw new GException( new ErrorG(err) );
135 		}
136 
137 		if(p is null)
138 		{
139 			throw new ConstructionException("null returned by new_from_file");
140 		}
141 
142 		this(cast(GtkPrintSettings*) p, true);
143 	}
144 
145 	/**
146 	 * Deserialize print settings from an a{sv} variant in
147 	 * the format produced by gtk_print_settings_to_gvariant().
148 	 *
149 	 * Params:
150 	 *     variant = an a{sv} #GVariant
151 	 *
152 	 * Returns: a new #GtkPrintSettings object
153 	 *
154 	 * Since: 3.22
155 	 *
156 	 * Throws: ConstructionException GTK+ fails to create the object.
157 	 */
158 	public this(Variant variant)
159 	{
160 		auto p = gtk_print_settings_new_from_gvariant((variant is null) ? null : variant.getVariantStruct());
161 
162 		if(p is null)
163 		{
164 			throw new ConstructionException("null returned by new_from_gvariant");
165 		}
166 
167 		this(cast(GtkPrintSettings*) p, true);
168 	}
169 
170 	/**
171 	 * Reads the print settings from the group @group_name in @key_file.  Returns a
172 	 * new #GtkPrintSettings object with the restored settings, or %NULL if an
173 	 * error occurred. If the file could not be loaded then error is set to either
174 	 * a #GFileError or #GKeyFileError.
175 	 *
176 	 * Params:
177 	 *     keyFile = the #GKeyFile to retrieve the settings from
178 	 *     groupName = the name of the group to use, or %NULL to use
179 	 *         the default “Print Settings”
180 	 *
181 	 * Returns: the restored #GtkPrintSettings
182 	 *
183 	 * Since: 2.12
184 	 *
185 	 * Throws: GException on failure.
186 	 * Throws: ConstructionException GTK+ fails to create the object.
187 	 */
188 	public this(KeyFile keyFile, string groupName)
189 	{
190 		GError* err = null;
191 
192 		auto p = gtk_print_settings_new_from_key_file((keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err);
193 
194 		if (err !is null)
195 		{
196 			throw new GException( new ErrorG(err) );
197 		}
198 
199 		if(p is null)
200 		{
201 			throw new ConstructionException("null returned by new_from_key_file");
202 		}
203 
204 		this(cast(GtkPrintSettings*) p, true);
205 	}
206 
207 	/**
208 	 * Copies a #GtkPrintSettings object.
209 	 *
210 	 * Returns: a newly allocated copy of @other
211 	 *
212 	 * Since: 2.10
213 	 */
214 	public PrintSettings copy()
215 	{
216 		auto p = gtk_print_settings_copy(gtkPrintSettings);
217 
218 		if(p is null)
219 		{
220 			return null;
221 		}
222 
223 		return ObjectG.getDObject!(PrintSettings)(cast(GtkPrintSettings*) p, true);
224 	}
225 
226 	/**
227 	 * Calls @func for each key-value pair of @settings.
228 	 *
229 	 * Params:
230 	 *     func = the function to call
231 	 *     userData = user data for @func
232 	 *
233 	 * Since: 2.10
234 	 */
235 	public void foreac(GtkPrintSettingsFunc func, void* userData)
236 	{
237 		gtk_print_settings_foreach(gtkPrintSettings, func, userData);
238 	}
239 
240 	/**
241 	 * Looks up the string value associated with @key.
242 	 *
243 	 * Params:
244 	 *     key = a key
245 	 *
246 	 * Returns: the string value for @key
247 	 *
248 	 * Since: 2.10
249 	 */
250 	public string get(string key)
251 	{
252 		return Str.toString(gtk_print_settings_get(gtkPrintSettings, Str.toStringz(key)));
253 	}
254 
255 	/**
256 	 * Returns the boolean represented by the value
257 	 * that is associated with @key.
258 	 *
259 	 * The string “true” represents %TRUE, any other
260 	 * string %FALSE.
261 	 *
262 	 * Params:
263 	 *     key = a key
264 	 *
265 	 * Returns: %TRUE, if @key maps to a true value.
266 	 *
267 	 * Since: 2.10
268 	 */
269 	public bool getBool(string key)
270 	{
271 		return gtk_print_settings_get_bool(gtkPrintSettings, Str.toStringz(key)) != 0;
272 	}
273 
274 	/**
275 	 * Gets the value of %GTK_PRINT_SETTINGS_COLLATE.
276 	 *
277 	 * Returns: whether to collate the printed pages
278 	 *
279 	 * Since: 2.10
280 	 */
281 	public bool getCollate()
282 	{
283 		return gtk_print_settings_get_collate(gtkPrintSettings) != 0;
284 	}
285 
286 	/**
287 	 * Gets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
288 	 *
289 	 * Returns: the default source
290 	 *
291 	 * Since: 2.10
292 	 */
293 	public string getDefaultSource()
294 	{
295 		return Str.toString(gtk_print_settings_get_default_source(gtkPrintSettings));
296 	}
297 
298 	/**
299 	 * Gets the value of %GTK_PRINT_SETTINGS_DITHER.
300 	 *
301 	 * Returns: the dithering that is used
302 	 *
303 	 * Since: 2.10
304 	 */
305 	public string getDither()
306 	{
307 		return Str.toString(gtk_print_settings_get_dither(gtkPrintSettings));
308 	}
309 
310 	/**
311 	 * Returns the double value associated with @key, or 0.
312 	 *
313 	 * Params:
314 	 *     key = a key
315 	 *
316 	 * Returns: the double value of @key
317 	 *
318 	 * Since: 2.10
319 	 */
320 	public double getDouble(string key)
321 	{
322 		return gtk_print_settings_get_double(gtkPrintSettings, Str.toStringz(key));
323 	}
324 
325 	/**
326 	 * Returns the floating point number represented by
327 	 * the value that is associated with @key, or @default_val
328 	 * if the value does not represent a floating point number.
329 	 *
330 	 * Floating point numbers are parsed with g_ascii_strtod().
331 	 *
332 	 * Params:
333 	 *     key = a key
334 	 *     def = the default value
335 	 *
336 	 * Returns: the floating point number associated with @key
337 	 *
338 	 * Since: 2.10
339 	 */
340 	public double getDoubleWithDefault(string key, double def)
341 	{
342 		return gtk_print_settings_get_double_with_default(gtkPrintSettings, Str.toStringz(key), def);
343 	}
344 
345 	/**
346 	 * Gets the value of %GTK_PRINT_SETTINGS_DUPLEX.
347 	 *
348 	 * Returns: whether to print the output in duplex.
349 	 *
350 	 * Since: 2.10
351 	 */
352 	public GtkPrintDuplex getDuplex()
353 	{
354 		return gtk_print_settings_get_duplex(gtkPrintSettings);
355 	}
356 
357 	/**
358 	 * Gets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
359 	 *
360 	 * Returns: the finishings
361 	 *
362 	 * Since: 2.10
363 	 */
364 	public string getFinishings()
365 	{
366 		return Str.toString(gtk_print_settings_get_finishings(gtkPrintSettings));
367 	}
368 
369 	/**
370 	 * Returns the integer value of @key, or 0.
371 	 *
372 	 * Params:
373 	 *     key = a key
374 	 *
375 	 * Returns: the integer value of @key
376 	 *
377 	 * Since: 2.10
378 	 */
379 	public int getInt(string key)
380 	{
381 		return gtk_print_settings_get_int(gtkPrintSettings, Str.toStringz(key));
382 	}
383 
384 	/**
385 	 * Returns the value of @key, interpreted as
386 	 * an integer, or the default value.
387 	 *
388 	 * Params:
389 	 *     key = a key
390 	 *     def = the default value
391 	 *
392 	 * Returns: the integer value of @key
393 	 *
394 	 * Since: 2.10
395 	 */
396 	public int getIntWithDefault(string key, int def)
397 	{
398 		return gtk_print_settings_get_int_with_default(gtkPrintSettings, Str.toStringz(key), def);
399 	}
400 
401 	/**
402 	 * Returns the value associated with @key, interpreted
403 	 * as a length. The returned value is converted to @units.
404 	 *
405 	 * Params:
406 	 *     key = a key
407 	 *     unit = the unit of the return value
408 	 *
409 	 * Returns: the length value of @key, converted to @unit
410 	 *
411 	 * Since: 2.10
412 	 */
413 	public double getLength(string key, GtkUnit unit)
414 	{
415 		return gtk_print_settings_get_length(gtkPrintSettings, Str.toStringz(key), unit);
416 	}
417 
418 	/**
419 	 * Gets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
420 	 *
421 	 * The set of media types is defined in PWG 5101.1-2002 PWG.
422 	 *
423 	 * Returns: the media type
424 	 *
425 	 * Since: 2.10
426 	 */
427 	public string getMediaType()
428 	{
429 		return Str.toString(gtk_print_settings_get_media_type(gtkPrintSettings));
430 	}
431 
432 	/**
433 	 * Gets the value of %GTK_PRINT_SETTINGS_N_COPIES.
434 	 *
435 	 * Returns: the number of copies to print
436 	 *
437 	 * Since: 2.10
438 	 */
439 	public int getNCopies()
440 	{
441 		return gtk_print_settings_get_n_copies(gtkPrintSettings);
442 	}
443 
444 	/**
445 	 * Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
446 	 *
447 	 * Returns: the number of pages per sheet
448 	 *
449 	 * Since: 2.10
450 	 */
451 	public int getNumberUp()
452 	{
453 		return gtk_print_settings_get_number_up(gtkPrintSettings);
454 	}
455 
456 	/**
457 	 * Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
458 	 *
459 	 * Returns: layout of page in number-up mode
460 	 *
461 	 * Since: 2.14
462 	 */
463 	public GtkNumberUpLayout getNumberUpLayout()
464 	{
465 		return gtk_print_settings_get_number_up_layout(gtkPrintSettings);
466 	}
467 
468 	/**
469 	 * Get the value of %GTK_PRINT_SETTINGS_ORIENTATION,
470 	 * converted to a #GtkPageOrientation.
471 	 *
472 	 * Returns: the orientation
473 	 *
474 	 * Since: 2.10
475 	 */
476 	public GtkPageOrientation getOrientation()
477 	{
478 		return gtk_print_settings_get_orientation(gtkPrintSettings);
479 	}
480 
481 	/**
482 	 * Gets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
483 	 *
484 	 * Returns: the output bin
485 	 *
486 	 * Since: 2.10
487 	 */
488 	public string getOutputBin()
489 	{
490 		return Str.toString(gtk_print_settings_get_output_bin(gtkPrintSettings));
491 	}
492 
493 	/**
494 	 * Gets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
495 	 *
496 	 * Returns: an array
497 	 *     of #GtkPageRanges.  Use g_free() to free the array when
498 	 *     it is no longer needed.
499 	 *
500 	 * Since: 2.10
501 	 */
502 	public GtkPageRange[] getPageRanges()
503 	{
504 		int numRanges;
505 
506 		auto p = gtk_print_settings_get_page_ranges(gtkPrintSettings, &numRanges);
507 
508 		return p[0 .. numRanges];
509 	}
510 
511 	/**
512 	 * Gets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
513 	 *
514 	 * Returns: the set of pages to print
515 	 *
516 	 * Since: 2.10
517 	 */
518 	public GtkPageSet getPageSet()
519 	{
520 		return gtk_print_settings_get_page_set(gtkPrintSettings);
521 	}
522 
523 	/**
524 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT,
525 	 * converted to @unit.
526 	 *
527 	 * Params:
528 	 *     unit = the unit for the return value
529 	 *
530 	 * Returns: the paper height, in units of @unit
531 	 *
532 	 * Since: 2.10
533 	 */
534 	public double getPaperHeight(GtkUnit unit)
535 	{
536 		return gtk_print_settings_get_paper_height(gtkPrintSettings, unit);
537 	}
538 
539 	/**
540 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT,
541 	 * converted to a #GtkPaperSize.
542 	 *
543 	 * Returns: the paper size
544 	 *
545 	 * Since: 2.10
546 	 */
547 	public PaperSize getPaperSize()
548 	{
549 		auto p = gtk_print_settings_get_paper_size(gtkPrintSettings);
550 
551 		if(p is null)
552 		{
553 			return null;
554 		}
555 
556 		return ObjectG.getDObject!(PaperSize)(cast(GtkPaperSize*) p, true);
557 	}
558 
559 	/**
560 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH,
561 	 * converted to @unit.
562 	 *
563 	 * Params:
564 	 *     unit = the unit for the return value
565 	 *
566 	 * Returns: the paper width, in units of @unit
567 	 *
568 	 * Since: 2.10
569 	 */
570 	public double getPaperWidth(GtkUnit unit)
571 	{
572 		return gtk_print_settings_get_paper_width(gtkPrintSettings, unit);
573 	}
574 
575 	/**
576 	 * Gets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
577 	 *
578 	 * Returns: which pages to print
579 	 *
580 	 * Since: 2.10
581 	 */
582 	public GtkPrintPages getPrintPages()
583 	{
584 		return gtk_print_settings_get_print_pages(gtkPrintSettings);
585 	}
586 
587 	/**
588 	 * Convenience function to obtain the value of
589 	 * %GTK_PRINT_SETTINGS_PRINTER.
590 	 *
591 	 * Returns: the printer name
592 	 *
593 	 * Since: 2.10
594 	 */
595 	public string getPrinter()
596 	{
597 		return Str.toString(gtk_print_settings_get_printer(gtkPrintSettings));
598 	}
599 
600 	/**
601 	 * Gets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
602 	 *
603 	 * Returns: the resolution in lpi (lines per inch)
604 	 *
605 	 * Since: 2.16
606 	 */
607 	public double getPrinterLpi()
608 	{
609 		return gtk_print_settings_get_printer_lpi(gtkPrintSettings);
610 	}
611 
612 	/**
613 	 * Gets the value of %GTK_PRINT_SETTINGS_QUALITY.
614 	 *
615 	 * Returns: the print quality
616 	 *
617 	 * Since: 2.10
618 	 */
619 	public GtkPrintQuality getQuality()
620 	{
621 		return gtk_print_settings_get_quality(gtkPrintSettings);
622 	}
623 
624 	/**
625 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION.
626 	 *
627 	 * Returns: the resolution in dpi
628 	 *
629 	 * Since: 2.10
630 	 */
631 	public int getResolution()
632 	{
633 		return gtk_print_settings_get_resolution(gtkPrintSettings);
634 	}
635 
636 	/**
637 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_X.
638 	 *
639 	 * Returns: the horizontal resolution in dpi
640 	 *
641 	 * Since: 2.16
642 	 */
643 	public int getResolutionX()
644 	{
645 		return gtk_print_settings_get_resolution_x(gtkPrintSettings);
646 	}
647 
648 	/**
649 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_Y.
650 	 *
651 	 * Returns: the vertical resolution in dpi
652 	 *
653 	 * Since: 2.16
654 	 */
655 	public int getResolutionY()
656 	{
657 		return gtk_print_settings_get_resolution_y(gtkPrintSettings);
658 	}
659 
660 	/**
661 	 * Gets the value of %GTK_PRINT_SETTINGS_REVERSE.
662 	 *
663 	 * Returns: whether to reverse the order of the printed pages
664 	 *
665 	 * Since: 2.10
666 	 */
667 	public bool getReverse()
668 	{
669 		return gtk_print_settings_get_reverse(gtkPrintSettings) != 0;
670 	}
671 
672 	/**
673 	 * Gets the value of %GTK_PRINT_SETTINGS_SCALE.
674 	 *
675 	 * Returns: the scale in percent
676 	 *
677 	 * Since: 2.10
678 	 */
679 	public double getScale()
680 	{
681 		return gtk_print_settings_get_scale(gtkPrintSettings);
682 	}
683 
684 	/**
685 	 * Gets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
686 	 *
687 	 * Returns: whether to use color
688 	 *
689 	 * Since: 2.10
690 	 */
691 	public bool getUseColor()
692 	{
693 		return gtk_print_settings_get_use_color(gtkPrintSettings) != 0;
694 	}
695 
696 	/**
697 	 * Returns %TRUE, if a value is associated with @key.
698 	 *
699 	 * Params:
700 	 *     key = a key
701 	 *
702 	 * Returns: %TRUE, if @key has a value
703 	 *
704 	 * Since: 2.10
705 	 */
706 	public bool hasKey(string key)
707 	{
708 		return gtk_print_settings_has_key(gtkPrintSettings, Str.toStringz(key)) != 0;
709 	}
710 
711 	/**
712 	 * Reads the print settings from @file_name. If the file could not be loaded
713 	 * then error is set to either a #GFileError or #GKeyFileError.
714 	 * See gtk_print_settings_to_file().
715 	 *
716 	 * Params:
717 	 *     fileName = the filename to read the settings from
718 	 *
719 	 * Returns: %TRUE on success
720 	 *
721 	 * Since: 2.14
722 	 *
723 	 * Throws: GException on failure.
724 	 */
725 	public bool loadFile(string fileName)
726 	{
727 		GError* err = null;
728 
729 		auto p = gtk_print_settings_load_file(gtkPrintSettings, Str.toStringz(fileName), &err) != 0;
730 
731 		if (err !is null)
732 		{
733 			throw new GException( new ErrorG(err) );
734 		}
735 
736 		return p;
737 	}
738 
739 	/**
740 	 * Reads the print settings from the group @group_name in @key_file. If the
741 	 * file could not be loaded then error is set to either a #GFileError or
742 	 * #GKeyFileError.
743 	 *
744 	 * Params:
745 	 *     keyFile = the #GKeyFile to retrieve the settings from
746 	 *     groupName = the name of the group to use, or %NULL to use the default
747 	 *         “Print Settings”
748 	 *
749 	 * Returns: %TRUE on success
750 	 *
751 	 * Since: 2.14
752 	 *
753 	 * Throws: GException on failure.
754 	 */
755 	public bool loadKeyFile(KeyFile keyFile, string groupName)
756 	{
757 		GError* err = null;
758 
759 		auto p = gtk_print_settings_load_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err) != 0;
760 
761 		if (err !is null)
762 		{
763 			throw new GException( new ErrorG(err) );
764 		}
765 
766 		return p;
767 	}
768 
769 	/**
770 	 * Associates @value with @key.
771 	 *
772 	 * Params:
773 	 *     key = a key
774 	 *     value = a string value, or %NULL
775 	 *
776 	 * Since: 2.10
777 	 */
778 	public void set(string key, string value)
779 	{
780 		gtk_print_settings_set(gtkPrintSettings, Str.toStringz(key), Str.toStringz(value));
781 	}
782 
783 	/**
784 	 * Sets @key to a boolean value.
785 	 *
786 	 * Params:
787 	 *     key = a key
788 	 *     value = a boolean
789 	 *
790 	 * Since: 2.10
791 	 */
792 	public void setBool(string key, bool value)
793 	{
794 		gtk_print_settings_set_bool(gtkPrintSettings, Str.toStringz(key), value);
795 	}
796 
797 	/**
798 	 * Sets the value of %GTK_PRINT_SETTINGS_COLLATE.
799 	 *
800 	 * Params:
801 	 *     collate = whether to collate the output
802 	 *
803 	 * Since: 2.10
804 	 */
805 	public void setCollate(bool collate)
806 	{
807 		gtk_print_settings_set_collate(gtkPrintSettings, collate);
808 	}
809 
810 	/**
811 	 * Sets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
812 	 *
813 	 * Params:
814 	 *     defaultSource = the default source
815 	 *
816 	 * Since: 2.10
817 	 */
818 	public void setDefaultSource(string defaultSource)
819 	{
820 		gtk_print_settings_set_default_source(gtkPrintSettings, Str.toStringz(defaultSource));
821 	}
822 
823 	/**
824 	 * Sets the value of %GTK_PRINT_SETTINGS_DITHER.
825 	 *
826 	 * Params:
827 	 *     dither = the dithering that is used
828 	 *
829 	 * Since: 2.10
830 	 */
831 	public void setDither(string dither)
832 	{
833 		gtk_print_settings_set_dither(gtkPrintSettings, Str.toStringz(dither));
834 	}
835 
836 	/**
837 	 * Sets @key to a double value.
838 	 *
839 	 * Params:
840 	 *     key = a key
841 	 *     value = a double value
842 	 *
843 	 * Since: 2.10
844 	 */
845 	public void setDouble(string key, double value)
846 	{
847 		gtk_print_settings_set_double(gtkPrintSettings, Str.toStringz(key), value);
848 	}
849 
850 	/**
851 	 * Sets the value of %GTK_PRINT_SETTINGS_DUPLEX.
852 	 *
853 	 * Params:
854 	 *     duplex = a #GtkPrintDuplex value
855 	 *
856 	 * Since: 2.10
857 	 */
858 	public void setDuplex(GtkPrintDuplex duplex)
859 	{
860 		gtk_print_settings_set_duplex(gtkPrintSettings, duplex);
861 	}
862 
863 	/**
864 	 * Sets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
865 	 *
866 	 * Params:
867 	 *     finishings = the finishings
868 	 *
869 	 * Since: 2.10
870 	 */
871 	public void setFinishings(string finishings)
872 	{
873 		gtk_print_settings_set_finishings(gtkPrintSettings, Str.toStringz(finishings));
874 	}
875 
876 	/**
877 	 * Sets @key to an integer value.
878 	 *
879 	 * Params:
880 	 *     key = a key
881 	 *     value = an integer
882 	 *
883 	 * Since: 2.10
884 	 */
885 	public void setInt(string key, int value)
886 	{
887 		gtk_print_settings_set_int(gtkPrintSettings, Str.toStringz(key), value);
888 	}
889 
890 	/**
891 	 * Associates a length in units of @unit with @key.
892 	 *
893 	 * Params:
894 	 *     key = a key
895 	 *     value = a length
896 	 *     unit = the unit of @length
897 	 *
898 	 * Since: 2.10
899 	 */
900 	public void setLength(string key, double value, GtkUnit unit)
901 	{
902 		gtk_print_settings_set_length(gtkPrintSettings, Str.toStringz(key), value, unit);
903 	}
904 
905 	/**
906 	 * Sets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
907 	 *
908 	 * The set of media types is defined in PWG 5101.1-2002 PWG.
909 	 *
910 	 * Params:
911 	 *     mediaType = the media type
912 	 *
913 	 * Since: 2.10
914 	 */
915 	public void setMediaType(string mediaType)
916 	{
917 		gtk_print_settings_set_media_type(gtkPrintSettings, Str.toStringz(mediaType));
918 	}
919 
920 	/**
921 	 * Sets the value of %GTK_PRINT_SETTINGS_N_COPIES.
922 	 *
923 	 * Params:
924 	 *     numCopies = the number of copies
925 	 *
926 	 * Since: 2.10
927 	 */
928 	public void setNCopies(int numCopies)
929 	{
930 		gtk_print_settings_set_n_copies(gtkPrintSettings, numCopies);
931 	}
932 
933 	/**
934 	 * Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
935 	 *
936 	 * Params:
937 	 *     numberUp = the number of pages per sheet
938 	 *
939 	 * Since: 2.10
940 	 */
941 	public void setNumberUp(int numberUp)
942 	{
943 		gtk_print_settings_set_number_up(gtkPrintSettings, numberUp);
944 	}
945 
946 	/**
947 	 * Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
948 	 *
949 	 * Params:
950 	 *     numberUpLayout = a #GtkNumberUpLayout value
951 	 *
952 	 * Since: 2.14
953 	 */
954 	public void setNumberUpLayout(GtkNumberUpLayout numberUpLayout)
955 	{
956 		gtk_print_settings_set_number_up_layout(gtkPrintSettings, numberUpLayout);
957 	}
958 
959 	/**
960 	 * Sets the value of %GTK_PRINT_SETTINGS_ORIENTATION.
961 	 *
962 	 * Params:
963 	 *     orientation = a page orientation
964 	 *
965 	 * Since: 2.10
966 	 */
967 	public void setOrientation(GtkPageOrientation orientation)
968 	{
969 		gtk_print_settings_set_orientation(gtkPrintSettings, orientation);
970 	}
971 
972 	/**
973 	 * Sets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
974 	 *
975 	 * Params:
976 	 *     outputBin = the output bin
977 	 *
978 	 * Since: 2.10
979 	 */
980 	public void setOutputBin(string outputBin)
981 	{
982 		gtk_print_settings_set_output_bin(gtkPrintSettings, Str.toStringz(outputBin));
983 	}
984 
985 	/**
986 	 * Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
987 	 *
988 	 * Params:
989 	 *     pageRanges = an array of #GtkPageRanges
990 	 *
991 	 * Since: 2.10
992 	 */
993 	public void setPageRanges(GtkPageRange[] pageRanges)
994 	{
995 		gtk_print_settings_set_page_ranges(gtkPrintSettings, pageRanges.ptr, cast(int)pageRanges.length);
996 	}
997 
998 	/**
999 	 * Sets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
1000 	 *
1001 	 * Params:
1002 	 *     pageSet = a #GtkPageSet value
1003 	 *
1004 	 * Since: 2.10
1005 	 */
1006 	public void setPageSet(GtkPageSet pageSet)
1007 	{
1008 		gtk_print_settings_set_page_set(gtkPrintSettings, pageSet);
1009 	}
1010 
1011 	/**
1012 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
1013 	 *
1014 	 * Params:
1015 	 *     height = the paper height
1016 	 *     unit = the units of @height
1017 	 *
1018 	 * Since: 2.10
1019 	 */
1020 	public void setPaperHeight(double height, GtkUnit unit)
1021 	{
1022 		gtk_print_settings_set_paper_height(gtkPrintSettings, height, unit);
1023 	}
1024 
1025 	/**
1026 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT,
1027 	 * %GTK_PRINT_SETTINGS_PAPER_WIDTH and
1028 	 * %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
1029 	 *
1030 	 * Params:
1031 	 *     paperSize = a paper size
1032 	 *
1033 	 * Since: 2.10
1034 	 */
1035 	public void setPaperSize(PaperSize paperSize)
1036 	{
1037 		gtk_print_settings_set_paper_size(gtkPrintSettings, (paperSize is null) ? null : paperSize.getPaperSizeStruct());
1038 	}
1039 
1040 	/**
1041 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH.
1042 	 *
1043 	 * Params:
1044 	 *     width = the paper width
1045 	 *     unit = the units of @width
1046 	 *
1047 	 * Since: 2.10
1048 	 */
1049 	public void setPaperWidth(double width, GtkUnit unit)
1050 	{
1051 		gtk_print_settings_set_paper_width(gtkPrintSettings, width, unit);
1052 	}
1053 
1054 	/**
1055 	 * Sets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
1056 	 *
1057 	 * Params:
1058 	 *     pages = a #GtkPrintPages value
1059 	 *
1060 	 * Since: 2.10
1061 	 */
1062 	public void setPrintPages(GtkPrintPages pages)
1063 	{
1064 		gtk_print_settings_set_print_pages(gtkPrintSettings, pages);
1065 	}
1066 
1067 	/**
1068 	 * Convenience function to set %GTK_PRINT_SETTINGS_PRINTER
1069 	 * to @printer.
1070 	 *
1071 	 * Params:
1072 	 *     printer = the printer name
1073 	 *
1074 	 * Since: 2.10
1075 	 */
1076 	public void setPrinter(string printer)
1077 	{
1078 		gtk_print_settings_set_printer(gtkPrintSettings, Str.toStringz(printer));
1079 	}
1080 
1081 	/**
1082 	 * Sets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
1083 	 *
1084 	 * Params:
1085 	 *     lpi = the resolution in lpi (lines per inch)
1086 	 *
1087 	 * Since: 2.16
1088 	 */
1089 	public void setPrinterLpi(double lpi)
1090 	{
1091 		gtk_print_settings_set_printer_lpi(gtkPrintSettings, lpi);
1092 	}
1093 
1094 	/**
1095 	 * Sets the value of %GTK_PRINT_SETTINGS_QUALITY.
1096 	 *
1097 	 * Params:
1098 	 *     quality = a #GtkPrintQuality value
1099 	 *
1100 	 * Since: 2.10
1101 	 */
1102 	public void setQuality(GtkPrintQuality quality)
1103 	{
1104 		gtk_print_settings_set_quality(gtkPrintSettings, quality);
1105 	}
1106 
1107 	/**
1108 	 * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
1109 	 * %GTK_PRINT_SETTINGS_RESOLUTION_X and
1110 	 * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
1111 	 *
1112 	 * Params:
1113 	 *     resolution = the resolution in dpi
1114 	 *
1115 	 * Since: 2.10
1116 	 */
1117 	public void setResolution(int resolution)
1118 	{
1119 		gtk_print_settings_set_resolution(gtkPrintSettings, resolution);
1120 	}
1121 
1122 	/**
1123 	 * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
1124 	 * %GTK_PRINT_SETTINGS_RESOLUTION_X and
1125 	 * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
1126 	 *
1127 	 * Params:
1128 	 *     resolutionX = the horizontal resolution in dpi
1129 	 *     resolutionY = the vertical resolution in dpi
1130 	 *
1131 	 * Since: 2.16
1132 	 */
1133 	public void setResolutionXy(int resolutionX, int resolutionY)
1134 	{
1135 		gtk_print_settings_set_resolution_xy(gtkPrintSettings, resolutionX, resolutionY);
1136 	}
1137 
1138 	/**
1139 	 * Sets the value of %GTK_PRINT_SETTINGS_REVERSE.
1140 	 *
1141 	 * Params:
1142 	 *     reverse = whether to reverse the output
1143 	 *
1144 	 * Since: 2.10
1145 	 */
1146 	public void setReverse(bool reverse)
1147 	{
1148 		gtk_print_settings_set_reverse(gtkPrintSettings, reverse);
1149 	}
1150 
1151 	/**
1152 	 * Sets the value of %GTK_PRINT_SETTINGS_SCALE.
1153 	 *
1154 	 * Params:
1155 	 *     scale = the scale in percent
1156 	 *
1157 	 * Since: 2.10
1158 	 */
1159 	public void setScale(double scale)
1160 	{
1161 		gtk_print_settings_set_scale(gtkPrintSettings, scale);
1162 	}
1163 
1164 	/**
1165 	 * Sets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
1166 	 *
1167 	 * Params:
1168 	 *     useColor = whether to use color
1169 	 *
1170 	 * Since: 2.10
1171 	 */
1172 	public void setUseColor(bool useColor)
1173 	{
1174 		gtk_print_settings_set_use_color(gtkPrintSettings, useColor);
1175 	}
1176 
1177 	/**
1178 	 * This function saves the print settings from @settings to @file_name. If the
1179 	 * file could not be loaded then error is set to either a #GFileError or
1180 	 * #GKeyFileError.
1181 	 *
1182 	 * Params:
1183 	 *     fileName = the file to save to
1184 	 *
1185 	 * Returns: %TRUE on success
1186 	 *
1187 	 * Since: 2.12
1188 	 *
1189 	 * Throws: GException on failure.
1190 	 */
1191 	public bool toFile(string fileName)
1192 	{
1193 		GError* err = null;
1194 
1195 		auto p = gtk_print_settings_to_file(gtkPrintSettings, Str.toStringz(fileName), &err) != 0;
1196 
1197 		if (err !is null)
1198 		{
1199 			throw new GException( new ErrorG(err) );
1200 		}
1201 
1202 		return p;
1203 	}
1204 
1205 	/**
1206 	 * Serialize print settings to an a{sv} variant.
1207 	 *
1208 	 * Returns: a new, floating, #GVariant
1209 	 *
1210 	 * Since: 3.22
1211 	 */
1212 	public Variant toGvariant()
1213 	{
1214 		auto p = gtk_print_settings_to_gvariant(gtkPrintSettings);
1215 
1216 		if(p is null)
1217 		{
1218 			return null;
1219 		}
1220 
1221 		return new Variant(cast(GVariant*) p);
1222 	}
1223 
1224 	/**
1225 	 * This function adds the print settings from @settings to @key_file.
1226 	 *
1227 	 * Params:
1228 	 *     keyFile = the #GKeyFile to save the print settings to
1229 	 *     groupName = the group to add the settings to in @key_file, or
1230 	 *         %NULL to use the default “Print Settings”
1231 	 *
1232 	 * Since: 2.12
1233 	 */
1234 	public void toKeyFile(KeyFile keyFile, string groupName)
1235 	{
1236 		gtk_print_settings_to_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName));
1237 	}
1238 
1239 	/**
1240 	 * Removes any value associated with @key.
1241 	 * This has the same effect as setting the value to %NULL.
1242 	 *
1243 	 * Params:
1244 	 *     key = a key
1245 	 *
1246 	 * Since: 2.10
1247 	 */
1248 	public void unset(string key)
1249 	{
1250 		gtk_print_settings_unset(gtkPrintSettings, Str.toStringz(key));
1251 	}
1252 }