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