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