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