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