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 gio.Settings;
26 
27 private import gio.Action;
28 private import gio.ActionIF;
29 private import gio.SettingsSchema;
30 private import glib.ConstructionException;
31 private import glib.Str;
32 private import glib.Variant;
33 private import gobject.ObjectG;
34 private import gobject.Signals;
35 public  import gtkc.gdktypes;
36 private import gtkc.gio;
37 public  import gtkc.giotypes;
38 
39 
40 /**
41  * The #GSettings class provides a convenient API for storing and retrieving
42  * application settings.
43  * 
44  * Reads and writes can be considered to be non-blocking.  Reading
45  * settings with #GSettings is typically extremely fast: on
46  * approximately the same order of magnitude (but slower than) a
47  * #GHashTable lookup.  Writing settings is also extremely fast in terms
48  * of time to return to your application, but can be extremely expensive
49  * for other threads and other processes.  Many settings backends
50  * (including dconf) have lazy initialisation which means in the common
51  * case of the user using their computer without modifying any settings
52  * a lot of work can be avoided.  For dconf, the D-Bus service doesn't
53  * even need to be started in this case.  For this reason, you should
54  * only ever modify #GSettings keys in response to explicit user action.
55  * Particular care should be paid to ensure that modifications are not
56  * made during startup -- for example, when setting the initial value
57  * of preferences widgets.  The built-in g_settings_bind() functionality
58  * is careful not to write settings in response to notify signals as a
59  * result of modifications that it makes to widgets.
60  * 
61  * When creating a GSettings instance, you have to specify a schema
62  * that describes the keys in your settings and their types and default
63  * values, as well as some other information.
64  * 
65  * Normally, a schema has as fixed path that determines where the settings
66  * are stored in the conceptual global tree of settings. However, schemas
67  * can also be '[relocatable][gsettings-relocatable]', i.e. not equipped with
68  * a fixed path. This is
69  * useful e.g. when the schema describes an 'account', and you want to be
70  * able to store a arbitrary number of accounts.
71  * 
72  * Paths must start with and end with a forward slash character ('/')
73  * and must not contain two sequential slash characters.  Paths should
74  * be chosen based on a domain name associated with the program or
75  * library to which the settings belong.  Examples of paths are
76  * "/org/gtk/settings/file-chooser/" and "/ca/desrt/dconf-editor/".
77  * Paths should not start with "/apps/", "/desktop/" or "/system/" as
78  * they often did in GConf.
79  * 
80  * Unlike other configuration systems (like GConf), GSettings does not
81  * restrict keys to basic types like strings and numbers. GSettings stores
82  * values as #GVariant, and allows any #GVariantType for keys. Key names
83  * are restricted to lowercase characters, numbers and '-'. Furthermore,
84  * the names must begin with a lowercase character, must not end
85  * with a '-', and must not contain consecutive dashes.
86  * 
87  * Similar to GConf, the default values in GSettings schemas can be
88  * localized, but the localized values are stored in gettext catalogs
89  * and looked up with the domain that is specified in the
90  * `gettext-domain` attribute of the <schemalist> or <schema>
91  * elements and the category that is specified in the `l10n` attribute of
92  * the <default> element. The string which is translated includes all text in
93  * the <default> element, including any surrounding quotation marks.
94  * 
95  * The `l10n` attribute must be set to `messages` or `time`, and sets the
96  * [locale category for
97  * translation](https://www.gnu.org/software/gettext/manual/html_node/Aspects.html#index-locale-categories-1).
98  * The `messages` category should be used by default; use `time` for
99  * translatable date or time formats. A translation comment can be added as an
100  * XML comment immediately above the <default> element — it is recommended to
101  * add these comments to aid translators understand the meaning and
102  * implications of the default value. An optional translation `context`
103  * attribute can be set on the <default> element to disambiguate multiple
104  * defaults which use the same string.
105  * 
106  * For example:
107  * |[
108  * <!-- Translators: A list of words which are not allowed to be typed, in
109  * GVariant serialization syntax.
110  * See: https://developer.gnome.org/glib/stable/gvariant-text.html -->
111  * <default l10n='messages' context='Banned words'>['bad', 'words']</default>
112  * ]|
113  * 
114  * Translations of default values must remain syntactically valid serialized
115  * #GVariants (e.g. retaining any surrounding quotation marks) or runtime
116  * errors will occur.
117  * 
118  * GSettings uses schemas in a compact binary form that is created
119  * by the [glib-compile-schemas][glib-compile-schemas]
120  * utility. The input is a schema description in an XML format.
121  * 
122  * A DTD for the gschema XML format can be found here:
123  * [gschema.dtd](https://git.gnome.org/browse/glib/tree/gio/gschema.dtd)
124  * 
125  * The [glib-compile-schemas][glib-compile-schemas] tool expects schema
126  * files to have the extension `.gschema.xml`.
127  * 
128  * At runtime, schemas are identified by their id (as specified in the
129  * id attribute of the <schema> element). The convention for schema
130  * ids is to use a dotted name, similar in style to a D-Bus bus name,
131  * e.g. "org.gnome.SessionManager". In particular, if the settings are
132  * for a specific service that owns a D-Bus bus name, the D-Bus bus name
133  * and schema id should match. For schemas which deal with settings not
134  * associated with one named application, the id should not use
135  * StudlyCaps, e.g. "org.gnome.font-rendering".
136  * 
137  * In addition to #GVariant types, keys can have types that have
138  * enumerated types. These can be described by a <choice>,
139  * <enum> or <flags> element, as seen in the
140  * [example][schema-enumerated]. The underlying type of such a key
141  * is string, but you can use g_settings_get_enum(), g_settings_set_enum(),
142  * g_settings_get_flags(), g_settings_set_flags() access the numeric values
143  * corresponding to the string value of enum and flags keys.
144  * 
145  * An example for default value:
146  * |[
147  * <schemalist>
148  * <schema id="org.gtk.Test" path="/org/gtk/Test/" gettext-domain="test">
149  * 
150  * <key name="greeting" type="s">
151  * <default l10n="messages">"Hello, earthlings"</default>
152  * <summary>A greeting</summary>
153  * <description>
154  * Greeting of the invading martians
155  * </description>
156  * </key>
157  * 
158  * <key name="box" type="(ii)">
159  * <default>(20,30)</default>
160  * </key>
161  * 
162  * </schema>
163  * </schemalist>
164  * ]|
165  * 
166  * An example for ranges, choices and enumerated types:
167  * |[
168  * <schemalist>
169  * 
170  * <enum id="org.gtk.Test.myenum">
171  * <value nick="first" value="1"/>
172  * <value nick="second" value="2"/>
173  * </enum>
174  * 
175  * <flags id="org.gtk.Test.myflags">
176  * <value nick="flag1" value="1"/>
177  * <value nick="flag2" value="2"/>
178  * <value nick="flag3" value="4"/>
179  * </flags>
180  * 
181  * <schema id="org.gtk.Test">
182  * 
183  * <key name="key-with-range" type="i">
184  * <range min="1" max="100"/>
185  * <default>10</default>
186  * </key>
187  * 
188  * <key name="key-with-choices" type="s">
189  * <choices>
190  * <choice value='Elisabeth'/>
191  * <choice value='Annabeth'/>
192  * <choice value='Joe'/>
193  * </choices>
194  * <aliases>
195  * <alias value='Anna' target='Annabeth'/>
196  * <alias value='Beth' target='Elisabeth'/>
197  * </aliases>
198  * <default>'Joe'</default>
199  * </key>
200  * 
201  * <key name='enumerated-key' enum='org.gtk.Test.myenum'>
202  * <default>'first'</default>
203  * </key>
204  * 
205  * <key name='flags-key' flags='org.gtk.Test.myflags'>
206  * <default>["flag1","flag2"]</default>
207  * </key>
208  * </schema>
209  * </schemalist>
210  * ]|
211  * 
212  * ## Vendor overrides
213  * 
214  * Default values are defined in the schemas that get installed by
215  * an application. Sometimes, it is necessary for a vendor or distributor
216  * to adjust these defaults. Since patching the XML source for the schema
217  * is inconvenient and error-prone,
218  * [glib-compile-schemas][glib-compile-schemas] reads so-called vendor
219  * override' files. These are keyfiles in the same directory as the XML
220  * schema sources which can override default values. The schema id serves
221  * as the group name in the key file, and the values are expected in
222  * serialized GVariant form, as in the following example:
223  * |[
224  * [org.gtk.Example]
225  * key1='string'
226  * key2=1.5
227  * ]|
228  * 
229  * glib-compile-schemas expects schema files to have the extension
230  * `.gschema.override`.
231  * 
232  * ## Binding
233  * 
234  * A very convenient feature of GSettings lets you bind #GObject properties
235  * directly to settings, using g_settings_bind(). Once a GObject property
236  * has been bound to a setting, changes on either side are automatically
237  * propagated to the other side. GSettings handles details like mapping
238  * between GObject and GVariant types, and preventing infinite cycles.
239  * 
240  * This makes it very easy to hook up a preferences dialog to the
241  * underlying settings. To make this even more convenient, GSettings
242  * looks for a boolean property with the name "sensitivity" and
243  * automatically binds it to the writability of the bound setting.
244  * If this 'magic' gets in the way, it can be suppressed with the
245  * #G_SETTINGS_BIND_NO_SENSITIVITY flag.
246  * 
247  * ## Relocatable schemas # {#gsettings-relocatable}
248  * 
249  * A relocatable schema is one with no `path` attribute specified on its
250  * <schema> element. By using g_settings_new_with_path(), a #GSettings object
251  * can be instantiated for a relocatable schema, assigning a path to the
252  * instance. Paths passed to g_settings_new_with_path() will typically be
253  * constructed dynamically from a constant prefix plus some form of instance
254  * identifier; but they must still be valid GSettings paths. Paths could also
255  * be constant and used with a globally installed schema originating from a
256  * dependency library.
257  * 
258  * For example, a relocatable schema could be used to store geometry information
259  * for different windows in an application. If the schema ID was
260  * `org.foo.MyApp.Window`, it could be instantiated for paths
261  * `/org/foo/MyApp/main/`, `/org/foo/MyApp/document-1/`,
262  * `/org/foo/MyApp/document-2/`, etc. If any of the paths are well-known
263  * they can be specified as <child> elements in the parent schema, e.g.:
264  * |[
265  * <schema id="org.foo.MyApp" path="/org/foo/MyApp/">
266  * <child name="main" schema="org.foo.MyApp.Window"/>
267  * </schema>
268  * ]|
269  * 
270  * ## Build system integration # {#gsettings-build-system}
271  * 
272  * GSettings comes with autotools integration to simplify compiling and
273  * installing schemas. To add GSettings support to an application, add the
274  * following to your `configure.ac`:
275  * |[
276  * GLIB_GSETTINGS
277  * ]|
278  * 
279  * In the appropriate `Makefile.am`, use the following snippet to compile and
280  * install the named schema:
281  * |[
282  * gsettings_SCHEMAS = org.foo.MyApp.gschema.xml
283  * EXTRA_DIST = $(gsettings_SCHEMAS)
284  * 
285  * @GSETTINGS_RULES@
286  * ]|
287  * 
288  * No changes are needed to the build system to mark a schema XML file for
289  * translation. Assuming it sets the `gettext-domain` attribute, a schema may
290  * be marked for translation by adding it to `POTFILES.in`, assuming gettext
291  * 0.19 is in use (the preferred method for translation):
292  * |[
293  * data/org.foo.MyApp.gschema.xml
294  * ]|
295  * 
296  * Alternatively, if intltool 0.50.1 is in use:
297  * |[
298  * [type: gettext/gsettings]data/org.foo.MyApp.gschema.xml
299  * ]|
300  * 
301  * GSettings will use gettext to look up translations for the <summary> and
302  * <description> elements, and also any <default> elements which have a `l10n`
303  * attribute set. Translations must not be included in the `.gschema.xml` file
304  * by the build system, for example by using intltool XML rules with a
305  * `.gschema.xml.in` template.
306  * 
307  * If an enumerated type defined in a C header file is to be used in a GSettings
308  * schema, it can either be defined manually using an <enum> element in the
309  * schema XML, or it can be extracted automatically from the C header. This
310  * approach is preferred, as it ensures the two representations are always
311  * synchronised. To do so, add the following to the relevant `Makefile.am`:
312  * |[
313  * gsettings_ENUM_NAMESPACE = org.foo.MyApp
314  * gsettings_ENUM_FILES = my-app-enums.h my-app-misc.h
315  * ]|
316  * 
317  * `gsettings_ENUM_NAMESPACE` specifies the schema namespace for the enum files,
318  * which are specified in `gsettings_ENUM_FILES`. This will generate a
319  * `org.foo.MyApp.enums.xml` file containing the extracted enums, which will be
320  * automatically included in the schema compilation, install and uninstall
321  * rules. It should not be committed to version control or included in
322  * `EXTRA_DIST`.
323  */
324 public class Settings : ObjectG
325 {
326 	/** the main Gtk struct */
327 	protected GSettings* gSettings;
328 
329 	/** Get the main Gtk struct */
330 	public GSettings* getSettingsStruct()
331 	{
332 		return gSettings;
333 	}
334 
335 	/** the main Gtk struct as a void* */
336 	protected override void* getStruct()
337 	{
338 		return cast(void*)gSettings;
339 	}
340 
341 	protected override void setStruct(GObject* obj)
342 	{
343 		gSettings = cast(GSettings*)obj;
344 		super.setStruct(obj);
345 	}
346 
347 	/**
348 	 * Sets our main struct and passes it to the parent class.
349 	 */
350 	public this (GSettings* gSettings, bool ownedRef = false)
351 	{
352 		this.gSettings = gSettings;
353 		super(cast(GObject*)gSettings, ownedRef);
354 	}
355 
356 
357 	/** */
358 	public static GType getType()
359 	{
360 		return g_settings_get_type();
361 	}
362 
363 	/**
364 	 * Creates a new #GSettings object with the schema specified by
365 	 * @schema_id.
366 	 *
367 	 * Signals on the newly created #GSettings object will be dispatched
368 	 * via the thread-default #GMainContext in effect at the time of the
369 	 * call to g_settings_new().  The new #GSettings will hold a reference
370 	 * on the context.  See g_main_context_push_thread_default().
371 	 *
372 	 * Params:
373 	 *     schemaId = the id of the schema
374 	 *
375 	 * Return: a new #GSettings object
376 	 *
377 	 * Since: 2.26
378 	 *
379 	 * Throws: ConstructionException GTK+ fails to create the object.
380 	 */
381 	public this(string schemaId)
382 	{
383 		auto p = g_settings_new(Str.toStringz(schemaId));
384 		
385 		if(p is null)
386 		{
387 			throw new ConstructionException("null returned by new");
388 		}
389 		
390 		this(cast(GSettings*) p, true);
391 	}
392 
393 	/**
394 	 * Creates a new #GSettings object with a given schema, backend and
395 	 * path.
396 	 *
397 	 * It should be extremely rare that you ever want to use this function.
398 	 * It is made available for advanced use-cases (such as plugin systems
399 	 * that want to provide access to schemas loaded from custom locations,
400 	 * etc).
401 	 *
402 	 * At the most basic level, a #GSettings object is a pure composition of
403 	 * 4 things: a #GSettingsSchema, a #GSettingsBackend, a path within that
404 	 * backend, and a #GMainContext to which signals are dispatched.
405 	 *
406 	 * This constructor therefore gives you full control over constructing
407 	 * #GSettings instances.  The first 3 parameters are given directly as
408 	 * @schema, @backend and @path, and the main context is taken from the
409 	 * thread-default (as per g_settings_new()).
410 	 *
411 	 * If @backend is %NULL then the default backend is used.
412 	 *
413 	 * If @path is %NULL then the path from the schema is used.  It is an
414 	 * error if @path is %NULL and the schema has no path of its own or if
415 	 * @path is non-%NULL and not equal to the path that the schema does
416 	 * have.
417 	 *
418 	 * Params:
419 	 *     schema = a #GSettingsSchema
420 	 *     backend = a #GSettingsBackend
421 	 *     path = the path to use
422 	 *
423 	 * Return: a new #GSettings object
424 	 *
425 	 * Since: 2.32
426 	 *
427 	 * Throws: ConstructionException GTK+ fails to create the object.
428 	 */
429 	public this(SettingsSchema schema, GSettingsBackend* backend, string path)
430 	{
431 		auto p = g_settings_new_full((schema is null) ? null : schema.getSettingsSchemaStruct(), backend, Str.toStringz(path));
432 		
433 		if(p is null)
434 		{
435 			throw new ConstructionException("null returned by new_full");
436 		}
437 		
438 		this(cast(GSettings*) p, true);
439 	}
440 
441 	/**
442 	 * Creates a new #GSettings object with the schema specified by
443 	 * @schema_id and a given #GSettingsBackend.
444 	 *
445 	 * Creating a #GSettings object with a different backend allows accessing
446 	 * settings from a database other than the usual one. For example, it may make
447 	 * sense to pass a backend corresponding to the "defaults" settings database on
448 	 * the system to get a settings object that modifies the system default
449 	 * settings instead of the settings for this user.
450 	 *
451 	 * Params:
452 	 *     schemaId = the id of the schema
453 	 *     backend = the #GSettingsBackend to use
454 	 *
455 	 * Return: a new #GSettings object
456 	 *
457 	 * Since: 2.26
458 	 *
459 	 * Throws: ConstructionException GTK+ fails to create the object.
460 	 */
461 	public this(string schemaId, GSettingsBackend* backend)
462 	{
463 		auto p = g_settings_new_with_backend(Str.toStringz(schemaId), backend);
464 		
465 		if(p is null)
466 		{
467 			throw new ConstructionException("null returned by new_with_backend");
468 		}
469 		
470 		this(cast(GSettings*) p, true);
471 	}
472 
473 	/**
474 	 * Creates a new #GSettings object with the schema specified by
475 	 * @schema_id and a given #GSettingsBackend and path.
476 	 *
477 	 * This is a mix of g_settings_new_with_backend() and
478 	 * g_settings_new_with_path().
479 	 *
480 	 * Params:
481 	 *     schemaId = the id of the schema
482 	 *     backend = the #GSettingsBackend to use
483 	 *     path = the path to use
484 	 *
485 	 * Return: a new #GSettings object
486 	 *
487 	 * Since: 2.26
488 	 *
489 	 * Throws: ConstructionException GTK+ fails to create the object.
490 	 */
491 	public this(string schemaId, GSettingsBackend* backend, string path)
492 	{
493 		auto p = g_settings_new_with_backend_and_path(Str.toStringz(schemaId), backend, Str.toStringz(path));
494 		
495 		if(p is null)
496 		{
497 			throw new ConstructionException("null returned by new_with_backend_and_path");
498 		}
499 		
500 		this(cast(GSettings*) p, true);
501 	}
502 
503 	/**
504 	 * Creates a new #GSettings object with the relocatable schema specified
505 	 * by @schema_id and a given path.
506 	 *
507 	 * You only need to do this if you want to directly create a settings
508 	 * object with a schema that doesn't have a specified path of its own.
509 	 * That's quite rare.
510 	 *
511 	 * It is a programmer error to call this function for a schema that
512 	 * has an explicitly specified path.
513 	 *
514 	 * It is a programmer error if @path is not a valid path.  A valid path
515 	 * begins and ends with '/' and does not contain two consecutive '/'
516 	 * characters.
517 	 *
518 	 * Params:
519 	 *     schemaId = the id of the schema
520 	 *     path = the path to use
521 	 *
522 	 * Return: a new #GSettings object
523 	 *
524 	 * Since: 2.26
525 	 *
526 	 * Throws: ConstructionException GTK+ fails to create the object.
527 	 */
528 	public this(string schemaId, string path)
529 	{
530 		auto p = g_settings_new_with_path(Str.toStringz(schemaId), Str.toStringz(path));
531 		
532 		if(p is null)
533 		{
534 			throw new ConstructionException("null returned by new_with_path");
535 		}
536 		
537 		this(cast(GSettings*) p, true);
538 	}
539 
540 	/**
541 	 * <!-- -->
542 	 *
543 	 * Deprecated: Use g_settings_schema_source_list_schemas() instead
544 	 *
545 	 * Return: a list of relocatable
546 	 *     #GSettings schemas that are available.  The list must not be
547 	 *     modified or freed.
548 	 *
549 	 * Since: 2.28
550 	 */
551 	public static string[] listRelocatableSchemas()
552 	{
553 		return Str.toStringArray(g_settings_list_relocatable_schemas());
554 	}
555 
556 	/**
557 	 * <!-- -->
558 	 *
559 	 * Deprecated: Use g_settings_schema_source_list_schemas() instead.
560 	 * If you used g_settings_list_schemas() to check for the presence of
561 	 * a particular schema, use g_settings_schema_source_lookup() instead
562 	 * of your whole loop.
563 	 *
564 	 * Return: a list of #GSettings
565 	 *     schemas that are available.  The list must not be modified or
566 	 *     freed.
567 	 *
568 	 * Since: 2.26
569 	 */
570 	public static string[] listSchemas()
571 	{
572 		return Str.toStringArray(g_settings_list_schemas());
573 	}
574 
575 	/**
576 	 * Ensures that all pending operations for the given are complete for
577 	 * the default backend.
578 	 *
579 	 * Writes made to a #GSettings are handled asynchronously.  For this
580 	 * reason, it is very unlikely that the changes have it to disk by the
581 	 * time g_settings_set() returns.
582 	 *
583 	 * This call will block until all of the writes have made it to the
584 	 * backend.  Since the mainloop is not running, no change notifications
585 	 * will be dispatched during this call (but some may be queued by the
586 	 * time the call is done).
587 	 */
588 	public static void sync()
589 	{
590 		g_settings_sync();
591 	}
592 
593 	/**
594 	 * Removes an existing binding for @property on @object.
595 	 *
596 	 * Note that bindings are automatically removed when the
597 	 * object is finalized, so it is rarely necessary to call this
598 	 * function.
599 	 *
600 	 * Params:
601 	 *     object = the object
602 	 *     property = the property whose binding is removed
603 	 *
604 	 * Since: 2.26
605 	 */
606 	public static void unbind(ObjectG object, string property)
607 	{
608 		g_settings_unbind((object is null) ? null : object.getObjectGStruct(), Str.toStringz(property));
609 	}
610 
611 	/**
612 	 * Applies any changes that have been made to the settings.  This
613 	 * function does nothing unless @settings is in 'delay-apply' mode;
614 	 * see g_settings_delay().  In the normal case settings are always
615 	 * applied immediately.
616 	 */
617 	public void apply()
618 	{
619 		g_settings_apply(gSettings);
620 	}
621 
622 	/**
623 	 * Create a binding between the @key in the @settings object
624 	 * and the property @property of @object.
625 	 *
626 	 * The binding uses the default GIO mapping functions to map
627 	 * between the settings and property values. These functions
628 	 * handle booleans, numeric types and string types in a
629 	 * straightforward way. Use g_settings_bind_with_mapping() if
630 	 * you need a custom mapping, or map between types that are not
631 	 * supported by the default mapping functions.
632 	 *
633 	 * Unless the @flags include %G_SETTINGS_BIND_NO_SENSITIVITY, this
634 	 * function also establishes a binding between the writability of
635 	 * @key and the "sensitive" property of @object (if @object has
636 	 * a boolean property by that name). See g_settings_bind_writable()
637 	 * for more details about writable bindings.
638 	 *
639 	 * Note that the lifecycle of the binding is tied to the object,
640 	 * and that you can have only one binding per object property.
641 	 * If you bind the same property twice on the same object, the second
642 	 * binding overrides the first one.
643 	 *
644 	 * Params:
645 	 *     key = the key to bind
646 	 *     object = a #GObject
647 	 *     property = the name of the property to bind
648 	 *     flags = flags for the binding
649 	 *
650 	 * Since: 2.26
651 	 */
652 	public void bind(string key, ObjectG object, string property, GSettingsBindFlags flags)
653 	{
654 		g_settings_bind(gSettings, Str.toStringz(key), (object is null) ? null : object.getObjectGStruct(), Str.toStringz(property), flags);
655 	}
656 
657 	/**
658 	 * Create a binding between the @key in the @settings object
659 	 * and the property @property of @object.
660 	 *
661 	 * The binding uses the provided mapping functions to map between
662 	 * settings and property values.
663 	 *
664 	 * Note that the lifecycle of the binding is tied to the object,
665 	 * and that you can have only one binding per object property.
666 	 * If you bind the same property twice on the same object, the second
667 	 * binding overrides the first one.
668 	 *
669 	 * Params:
670 	 *     key = the key to bind
671 	 *     object = a #GObject
672 	 *     property = the name of the property to bind
673 	 *     flags = flags for the binding
674 	 *     getMapping = a function that gets called to convert values
675 	 *         from @settings to @object, or %NULL to use the default GIO mapping
676 	 *     setMapping = a function that gets called to convert values
677 	 *         from @object to @settings, or %NULL to use the default GIO mapping
678 	 *     userData = data that gets passed to @get_mapping and @set_mapping
679 	 *     destroy = #GDestroyNotify function for @user_data
680 	 *
681 	 * Since: 2.26
682 	 */
683 	public void bindWithMapping(string key, ObjectG object, string property, GSettingsBindFlags flags, GSettingsBindGetMapping getMapping, GSettingsBindSetMapping setMapping, void* userData, GDestroyNotify destroy)
684 	{
685 		g_settings_bind_with_mapping(gSettings, Str.toStringz(key), (object is null) ? null : object.getObjectGStruct(), Str.toStringz(property), flags, getMapping, setMapping, userData, destroy);
686 	}
687 
688 	/**
689 	 * Create a binding between the writability of @key in the
690 	 * @settings object and the property @property of @object.
691 	 * The property must be boolean; "sensitive" or "visible"
692 	 * properties of widgets are the most likely candidates.
693 	 *
694 	 * Writable bindings are always uni-directional; changes of the
695 	 * writability of the setting will be propagated to the object
696 	 * property, not the other way.
697 	 *
698 	 * When the @inverted argument is %TRUE, the binding inverts the
699 	 * value as it passes from the setting to the object, i.e. @property
700 	 * will be set to %TRUE if the key is not writable.
701 	 *
702 	 * Note that the lifecycle of the binding is tied to the object,
703 	 * and that you can have only one binding per object property.
704 	 * If you bind the same property twice on the same object, the second
705 	 * binding overrides the first one.
706 	 *
707 	 * Params:
708 	 *     key = the key to bind
709 	 *     object = a #GObject
710 	 *     property = the name of a boolean property to bind
711 	 *     inverted = whether to 'invert' the value
712 	 *
713 	 * Since: 2.26
714 	 */
715 	public void bindWritable(string key, ObjectG object, string property, bool inverted)
716 	{
717 		g_settings_bind_writable(gSettings, Str.toStringz(key), (object is null) ? null : object.getObjectGStruct(), Str.toStringz(property), inverted);
718 	}
719 
720 	/**
721 	 * Creates a #GAction corresponding to a given #GSettings key.
722 	 *
723 	 * The action has the same name as the key.
724 	 *
725 	 * The value of the key becomes the state of the action and the action
726 	 * is enabled when the key is writable.  Changing the state of the
727 	 * action results in the key being written to.  Changes to the value or
728 	 * writability of the key cause appropriate change notifications to be
729 	 * emitted for the action.
730 	 *
731 	 * For boolean-valued keys, action activations take no parameter and
732 	 * result in the toggling of the value.  For all other types,
733 	 * activations take the new value for the key (which must have the
734 	 * correct type).
735 	 *
736 	 * Params:
737 	 *     key = the name of a key in @settings
738 	 *
739 	 * Return: a new #GAction
740 	 *
741 	 * Since: 2.32
742 	 */
743 	public ActionIF createAction(string key)
744 	{
745 		auto p = g_settings_create_action(gSettings, Str.toStringz(key));
746 		
747 		if(p is null)
748 		{
749 			return null;
750 		}
751 		
752 		return ObjectG.getDObject!(Action, ActionIF)(cast(GAction*) p, true);
753 	}
754 
755 	/**
756 	 * Changes the #GSettings object into 'delay-apply' mode. In this
757 	 * mode, changes to @settings are not immediately propagated to the
758 	 * backend, but kept locally until g_settings_apply() is called.
759 	 *
760 	 * Since: 2.26
761 	 */
762 	public void delay()
763 	{
764 		g_settings_delay(gSettings);
765 	}
766 
767 	/**
768 	 * Gets the value that is stored at @key in @settings.
769 	 *
770 	 * A convenience variant of g_settings_get() for booleans.
771 	 *
772 	 * It is a programmer error to give a @key that isn't specified as
773 	 * having a boolean type in the schema for @settings.
774 	 *
775 	 * Params:
776 	 *     key = the key to get the value for
777 	 *
778 	 * Return: a boolean
779 	 *
780 	 * Since: 2.26
781 	 */
782 	public bool getBoolean(string key)
783 	{
784 		return g_settings_get_boolean(gSettings, Str.toStringz(key)) != 0;
785 	}
786 
787 	/**
788 	 * Creates a child settings object which has a base path of
789 	 * `base-path/@name`, where `base-path` is the base path of
790 	 * @settings.
791 	 *
792 	 * The schema for the child settings object must have been declared
793 	 * in the schema of @settings using a <child> element.
794 	 *
795 	 * Params:
796 	 *     name = the name of the child schema
797 	 *
798 	 * Return: a 'child' settings object
799 	 *
800 	 * Since: 2.26
801 	 */
802 	public Settings getChild(string name)
803 	{
804 		auto p = g_settings_get_child(gSettings, Str.toStringz(name));
805 		
806 		if(p is null)
807 		{
808 			return null;
809 		}
810 		
811 		return ObjectG.getDObject!(Settings)(cast(GSettings*) p, true);
812 	}
813 
814 	/**
815 	 * Gets the "default value" of a key.
816 	 *
817 	 * This is the value that would be read if g_settings_reset() were to be
818 	 * called on the key.
819 	 *
820 	 * Note that this may be a different value than returned by
821 	 * g_settings_schema_key_get_default_value() if the system administrator
822 	 * has provided a default value.
823 	 *
824 	 * Comparing the return values of g_settings_get_default_value() and
825 	 * g_settings_get_value() is not sufficient for determining if a value
826 	 * has been set because the user may have explicitly set the value to
827 	 * something that happens to be equal to the default.  The difference
828 	 * here is that if the default changes in the future, the user's key
829 	 * will still be set.
830 	 *
831 	 * This function may be useful for adding an indication to a UI of what
832 	 * the default value was before the user set it.
833 	 *
834 	 * It is a programmer error to give a @key that isn't contained in the
835 	 * schema for @settings.
836 	 *
837 	 * Params:
838 	 *     key = the key to get the default value for
839 	 *
840 	 * Return: the default value
841 	 *
842 	 * Since: 2.40
843 	 */
844 	public Variant getDefaultValue(string key)
845 	{
846 		auto p = g_settings_get_default_value(gSettings, Str.toStringz(key));
847 		
848 		if(p is null)
849 		{
850 			return null;
851 		}
852 		
853 		return new Variant(cast(GVariant*) p, true);
854 	}
855 
856 	/**
857 	 * Gets the value that is stored at @key in @settings.
858 	 *
859 	 * A convenience variant of g_settings_get() for doubles.
860 	 *
861 	 * It is a programmer error to give a @key that isn't specified as
862 	 * having a 'double' type in the schema for @settings.
863 	 *
864 	 * Params:
865 	 *     key = the key to get the value for
866 	 *
867 	 * Return: a double
868 	 *
869 	 * Since: 2.26
870 	 */
871 	public double getDouble(string key)
872 	{
873 		return g_settings_get_double(gSettings, Str.toStringz(key));
874 	}
875 
876 	/**
877 	 * Gets the value that is stored in @settings for @key and converts it
878 	 * to the enum value that it represents.
879 	 *
880 	 * In order to use this function the type of the value must be a string
881 	 * and it must be marked in the schema file as an enumerated type.
882 	 *
883 	 * It is a programmer error to give a @key that isn't contained in the
884 	 * schema for @settings or is not marked as an enumerated type.
885 	 *
886 	 * If the value stored in the configuration database is not a valid
887 	 * value for the enumerated type then this function will return the
888 	 * default value.
889 	 *
890 	 * Params:
891 	 *     key = the key to get the value for
892 	 *
893 	 * Return: the enum value
894 	 *
895 	 * Since: 2.26
896 	 */
897 	public int getEnum(string key)
898 	{
899 		return g_settings_get_enum(gSettings, Str.toStringz(key));
900 	}
901 
902 	/**
903 	 * Gets the value that is stored in @settings for @key and converts it
904 	 * to the flags value that it represents.
905 	 *
906 	 * In order to use this function the type of the value must be an array
907 	 * of strings and it must be marked in the schema file as an flags type.
908 	 *
909 	 * It is a programmer error to give a @key that isn't contained in the
910 	 * schema for @settings or is not marked as a flags type.
911 	 *
912 	 * If the value stored in the configuration database is not a valid
913 	 * value for the flags type then this function will return the default
914 	 * value.
915 	 *
916 	 * Params:
917 	 *     key = the key to get the value for
918 	 *
919 	 * Return: the flags value
920 	 *
921 	 * Since: 2.26
922 	 */
923 	public uint getFlags(string key)
924 	{
925 		return g_settings_get_flags(gSettings, Str.toStringz(key));
926 	}
927 
928 	/**
929 	 * Returns whether the #GSettings object has any unapplied
930 	 * changes.  This can only be the case if it is in 'delayed-apply' mode.
931 	 *
932 	 * Return: %TRUE if @settings has unapplied changes
933 	 *
934 	 * Since: 2.26
935 	 */
936 	public bool getHasUnapplied()
937 	{
938 		return g_settings_get_has_unapplied(gSettings) != 0;
939 	}
940 
941 	/**
942 	 * Gets the value that is stored at @key in @settings.
943 	 *
944 	 * A convenience variant of g_settings_get() for 32-bit integers.
945 	 *
946 	 * It is a programmer error to give a @key that isn't specified as
947 	 * having a int32 type in the schema for @settings.
948 	 *
949 	 * Params:
950 	 *     key = the key to get the value for
951 	 *
952 	 * Return: an integer
953 	 *
954 	 * Since: 2.26
955 	 */
956 	public int getInt(string key)
957 	{
958 		return g_settings_get_int(gSettings, Str.toStringz(key));
959 	}
960 
961 	/**
962 	 * Gets the value that is stored at @key in @settings, subject to
963 	 * application-level validation/mapping.
964 	 *
965 	 * You should use this function when the application needs to perform
966 	 * some processing on the value of the key (for example, parsing).  The
967 	 * @mapping function performs that processing.  If the function
968 	 * indicates that the processing was unsuccessful (due to a parse error,
969 	 * for example) then the mapping is tried again with another value.
970 	 *
971 	 * This allows a robust 'fall back to defaults' behaviour to be
972 	 * implemented somewhat automatically.
973 	 *
974 	 * The first value that is tried is the user's setting for the key.  If
975 	 * the mapping function fails to map this value, other values may be
976 	 * tried in an unspecified order (system or site defaults, translated
977 	 * schema default values, untranslated schema default values, etc).
978 	 *
979 	 * If the mapping function fails for all possible values, one additional
980 	 * attempt is made: the mapping function is called with a %NULL value.
981 	 * If the mapping function still indicates failure at this point then
982 	 * the application will be aborted.
983 	 *
984 	 * The result parameter for the @mapping function is pointed to a
985 	 * #gpointer which is initially set to %NULL.  The same pointer is given
986 	 * to each invocation of @mapping.  The final value of that #gpointer is
987 	 * what is returned by this function.  %NULL is valid; it is returned
988 	 * just as any other value would be.
989 	 *
990 	 * Params:
991 	 *     key = the key to get the value for
992 	 *     mapping = the function to map the value in the
993 	 *         settings database to the value used by the application
994 	 *     userData = user data for @mapping
995 	 *
996 	 * Return: the result, which may be %NULL
997 	 */
998 	public void* getMapped(string key, GSettingsGetMapping mapping, void* userData)
999 	{
1000 		return g_settings_get_mapped(gSettings, Str.toStringz(key), mapping, userData);
1001 	}
1002 
1003 	/**
1004 	 * Queries the range of a key.
1005 	 *
1006 	 * Deprecated: Use g_settings_schema_key_get_range() instead.
1007 	 *
1008 	 * Params:
1009 	 *     key = the key to query the range of
1010 	 *
1011 	 * Since: 2.28
1012 	 */
1013 	public Variant getRange(string key)
1014 	{
1015 		auto p = g_settings_get_range(gSettings, Str.toStringz(key));
1016 		
1017 		if(p is null)
1018 		{
1019 			return null;
1020 		}
1021 		
1022 		return new Variant(cast(GVariant*) p, true);
1023 	}
1024 
1025 	/**
1026 	 * Gets the value that is stored at @key in @settings.
1027 	 *
1028 	 * A convenience variant of g_settings_get() for strings.
1029 	 *
1030 	 * It is a programmer error to give a @key that isn't specified as
1031 	 * having a string type in the schema for @settings.
1032 	 *
1033 	 * Params:
1034 	 *     key = the key to get the value for
1035 	 *
1036 	 * Return: a newly-allocated string
1037 	 *
1038 	 * Since: 2.26
1039 	 */
1040 	public string getString(string key)
1041 	{
1042 		auto retStr = g_settings_get_string(gSettings, Str.toStringz(key));
1043 		
1044 		scope(exit) Str.freeString(retStr);
1045 		return Str.toString(retStr);
1046 	}
1047 
1048 	/**
1049 	 * A convenience variant of g_settings_get() for string arrays.
1050 	 *
1051 	 * It is a programmer error to give a @key that isn't specified as
1052 	 * having an array of strings type in the schema for @settings.
1053 	 *
1054 	 * Params:
1055 	 *     key = the key to get the value for
1056 	 *
1057 	 * Return: a
1058 	 *     newly-allocated, %NULL-terminated array of strings, the value that
1059 	 *     is stored at @key in @settings.
1060 	 *
1061 	 * Since: 2.26
1062 	 */
1063 	public string[] getStrv(string key)
1064 	{
1065 		auto retStr = g_settings_get_strv(gSettings, Str.toStringz(key));
1066 		
1067 		scope(exit) Str.freeStringArray(retStr);
1068 		return Str.toStringArray(retStr);
1069 	}
1070 
1071 	/**
1072 	 * Gets the value that is stored at @key in @settings.
1073 	 *
1074 	 * A convenience variant of g_settings_get() for 32-bit unsigned
1075 	 * integers.
1076 	 *
1077 	 * It is a programmer error to give a @key that isn't specified as
1078 	 * having a uint32 type in the schema for @settings.
1079 	 *
1080 	 * Params:
1081 	 *     key = the key to get the value for
1082 	 *
1083 	 * Return: an unsigned integer
1084 	 *
1085 	 * Since: 2.30
1086 	 */
1087 	public uint getUint(string key)
1088 	{
1089 		return g_settings_get_uint(gSettings, Str.toStringz(key));
1090 	}
1091 
1092 	/**
1093 	 * Checks the "user value" of a key, if there is one.
1094 	 *
1095 	 * The user value of a key is the last value that was set by the user.
1096 	 *
1097 	 * After calling g_settings_reset() this function should always return
1098 	 * %NULL (assuming something is not wrong with the system
1099 	 * configuration).
1100 	 *
1101 	 * It is possible that g_settings_get_value() will return a different
1102 	 * value than this function.  This can happen in the case that the user
1103 	 * set a value for a key that was subsequently locked down by the system
1104 	 * administrator -- this function will return the user's old value.
1105 	 *
1106 	 * This function may be useful for adding a "reset" option to a UI or
1107 	 * for providing indication that a particular value has been changed.
1108 	 *
1109 	 * It is a programmer error to give a @key that isn't contained in the
1110 	 * schema for @settings.
1111 	 *
1112 	 * Params:
1113 	 *     key = the key to get the user value for
1114 	 *
1115 	 * Return: the user's value, if set
1116 	 *
1117 	 * Since: 2.40
1118 	 */
1119 	public Variant getUserValue(string key)
1120 	{
1121 		auto p = g_settings_get_user_value(gSettings, Str.toStringz(key));
1122 		
1123 		if(p is null)
1124 		{
1125 			return null;
1126 		}
1127 		
1128 		return new Variant(cast(GVariant*) p, true);
1129 	}
1130 
1131 	/**
1132 	 * Gets the value that is stored in @settings for @key.
1133 	 *
1134 	 * It is a programmer error to give a @key that isn't contained in the
1135 	 * schema for @settings.
1136 	 *
1137 	 * Params:
1138 	 *     key = the key to get the value for
1139 	 *
1140 	 * Return: a new #GVariant
1141 	 *
1142 	 * Since: 2.26
1143 	 */
1144 	public Variant getValue(string key)
1145 	{
1146 		auto p = g_settings_get_value(gSettings, Str.toStringz(key));
1147 		
1148 		if(p is null)
1149 		{
1150 			return null;
1151 		}
1152 		
1153 		return new Variant(cast(GVariant*) p, true);
1154 	}
1155 
1156 	/**
1157 	 * Finds out if a key can be written or not
1158 	 *
1159 	 * Params:
1160 	 *     name = the name of a key
1161 	 *
1162 	 * Return: %TRUE if the key @name is writable
1163 	 *
1164 	 * Since: 2.26
1165 	 */
1166 	public bool isWritable(string name)
1167 	{
1168 		return g_settings_is_writable(gSettings, Str.toStringz(name)) != 0;
1169 	}
1170 
1171 	/**
1172 	 * Gets the list of children on @settings.
1173 	 *
1174 	 * The list is exactly the list of strings for which it is not an error
1175 	 * to call g_settings_get_child().
1176 	 *
1177 	 * For GSettings objects that are lists, this value can change at any
1178 	 * time and you should connect to the "children-changed" signal to watch
1179 	 * for those changes.  Note that there is a race condition here: you may
1180 	 * request a child after listing it only for it to have been destroyed
1181 	 * in the meantime.  For this reason, g_settings_get_child() may return
1182 	 * %NULL even for a child that was listed by this function.
1183 	 *
1184 	 * For GSettings objects that are not lists, you should probably not be
1185 	 * calling this function from "normal" code (since you should already
1186 	 * know what children are in your schema).  This function may still be
1187 	 * useful there for introspection reasons, however.
1188 	 *
1189 	 * You should free the return value with g_strfreev() when you are done
1190 	 * with it.
1191 	 *
1192 	 * Return: a list of the children on @settings
1193 	 */
1194 	public string[] listChildren()
1195 	{
1196 		auto retStr = g_settings_list_children(gSettings);
1197 		
1198 		scope(exit) Str.freeStringArray(retStr);
1199 		return Str.toStringArray(retStr);
1200 	}
1201 
1202 	/**
1203 	 * Introspects the list of keys on @settings.
1204 	 *
1205 	 * You should probably not be calling this function from "normal" code
1206 	 * (since you should already know what keys are in your schema).  This
1207 	 * function is intended for introspection reasons.
1208 	 *
1209 	 * You should free the return value with g_strfreev() when you are done
1210 	 * with it.
1211 	 *
1212 	 * Return: a list of the keys on @settings
1213 	 */
1214 	public string[] listKeys()
1215 	{
1216 		auto retStr = g_settings_list_keys(gSettings);
1217 		
1218 		scope(exit) Str.freeStringArray(retStr);
1219 		return Str.toStringArray(retStr);
1220 	}
1221 
1222 	/**
1223 	 * Checks if the given @value is of the correct type and within the
1224 	 * permitted range for @key.
1225 	 *
1226 	 * Deprecated: Use g_settings_schema_key_range_check() instead.
1227 	 *
1228 	 * Params:
1229 	 *     key = the key to check
1230 	 *     value = the value to check
1231 	 *
1232 	 * Return: %TRUE if @value is valid for @key
1233 	 *
1234 	 * Since: 2.28
1235 	 */
1236 	public bool rangeCheck(string key, Variant value)
1237 	{
1238 		return g_settings_range_check(gSettings, Str.toStringz(key), (value is null) ? null : value.getVariantStruct()) != 0;
1239 	}
1240 
1241 	/**
1242 	 * Resets @key to its default value.
1243 	 *
1244 	 * This call resets the key, as much as possible, to its default value.
1245 	 * That might the value specified in the schema or the one set by the
1246 	 * administrator.
1247 	 *
1248 	 * Params:
1249 	 *     key = the name of a key
1250 	 */
1251 	public void reset(string key)
1252 	{
1253 		g_settings_reset(gSettings, Str.toStringz(key));
1254 	}
1255 
1256 	/**
1257 	 * Reverts all non-applied changes to the settings.  This function
1258 	 * does nothing unless @settings is in 'delay-apply' mode; see
1259 	 * g_settings_delay().  In the normal case settings are always applied
1260 	 * immediately.
1261 	 *
1262 	 * Change notifications will be emitted for affected keys.
1263 	 */
1264 	public void revert()
1265 	{
1266 		g_settings_revert(gSettings);
1267 	}
1268 
1269 	/**
1270 	 * Sets @key in @settings to @value.
1271 	 *
1272 	 * A convenience variant of g_settings_set() for booleans.
1273 	 *
1274 	 * It is a programmer error to give a @key that isn't specified as
1275 	 * having a boolean type in the schema for @settings.
1276 	 *
1277 	 * Params:
1278 	 *     key = the name of the key to set
1279 	 *     value = the value to set it to
1280 	 *
1281 	 * Return: %TRUE if setting the key succeeded,
1282 	 *     %FALSE if the key was not writable
1283 	 *
1284 	 * Since: 2.26
1285 	 */
1286 	public bool setBoolean(string key, bool value)
1287 	{
1288 		return g_settings_set_boolean(gSettings, Str.toStringz(key), value) != 0;
1289 	}
1290 
1291 	/**
1292 	 * Sets @key in @settings to @value.
1293 	 *
1294 	 * A convenience variant of g_settings_set() for doubles.
1295 	 *
1296 	 * It is a programmer error to give a @key that isn't specified as
1297 	 * having a 'double' type in the schema for @settings.
1298 	 *
1299 	 * Params:
1300 	 *     key = the name of the key to set
1301 	 *     value = the value to set it to
1302 	 *
1303 	 * Return: %TRUE if setting the key succeeded,
1304 	 *     %FALSE if the key was not writable
1305 	 *
1306 	 * Since: 2.26
1307 	 */
1308 	public bool setDouble(string key, double value)
1309 	{
1310 		return g_settings_set_double(gSettings, Str.toStringz(key), value) != 0;
1311 	}
1312 
1313 	/**
1314 	 * Looks up the enumerated type nick for @value and writes it to @key,
1315 	 * within @settings.
1316 	 *
1317 	 * It is a programmer error to give a @key that isn't contained in the
1318 	 * schema for @settings or is not marked as an enumerated type, or for
1319 	 * @value not to be a valid value for the named type.
1320 	 *
1321 	 * After performing the write, accessing @key directly with
1322 	 * g_settings_get_string() will return the 'nick' associated with
1323 	 * @value.
1324 	 *
1325 	 * Params:
1326 	 *     key = a key, within @settings
1327 	 *     value = an enumerated value
1328 	 *
1329 	 * Return: %TRUE, if the set succeeds
1330 	 */
1331 	public bool setEnum(string key, int value)
1332 	{
1333 		return g_settings_set_enum(gSettings, Str.toStringz(key), value) != 0;
1334 	}
1335 
1336 	/**
1337 	 * Looks up the flags type nicks for the bits specified by @value, puts
1338 	 * them in an array of strings and writes the array to @key, within
1339 	 * @settings.
1340 	 *
1341 	 * It is a programmer error to give a @key that isn't contained in the
1342 	 * schema for @settings or is not marked as a flags type, or for @value
1343 	 * to contain any bits that are not value for the named type.
1344 	 *
1345 	 * After performing the write, accessing @key directly with
1346 	 * g_settings_get_strv() will return an array of 'nicks'; one for each
1347 	 * bit in @value.
1348 	 *
1349 	 * Params:
1350 	 *     key = a key, within @settings
1351 	 *     value = a flags value
1352 	 *
1353 	 * Return: %TRUE, if the set succeeds
1354 	 */
1355 	public bool setFlags(string key, uint value)
1356 	{
1357 		return g_settings_set_flags(gSettings, Str.toStringz(key), value) != 0;
1358 	}
1359 
1360 	/**
1361 	 * Sets @key in @settings to @value.
1362 	 *
1363 	 * A convenience variant of g_settings_set() for 32-bit integers.
1364 	 *
1365 	 * It is a programmer error to give a @key that isn't specified as
1366 	 * having a int32 type in the schema for @settings.
1367 	 *
1368 	 * Params:
1369 	 *     key = the name of the key to set
1370 	 *     value = the value to set it to
1371 	 *
1372 	 * Return: %TRUE if setting the key succeeded,
1373 	 *     %FALSE if the key was not writable
1374 	 *
1375 	 * Since: 2.26
1376 	 */
1377 	public bool setInt(string key, int value)
1378 	{
1379 		return g_settings_set_int(gSettings, Str.toStringz(key), value) != 0;
1380 	}
1381 
1382 	/**
1383 	 * Sets @key in @settings to @value.
1384 	 *
1385 	 * A convenience variant of g_settings_set() for strings.
1386 	 *
1387 	 * It is a programmer error to give a @key that isn't specified as
1388 	 * having a string type in the schema for @settings.
1389 	 *
1390 	 * Params:
1391 	 *     key = the name of the key to set
1392 	 *     value = the value to set it to
1393 	 *
1394 	 * Return: %TRUE if setting the key succeeded,
1395 	 *     %FALSE if the key was not writable
1396 	 *
1397 	 * Since: 2.26
1398 	 */
1399 	public bool setString(string key, string value)
1400 	{
1401 		return g_settings_set_string(gSettings, Str.toStringz(key), Str.toStringz(value)) != 0;
1402 	}
1403 
1404 	/**
1405 	 * Sets @key in @settings to @value.
1406 	 *
1407 	 * A convenience variant of g_settings_set() for string arrays.  If
1408 	 * @value is %NULL, then @key is set to be the empty array.
1409 	 *
1410 	 * It is a programmer error to give a @key that isn't specified as
1411 	 * having an array of strings type in the schema for @settings.
1412 	 *
1413 	 * Params:
1414 	 *     key = the name of the key to set
1415 	 *     value = the value to set it to, or %NULL
1416 	 *
1417 	 * Return: %TRUE if setting the key succeeded,
1418 	 *     %FALSE if the key was not writable
1419 	 *
1420 	 * Since: 2.26
1421 	 */
1422 	public bool setStrv(string key, string[] value)
1423 	{
1424 		return g_settings_set_strv(gSettings, Str.toStringz(key), Str.toStringzArray(value)) != 0;
1425 	}
1426 
1427 	/**
1428 	 * Sets @key in @settings to @value.
1429 	 *
1430 	 * A convenience variant of g_settings_set() for 32-bit unsigned
1431 	 * integers.
1432 	 *
1433 	 * It is a programmer error to give a @key that isn't specified as
1434 	 * having a uint32 type in the schema for @settings.
1435 	 *
1436 	 * Params:
1437 	 *     key = the name of the key to set
1438 	 *     value = the value to set it to
1439 	 *
1440 	 * Return: %TRUE if setting the key succeeded,
1441 	 *     %FALSE if the key was not writable
1442 	 *
1443 	 * Since: 2.30
1444 	 */
1445 	public bool setUint(string key, uint value)
1446 	{
1447 		return g_settings_set_uint(gSettings, Str.toStringz(key), value) != 0;
1448 	}
1449 
1450 	/**
1451 	 * Sets @key in @settings to @value.
1452 	 *
1453 	 * It is a programmer error to give a @key that isn't contained in the
1454 	 * schema for @settings or for @value to have the incorrect type, per
1455 	 * the schema.
1456 	 *
1457 	 * If @value is floating then this function consumes the reference.
1458 	 *
1459 	 * Params:
1460 	 *     key = the name of the key to set
1461 	 *     value = a #GVariant of the correct type
1462 	 *
1463 	 * Return: %TRUE if setting the key succeeded,
1464 	 *     %FALSE if the key was not writable
1465 	 *
1466 	 * Since: 2.26
1467 	 */
1468 	public bool setValue(string key, Variant value)
1469 	{
1470 		return g_settings_set_value(gSettings, Str.toStringz(key), (value is null) ? null : value.getVariantStruct()) != 0;
1471 	}
1472 
1473 	int[string] connectedSignals;
1474 
1475 	bool delegate(void*, int, Settings)[] onChangeListeners;
1476 	/**
1477 	 * The "change-event" signal is emitted once per change event that
1478 	 * affects this settings object.  You should connect to this signal
1479 	 * only if you are interested in viewing groups of changes before they
1480 	 * are split out into multiple emissions of the "changed" signal.
1481 	 * For most use cases it is more appropriate to use the "changed" signal.
1482 	 *
1483 	 * In the event that the change event applies to one or more specified
1484 	 * keys, @keys will be an array of #GQuark of length @n_keys.  In the
1485 	 * event that the change event applies to the #GSettings object as a
1486 	 * whole (ie: potentially every key has been changed) then @keys will
1487 	 * be %NULL and @n_keys will be 0.
1488 	 *
1489 	 * The default handler for this signal invokes the "changed" signal
1490 	 * for each affected key.  If any other connected handler returns
1491 	 * %TRUE then this default functionality will be suppressed.
1492 	 *
1493 	 * Params:
1494 	 *     keys = an array of #GQuarks for the changed keys, or %NULL
1495 	 *     nKeys = the length of the @keys array, or 0
1496 	 *
1497 	 * Return: %TRUE to stop other handlers from being invoked for the
1498 	 *     event. FALSE to propagate the event further.
1499 	 */
1500 	void addOnChange(bool delegate(void*, int, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1501 	{
1502 		if ( "change-event" !in connectedSignals )
1503 		{
1504 			Signals.connectData(
1505 				this,
1506 				"change-event",
1507 				cast(GCallback)&callBackChange,
1508 				cast(void*)this,
1509 				null,
1510 				connectFlags);
1511 			connectedSignals["change-event"] = 1;
1512 		}
1513 		onChangeListeners ~= dlg;
1514 	}
1515 	extern(C) static int callBackChange(GSettings* settingsStruct, void* keys, int nKeys, Settings _settings)
1516 	{
1517 		foreach ( bool delegate(void*, int, Settings) dlg; _settings.onChangeListeners )
1518 		{
1519 			if ( dlg(keys, nKeys, _settings) )
1520 			{
1521 				return 1;
1522 			}
1523 		}
1524 		
1525 		return 0;
1526 	}
1527 
1528 	void delegate(string, Settings)[] onChangedListeners;
1529 	/**
1530 	 * The "changed" signal is emitted when a key has potentially changed.
1531 	 * You should call one of the g_settings_get() calls to check the new
1532 	 * value.
1533 	 *
1534 	 * This signal supports detailed connections.  You can connect to the
1535 	 * detailed signal "changed::x" in order to only receive callbacks
1536 	 * when key "x" changes.
1537 	 *
1538 	 * Params:
1539 	 *     key = the name of the key that changed
1540 	 */
1541 	void addOnChanged(void delegate(string, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1542 	{
1543 		if ( "changed" !in connectedSignals )
1544 		{
1545 			Signals.connectData(
1546 				this,
1547 				"changed",
1548 				cast(GCallback)&callBackChanged,
1549 				cast(void*)this,
1550 				null,
1551 				connectFlags);
1552 			connectedSignals["changed"] = 1;
1553 		}
1554 		onChangedListeners ~= dlg;
1555 	}
1556 	extern(C) static void callBackChanged(GSettings* settingsStruct, char* key, Settings _settings)
1557 	{
1558 		foreach ( void delegate(string, Settings) dlg; _settings.onChangedListeners )
1559 		{
1560 			dlg(Str.toString(key), _settings);
1561 		}
1562 	}
1563 
1564 	bool delegate(uint, Settings)[] onWritableChangeListeners;
1565 	/**
1566 	 * The "writable-change-event" signal is emitted once per writability
1567 	 * change event that affects this settings object.  You should connect
1568 	 * to this signal if you are interested in viewing groups of changes
1569 	 * before they are split out into multiple emissions of the
1570 	 * "writable-changed" signal.  For most use cases it is more
1571 	 * appropriate to use the "writable-changed" signal.
1572 	 *
1573 	 * In the event that the writability change applies only to a single
1574 	 * key, @key will be set to the #GQuark for that key.  In the event
1575 	 * that the writability change affects the entire settings object,
1576 	 * @key will be 0.
1577 	 *
1578 	 * The default handler for this signal invokes the "writable-changed"
1579 	 * and "changed" signals for each affected key.  This is done because
1580 	 * changes in writability might also imply changes in value (if for
1581 	 * example, a new mandatory setting is introduced).  If any other
1582 	 * connected handler returns %TRUE then this default functionality
1583 	 * will be suppressed.
1584 	 *
1585 	 * Params:
1586 	 *     key = the quark of the key, or 0
1587 	 *
1588 	 * Return: %TRUE to stop other handlers from being invoked for the
1589 	 *     event. FALSE to propagate the event further.
1590 	 */
1591 	void addOnWritableChange(bool delegate(uint, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1592 	{
1593 		if ( "writable-change-event" !in connectedSignals )
1594 		{
1595 			Signals.connectData(
1596 				this,
1597 				"writable-change-event",
1598 				cast(GCallback)&callBackWritableChange,
1599 				cast(void*)this,
1600 				null,
1601 				connectFlags);
1602 			connectedSignals["writable-change-event"] = 1;
1603 		}
1604 		onWritableChangeListeners ~= dlg;
1605 	}
1606 	extern(C) static int callBackWritableChange(GSettings* settingsStruct, uint key, Settings _settings)
1607 	{
1608 		foreach ( bool delegate(uint, Settings) dlg; _settings.onWritableChangeListeners )
1609 		{
1610 			if ( dlg(key, _settings) )
1611 			{
1612 				return 1;
1613 			}
1614 		}
1615 		
1616 		return 0;
1617 	}
1618 
1619 	void delegate(string, Settings)[] onWritableChangedListeners;
1620 	/**
1621 	 * The "writable-changed" signal is emitted when the writability of a
1622 	 * key has potentially changed.  You should call
1623 	 * g_settings_is_writable() in order to determine the new status.
1624 	 *
1625 	 * This signal supports detailed connections.  You can connect to the
1626 	 * detailed signal "writable-changed::x" in order to only receive
1627 	 * callbacks when the writability of "x" changes.
1628 	 *
1629 	 * Params:
1630 	 *     key = the key
1631 	 */
1632 	void addOnWritableChanged(void delegate(string, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1633 	{
1634 		if ( "writable-changed" !in connectedSignals )
1635 		{
1636 			Signals.connectData(
1637 				this,
1638 				"writable-changed",
1639 				cast(GCallback)&callBackWritableChanged,
1640 				cast(void*)this,
1641 				null,
1642 				connectFlags);
1643 			connectedSignals["writable-changed"] = 1;
1644 		}
1645 		onWritableChangedListeners ~= dlg;
1646 	}
1647 	extern(C) static void callBackWritableChanged(GSettings* settingsStruct, char* key, Settings _settings)
1648 	{
1649 		foreach ( void delegate(string, Settings) dlg; _settings.onWritableChangedListeners )
1650 		{
1651 			dlg(Str.toString(key), _settings);
1652 		}
1653 	}
1654 }