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 	alias foreac = foreach_;
227 	/**
228 	 * Calls @func for each key-value pair of @settings.
229 	 *
230 	 * Params:
231 	 *     func = the function to call
232 	 *     userData = user data for @func
233 	 *
234 	 * Since: 2.10
235 	 */
236 	public void foreach_(GtkPrintSettingsFunc func, void* userData)
237 	{
238 		gtk_print_settings_foreach(gtkPrintSettings, func, userData);
239 	}
240 
241 	/**
242 	 * Looks up the string value associated with @key.
243 	 *
244 	 * Params:
245 	 *     key = a key
246 	 *
247 	 * Returns: the string value for @key
248 	 *
249 	 * Since: 2.10
250 	 */
251 	public string get(string key)
252 	{
253 		return Str.toString(gtk_print_settings_get(gtkPrintSettings, Str.toStringz(key)));
254 	}
255 
256 	/**
257 	 * Returns the boolean represented by the value
258 	 * that is associated with @key.
259 	 *
260 	 * The string “true” represents %TRUE, any other
261 	 * string %FALSE.
262 	 *
263 	 * Params:
264 	 *     key = a key
265 	 *
266 	 * Returns: %TRUE, if @key maps to a true value.
267 	 *
268 	 * Since: 2.10
269 	 */
270 	public bool getBool(string key)
271 	{
272 		return gtk_print_settings_get_bool(gtkPrintSettings, Str.toStringz(key)) != 0;
273 	}
274 
275 	/**
276 	 * Gets the value of %GTK_PRINT_SETTINGS_COLLATE.
277 	 *
278 	 * Returns: whether to collate the printed pages
279 	 *
280 	 * Since: 2.10
281 	 */
282 	public bool getCollate()
283 	{
284 		return gtk_print_settings_get_collate(gtkPrintSettings) != 0;
285 	}
286 
287 	/**
288 	 * Gets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
289 	 *
290 	 * Returns: the default source
291 	 *
292 	 * Since: 2.10
293 	 */
294 	public string getDefaultSource()
295 	{
296 		return Str.toString(gtk_print_settings_get_default_source(gtkPrintSettings));
297 	}
298 
299 	/**
300 	 * Gets the value of %GTK_PRINT_SETTINGS_DITHER.
301 	 *
302 	 * Returns: the dithering that is used
303 	 *
304 	 * Since: 2.10
305 	 */
306 	public string getDither()
307 	{
308 		return Str.toString(gtk_print_settings_get_dither(gtkPrintSettings));
309 	}
310 
311 	/**
312 	 * Returns the double value associated with @key, or 0.
313 	 *
314 	 * Params:
315 	 *     key = a key
316 	 *
317 	 * Returns: the double value of @key
318 	 *
319 	 * Since: 2.10
320 	 */
321 	public double getDouble(string key)
322 	{
323 		return gtk_print_settings_get_double(gtkPrintSettings, Str.toStringz(key));
324 	}
325 
326 	/**
327 	 * Returns the floating point number represented by
328 	 * the value that is associated with @key, or @default_val
329 	 * if the value does not represent a floating point number.
330 	 *
331 	 * Floating point numbers are parsed with g_ascii_strtod().
332 	 *
333 	 * Params:
334 	 *     key = a key
335 	 *     def = the default value
336 	 *
337 	 * Returns: the floating point number associated with @key
338 	 *
339 	 * Since: 2.10
340 	 */
341 	public double getDoubleWithDefault(string key, double def)
342 	{
343 		return gtk_print_settings_get_double_with_default(gtkPrintSettings, Str.toStringz(key), def);
344 	}
345 
346 	/**
347 	 * Gets the value of %GTK_PRINT_SETTINGS_DUPLEX.
348 	 *
349 	 * Returns: whether to print the output in duplex.
350 	 *
351 	 * Since: 2.10
352 	 */
353 	public GtkPrintDuplex getDuplex()
354 	{
355 		return gtk_print_settings_get_duplex(gtkPrintSettings);
356 	}
357 
358 	/**
359 	 * Gets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
360 	 *
361 	 * Returns: the finishings
362 	 *
363 	 * Since: 2.10
364 	 */
365 	public string getFinishings()
366 	{
367 		return Str.toString(gtk_print_settings_get_finishings(gtkPrintSettings));
368 	}
369 
370 	/**
371 	 * Returns the integer value of @key, or 0.
372 	 *
373 	 * Params:
374 	 *     key = a key
375 	 *
376 	 * Returns: the integer value of @key
377 	 *
378 	 * Since: 2.10
379 	 */
380 	public int getInt(string key)
381 	{
382 		return gtk_print_settings_get_int(gtkPrintSettings, Str.toStringz(key));
383 	}
384 
385 	/**
386 	 * Returns the value of @key, interpreted as
387 	 * an integer, or the default value.
388 	 *
389 	 * Params:
390 	 *     key = a key
391 	 *     def = the default value
392 	 *
393 	 * Returns: the integer value of @key
394 	 *
395 	 * Since: 2.10
396 	 */
397 	public int getIntWithDefault(string key, int def)
398 	{
399 		return gtk_print_settings_get_int_with_default(gtkPrintSettings, Str.toStringz(key), def);
400 	}
401 
402 	/**
403 	 * Returns the value associated with @key, interpreted
404 	 * as a length. The returned value is converted to @units.
405 	 *
406 	 * Params:
407 	 *     key = a key
408 	 *     unit = the unit of the return value
409 	 *
410 	 * Returns: the length value of @key, converted to @unit
411 	 *
412 	 * Since: 2.10
413 	 */
414 	public double getLength(string key, GtkUnit unit)
415 	{
416 		return gtk_print_settings_get_length(gtkPrintSettings, Str.toStringz(key), unit);
417 	}
418 
419 	/**
420 	 * Gets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
421 	 *
422 	 * The set of media types is defined in PWG 5101.1-2002 PWG.
423 	 *
424 	 * Returns: the media type
425 	 *
426 	 * Since: 2.10
427 	 */
428 	public string getMediaType()
429 	{
430 		return Str.toString(gtk_print_settings_get_media_type(gtkPrintSettings));
431 	}
432 
433 	/**
434 	 * Gets the value of %GTK_PRINT_SETTINGS_N_COPIES.
435 	 *
436 	 * Returns: the number of copies to print
437 	 *
438 	 * Since: 2.10
439 	 */
440 	public int getNCopies()
441 	{
442 		return gtk_print_settings_get_n_copies(gtkPrintSettings);
443 	}
444 
445 	/**
446 	 * Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
447 	 *
448 	 * Returns: the number of pages per sheet
449 	 *
450 	 * Since: 2.10
451 	 */
452 	public int getNumberUp()
453 	{
454 		return gtk_print_settings_get_number_up(gtkPrintSettings);
455 	}
456 
457 	/**
458 	 * Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
459 	 *
460 	 * Returns: layout of page in number-up mode
461 	 *
462 	 * Since: 2.14
463 	 */
464 	public GtkNumberUpLayout getNumberUpLayout()
465 	{
466 		return gtk_print_settings_get_number_up_layout(gtkPrintSettings);
467 	}
468 
469 	/**
470 	 * Get the value of %GTK_PRINT_SETTINGS_ORIENTATION,
471 	 * converted to a #GtkPageOrientation.
472 	 *
473 	 * Returns: the orientation
474 	 *
475 	 * Since: 2.10
476 	 */
477 	public GtkPageOrientation getOrientation()
478 	{
479 		return gtk_print_settings_get_orientation(gtkPrintSettings);
480 	}
481 
482 	/**
483 	 * Gets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
484 	 *
485 	 * Returns: the output bin
486 	 *
487 	 * Since: 2.10
488 	 */
489 	public string getOutputBin()
490 	{
491 		return Str.toString(gtk_print_settings_get_output_bin(gtkPrintSettings));
492 	}
493 
494 	/**
495 	 * Gets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
496 	 *
497 	 * Returns: an array
498 	 *     of #GtkPageRanges.  Use g_free() to free the array when
499 	 *     it is no longer needed.
500 	 *
501 	 * Since: 2.10
502 	 */
503 	public GtkPageRange[] getPageRanges()
504 	{
505 		int numRanges;
506 
507 		auto p = gtk_print_settings_get_page_ranges(gtkPrintSettings, &numRanges);
508 
509 		return p[0 .. numRanges];
510 	}
511 
512 	/**
513 	 * Gets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
514 	 *
515 	 * Returns: the set of pages to print
516 	 *
517 	 * Since: 2.10
518 	 */
519 	public GtkPageSet getPageSet()
520 	{
521 		return gtk_print_settings_get_page_set(gtkPrintSettings);
522 	}
523 
524 	/**
525 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT,
526 	 * converted to @unit.
527 	 *
528 	 * Params:
529 	 *     unit = the unit for the return value
530 	 *
531 	 * Returns: the paper height, in units of @unit
532 	 *
533 	 * Since: 2.10
534 	 */
535 	public double getPaperHeight(GtkUnit unit)
536 	{
537 		return gtk_print_settings_get_paper_height(gtkPrintSettings, unit);
538 	}
539 
540 	/**
541 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT,
542 	 * converted to a #GtkPaperSize.
543 	 *
544 	 * Returns: the paper size
545 	 *
546 	 * Since: 2.10
547 	 */
548 	public PaperSize getPaperSize()
549 	{
550 		auto p = gtk_print_settings_get_paper_size(gtkPrintSettings);
551 
552 		if(p is null)
553 		{
554 			return null;
555 		}
556 
557 		return ObjectG.getDObject!(PaperSize)(cast(GtkPaperSize*) p, true);
558 	}
559 
560 	/**
561 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH,
562 	 * converted to @unit.
563 	 *
564 	 * Params:
565 	 *     unit = the unit for the return value
566 	 *
567 	 * Returns: the paper width, in units of @unit
568 	 *
569 	 * Since: 2.10
570 	 */
571 	public double getPaperWidth(GtkUnit unit)
572 	{
573 		return gtk_print_settings_get_paper_width(gtkPrintSettings, unit);
574 	}
575 
576 	/**
577 	 * Gets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
578 	 *
579 	 * Returns: which pages to print
580 	 *
581 	 * Since: 2.10
582 	 */
583 	public GtkPrintPages getPrintPages()
584 	{
585 		return gtk_print_settings_get_print_pages(gtkPrintSettings);
586 	}
587 
588 	/**
589 	 * Convenience function to obtain the value of
590 	 * %GTK_PRINT_SETTINGS_PRINTER.
591 	 *
592 	 * Returns: the printer name
593 	 *
594 	 * Since: 2.10
595 	 */
596 	public string getPrinter()
597 	{
598 		return Str.toString(gtk_print_settings_get_printer(gtkPrintSettings));
599 	}
600 
601 	/**
602 	 * Gets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
603 	 *
604 	 * Returns: the resolution in lpi (lines per inch)
605 	 *
606 	 * Since: 2.16
607 	 */
608 	public double getPrinterLpi()
609 	{
610 		return gtk_print_settings_get_printer_lpi(gtkPrintSettings);
611 	}
612 
613 	/**
614 	 * Gets the value of %GTK_PRINT_SETTINGS_QUALITY.
615 	 *
616 	 * Returns: the print quality
617 	 *
618 	 * Since: 2.10
619 	 */
620 	public GtkPrintQuality getQuality()
621 	{
622 		return gtk_print_settings_get_quality(gtkPrintSettings);
623 	}
624 
625 	/**
626 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION.
627 	 *
628 	 * Returns: the resolution in dpi
629 	 *
630 	 * Since: 2.10
631 	 */
632 	public int getResolution()
633 	{
634 		return gtk_print_settings_get_resolution(gtkPrintSettings);
635 	}
636 
637 	/**
638 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_X.
639 	 *
640 	 * Returns: the horizontal resolution in dpi
641 	 *
642 	 * Since: 2.16
643 	 */
644 	public int getResolutionX()
645 	{
646 		return gtk_print_settings_get_resolution_x(gtkPrintSettings);
647 	}
648 
649 	/**
650 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_Y.
651 	 *
652 	 * Returns: the vertical resolution in dpi
653 	 *
654 	 * Since: 2.16
655 	 */
656 	public int getResolutionY()
657 	{
658 		return gtk_print_settings_get_resolution_y(gtkPrintSettings);
659 	}
660 
661 	/**
662 	 * Gets the value of %GTK_PRINT_SETTINGS_REVERSE.
663 	 *
664 	 * Returns: whether to reverse the order of the printed pages
665 	 *
666 	 * Since: 2.10
667 	 */
668 	public bool getReverse()
669 	{
670 		return gtk_print_settings_get_reverse(gtkPrintSettings) != 0;
671 	}
672 
673 	/**
674 	 * Gets the value of %GTK_PRINT_SETTINGS_SCALE.
675 	 *
676 	 * Returns: the scale in percent
677 	 *
678 	 * Since: 2.10
679 	 */
680 	public double getScale()
681 	{
682 		return gtk_print_settings_get_scale(gtkPrintSettings);
683 	}
684 
685 	/**
686 	 * Gets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
687 	 *
688 	 * Returns: whether to use color
689 	 *
690 	 * Since: 2.10
691 	 */
692 	public bool getUseColor()
693 	{
694 		return gtk_print_settings_get_use_color(gtkPrintSettings) != 0;
695 	}
696 
697 	/**
698 	 * Returns %TRUE, if a value is associated with @key.
699 	 *
700 	 * Params:
701 	 *     key = a key
702 	 *
703 	 * Returns: %TRUE, if @key has a value
704 	 *
705 	 * Since: 2.10
706 	 */
707 	public bool hasKey(string key)
708 	{
709 		return gtk_print_settings_has_key(gtkPrintSettings, Str.toStringz(key)) != 0;
710 	}
711 
712 	/**
713 	 * Reads the print settings from @file_name. If the file could not be loaded
714 	 * then error is set to either a #GFileError or #GKeyFileError.
715 	 * See gtk_print_settings_to_file().
716 	 *
717 	 * Params:
718 	 *     fileName = the filename to read the settings from
719 	 *
720 	 * Returns: %TRUE on success
721 	 *
722 	 * Since: 2.14
723 	 *
724 	 * Throws: GException on failure.
725 	 */
726 	public bool loadFile(string fileName)
727 	{
728 		GError* err = null;
729 
730 		auto p = gtk_print_settings_load_file(gtkPrintSettings, Str.toStringz(fileName), &err) != 0;
731 
732 		if (err !is null)
733 		{
734 			throw new GException( new ErrorG(err) );
735 		}
736 
737 		return p;
738 	}
739 
740 	/**
741 	 * Reads the print settings from the group @group_name in @key_file. If the
742 	 * file could not be loaded then error is set to either a #GFileError or
743 	 * #GKeyFileError.
744 	 *
745 	 * Params:
746 	 *     keyFile = the #GKeyFile to retrieve the settings from
747 	 *     groupName = the name of the group to use, or %NULL to use the default
748 	 *         “Print Settings”
749 	 *
750 	 * Returns: %TRUE on success
751 	 *
752 	 * Since: 2.14
753 	 *
754 	 * Throws: GException on failure.
755 	 */
756 	public bool loadKeyFile(KeyFile keyFile, string groupName)
757 	{
758 		GError* err = null;
759 
760 		auto p = gtk_print_settings_load_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err) != 0;
761 
762 		if (err !is null)
763 		{
764 			throw new GException( new ErrorG(err) );
765 		}
766 
767 		return p;
768 	}
769 
770 	/**
771 	 * Associates @value with @key.
772 	 *
773 	 * Params:
774 	 *     key = a key
775 	 *     value = a string value, or %NULL
776 	 *
777 	 * Since: 2.10
778 	 */
779 	public void set(string key, string value)
780 	{
781 		gtk_print_settings_set(gtkPrintSettings, Str.toStringz(key), Str.toStringz(value));
782 	}
783 
784 	/**
785 	 * Sets @key to a boolean value.
786 	 *
787 	 * Params:
788 	 *     key = a key
789 	 *     value = a boolean
790 	 *
791 	 * Since: 2.10
792 	 */
793 	public void setBool(string key, bool value)
794 	{
795 		gtk_print_settings_set_bool(gtkPrintSettings, Str.toStringz(key), value);
796 	}
797 
798 	/**
799 	 * Sets the value of %GTK_PRINT_SETTINGS_COLLATE.
800 	 *
801 	 * Params:
802 	 *     collate = whether to collate the output
803 	 *
804 	 * Since: 2.10
805 	 */
806 	public void setCollate(bool collate)
807 	{
808 		gtk_print_settings_set_collate(gtkPrintSettings, collate);
809 	}
810 
811 	/**
812 	 * Sets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
813 	 *
814 	 * Params:
815 	 *     defaultSource = the default source
816 	 *
817 	 * Since: 2.10
818 	 */
819 	public void setDefaultSource(string defaultSource)
820 	{
821 		gtk_print_settings_set_default_source(gtkPrintSettings, Str.toStringz(defaultSource));
822 	}
823 
824 	/**
825 	 * Sets the value of %GTK_PRINT_SETTINGS_DITHER.
826 	 *
827 	 * Params:
828 	 *     dither = the dithering that is used
829 	 *
830 	 * Since: 2.10
831 	 */
832 	public void setDither(string dither)
833 	{
834 		gtk_print_settings_set_dither(gtkPrintSettings, Str.toStringz(dither));
835 	}
836 
837 	/**
838 	 * Sets @key to a double value.
839 	 *
840 	 * Params:
841 	 *     key = a key
842 	 *     value = a double value
843 	 *
844 	 * Since: 2.10
845 	 */
846 	public void setDouble(string key, double value)
847 	{
848 		gtk_print_settings_set_double(gtkPrintSettings, Str.toStringz(key), value);
849 	}
850 
851 	/**
852 	 * Sets the value of %GTK_PRINT_SETTINGS_DUPLEX.
853 	 *
854 	 * Params:
855 	 *     duplex = a #GtkPrintDuplex value
856 	 *
857 	 * Since: 2.10
858 	 */
859 	public void setDuplex(GtkPrintDuplex duplex)
860 	{
861 		gtk_print_settings_set_duplex(gtkPrintSettings, duplex);
862 	}
863 
864 	/**
865 	 * Sets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
866 	 *
867 	 * Params:
868 	 *     finishings = the finishings
869 	 *
870 	 * Since: 2.10
871 	 */
872 	public void setFinishings(string finishings)
873 	{
874 		gtk_print_settings_set_finishings(gtkPrintSettings, Str.toStringz(finishings));
875 	}
876 
877 	/**
878 	 * Sets @key to an integer value.
879 	 *
880 	 * Params:
881 	 *     key = a key
882 	 *     value = an integer
883 	 *
884 	 * Since: 2.10
885 	 */
886 	public void setInt(string key, int value)
887 	{
888 		gtk_print_settings_set_int(gtkPrintSettings, Str.toStringz(key), value);
889 	}
890 
891 	/**
892 	 * Associates a length in units of @unit with @key.
893 	 *
894 	 * Params:
895 	 *     key = a key
896 	 *     value = a length
897 	 *     unit = the unit of @length
898 	 *
899 	 * Since: 2.10
900 	 */
901 	public void setLength(string key, double value, GtkUnit unit)
902 	{
903 		gtk_print_settings_set_length(gtkPrintSettings, Str.toStringz(key), value, unit);
904 	}
905 
906 	/**
907 	 * Sets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
908 	 *
909 	 * The set of media types is defined in PWG 5101.1-2002 PWG.
910 	 *
911 	 * Params:
912 	 *     mediaType = the media type
913 	 *
914 	 * Since: 2.10
915 	 */
916 	public void setMediaType(string mediaType)
917 	{
918 		gtk_print_settings_set_media_type(gtkPrintSettings, Str.toStringz(mediaType));
919 	}
920 
921 	/**
922 	 * Sets the value of %GTK_PRINT_SETTINGS_N_COPIES.
923 	 *
924 	 * Params:
925 	 *     numCopies = the number of copies
926 	 *
927 	 * Since: 2.10
928 	 */
929 	public void setNCopies(int numCopies)
930 	{
931 		gtk_print_settings_set_n_copies(gtkPrintSettings, numCopies);
932 	}
933 
934 	/**
935 	 * Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
936 	 *
937 	 * Params:
938 	 *     numberUp = the number of pages per sheet
939 	 *
940 	 * Since: 2.10
941 	 */
942 	public void setNumberUp(int numberUp)
943 	{
944 		gtk_print_settings_set_number_up(gtkPrintSettings, numberUp);
945 	}
946 
947 	/**
948 	 * Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
949 	 *
950 	 * Params:
951 	 *     numberUpLayout = a #GtkNumberUpLayout value
952 	 *
953 	 * Since: 2.14
954 	 */
955 	public void setNumberUpLayout(GtkNumberUpLayout numberUpLayout)
956 	{
957 		gtk_print_settings_set_number_up_layout(gtkPrintSettings, numberUpLayout);
958 	}
959 
960 	/**
961 	 * Sets the value of %GTK_PRINT_SETTINGS_ORIENTATION.
962 	 *
963 	 * Params:
964 	 *     orientation = a page orientation
965 	 *
966 	 * Since: 2.10
967 	 */
968 	public void setOrientation(GtkPageOrientation orientation)
969 	{
970 		gtk_print_settings_set_orientation(gtkPrintSettings, orientation);
971 	}
972 
973 	/**
974 	 * Sets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
975 	 *
976 	 * Params:
977 	 *     outputBin = the output bin
978 	 *
979 	 * Since: 2.10
980 	 */
981 	public void setOutputBin(string outputBin)
982 	{
983 		gtk_print_settings_set_output_bin(gtkPrintSettings, Str.toStringz(outputBin));
984 	}
985 
986 	/**
987 	 * Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
988 	 *
989 	 * Params:
990 	 *     pageRanges = an array of #GtkPageRanges
991 	 *
992 	 * Since: 2.10
993 	 */
994 	public void setPageRanges(GtkPageRange[] pageRanges)
995 	{
996 		gtk_print_settings_set_page_ranges(gtkPrintSettings, pageRanges.ptr, cast(int)pageRanges.length);
997 	}
998 
999 	/**
1000 	 * Sets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
1001 	 *
1002 	 * Params:
1003 	 *     pageSet = a #GtkPageSet value
1004 	 *
1005 	 * Since: 2.10
1006 	 */
1007 	public void setPageSet(GtkPageSet pageSet)
1008 	{
1009 		gtk_print_settings_set_page_set(gtkPrintSettings, pageSet);
1010 	}
1011 
1012 	/**
1013 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
1014 	 *
1015 	 * Params:
1016 	 *     height = the paper height
1017 	 *     unit = the units of @height
1018 	 *
1019 	 * Since: 2.10
1020 	 */
1021 	public void setPaperHeight(double height, GtkUnit unit)
1022 	{
1023 		gtk_print_settings_set_paper_height(gtkPrintSettings, height, unit);
1024 	}
1025 
1026 	/**
1027 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT,
1028 	 * %GTK_PRINT_SETTINGS_PAPER_WIDTH and
1029 	 * %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
1030 	 *
1031 	 * Params:
1032 	 *     paperSize = a paper size
1033 	 *
1034 	 * Since: 2.10
1035 	 */
1036 	public void setPaperSize(PaperSize paperSize)
1037 	{
1038 		gtk_print_settings_set_paper_size(gtkPrintSettings, (paperSize is null) ? null : paperSize.getPaperSizeStruct());
1039 	}
1040 
1041 	/**
1042 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH.
1043 	 *
1044 	 * Params:
1045 	 *     width = the paper width
1046 	 *     unit = the units of @width
1047 	 *
1048 	 * Since: 2.10
1049 	 */
1050 	public void setPaperWidth(double width, GtkUnit unit)
1051 	{
1052 		gtk_print_settings_set_paper_width(gtkPrintSettings, width, unit);
1053 	}
1054 
1055 	/**
1056 	 * Sets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
1057 	 *
1058 	 * Params:
1059 	 *     pages = a #GtkPrintPages value
1060 	 *
1061 	 * Since: 2.10
1062 	 */
1063 	public void setPrintPages(GtkPrintPages pages)
1064 	{
1065 		gtk_print_settings_set_print_pages(gtkPrintSettings, pages);
1066 	}
1067 
1068 	/**
1069 	 * Convenience function to set %GTK_PRINT_SETTINGS_PRINTER
1070 	 * to @printer.
1071 	 *
1072 	 * Params:
1073 	 *     printer = the printer name
1074 	 *
1075 	 * Since: 2.10
1076 	 */
1077 	public void setPrinter(string printer)
1078 	{
1079 		gtk_print_settings_set_printer(gtkPrintSettings, Str.toStringz(printer));
1080 	}
1081 
1082 	/**
1083 	 * Sets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
1084 	 *
1085 	 * Params:
1086 	 *     lpi = the resolution in lpi (lines per inch)
1087 	 *
1088 	 * Since: 2.16
1089 	 */
1090 	public void setPrinterLpi(double lpi)
1091 	{
1092 		gtk_print_settings_set_printer_lpi(gtkPrintSettings, lpi);
1093 	}
1094 
1095 	/**
1096 	 * Sets the value of %GTK_PRINT_SETTINGS_QUALITY.
1097 	 *
1098 	 * Params:
1099 	 *     quality = a #GtkPrintQuality value
1100 	 *
1101 	 * Since: 2.10
1102 	 */
1103 	public void setQuality(GtkPrintQuality quality)
1104 	{
1105 		gtk_print_settings_set_quality(gtkPrintSettings, quality);
1106 	}
1107 
1108 	/**
1109 	 * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
1110 	 * %GTK_PRINT_SETTINGS_RESOLUTION_X and
1111 	 * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
1112 	 *
1113 	 * Params:
1114 	 *     resolution = the resolution in dpi
1115 	 *
1116 	 * Since: 2.10
1117 	 */
1118 	public void setResolution(int resolution)
1119 	{
1120 		gtk_print_settings_set_resolution(gtkPrintSettings, resolution);
1121 	}
1122 
1123 	/**
1124 	 * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
1125 	 * %GTK_PRINT_SETTINGS_RESOLUTION_X and
1126 	 * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
1127 	 *
1128 	 * Params:
1129 	 *     resolutionX = the horizontal resolution in dpi
1130 	 *     resolutionY = the vertical resolution in dpi
1131 	 *
1132 	 * Since: 2.16
1133 	 */
1134 	public void setResolutionXy(int resolutionX, int resolutionY)
1135 	{
1136 		gtk_print_settings_set_resolution_xy(gtkPrintSettings, resolutionX, resolutionY);
1137 	}
1138 
1139 	/**
1140 	 * Sets the value of %GTK_PRINT_SETTINGS_REVERSE.
1141 	 *
1142 	 * Params:
1143 	 *     reverse = whether to reverse the output
1144 	 *
1145 	 * Since: 2.10
1146 	 */
1147 	public void setReverse(bool reverse)
1148 	{
1149 		gtk_print_settings_set_reverse(gtkPrintSettings, reverse);
1150 	}
1151 
1152 	/**
1153 	 * Sets the value of %GTK_PRINT_SETTINGS_SCALE.
1154 	 *
1155 	 * Params:
1156 	 *     scale = the scale in percent
1157 	 *
1158 	 * Since: 2.10
1159 	 */
1160 	public void setScale(double scale)
1161 	{
1162 		gtk_print_settings_set_scale(gtkPrintSettings, scale);
1163 	}
1164 
1165 	/**
1166 	 * Sets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
1167 	 *
1168 	 * Params:
1169 	 *     useColor = whether to use color
1170 	 *
1171 	 * Since: 2.10
1172 	 */
1173 	public void setUseColor(bool useColor)
1174 	{
1175 		gtk_print_settings_set_use_color(gtkPrintSettings, useColor);
1176 	}
1177 
1178 	/**
1179 	 * This function saves the print settings from @settings to @file_name. If the
1180 	 * file could not be loaded then error is set to either a #GFileError or
1181 	 * #GKeyFileError.
1182 	 *
1183 	 * Params:
1184 	 *     fileName = the file to save to
1185 	 *
1186 	 * Returns: %TRUE on success
1187 	 *
1188 	 * Since: 2.12
1189 	 *
1190 	 * Throws: GException on failure.
1191 	 */
1192 	public bool toFile(string fileName)
1193 	{
1194 		GError* err = null;
1195 
1196 		auto p = gtk_print_settings_to_file(gtkPrintSettings, Str.toStringz(fileName), &err) != 0;
1197 
1198 		if (err !is null)
1199 		{
1200 			throw new GException( new ErrorG(err) );
1201 		}
1202 
1203 		return p;
1204 	}
1205 
1206 	/**
1207 	 * Serialize print settings to an a{sv} variant.
1208 	 *
1209 	 * Returns: a new, floating, #GVariant
1210 	 *
1211 	 * Since: 3.22
1212 	 */
1213 	public Variant toGvariant()
1214 	{
1215 		auto p = gtk_print_settings_to_gvariant(gtkPrintSettings);
1216 
1217 		if(p is null)
1218 		{
1219 			return null;
1220 		}
1221 
1222 		return new Variant(cast(GVariant*) p);
1223 	}
1224 
1225 	/**
1226 	 * This function adds the print settings from @settings to @key_file.
1227 	 *
1228 	 * Params:
1229 	 *     keyFile = the #GKeyFile to save the print settings to
1230 	 *     groupName = the group to add the settings to in @key_file, or
1231 	 *         %NULL to use the default “Print Settings”
1232 	 *
1233 	 * Since: 2.12
1234 	 */
1235 	public void toKeyFile(KeyFile keyFile, string groupName)
1236 	{
1237 		gtk_print_settings_to_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName));
1238 	}
1239 
1240 	/**
1241 	 * Removes any value associated with @key.
1242 	 * This has the same effect as setting the value to %NULL.
1243 	 *
1244 	 * Params:
1245 	 *     key = a key
1246 	 *
1247 	 * Since: 2.10
1248 	 */
1249 	public void unset(string key)
1250 	{
1251 		gtk_print_settings_unset(gtkPrintSettings, Str.toStringz(key));
1252 	}
1253 }