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  * Conversion parameters:
26  * inFile  = GSettings.html
27  * outPack = gio
28  * outFile = Settings
29  * strct   = GSettings
30  * realStrct=
31  * ctorStrct=
32  * clss    = Settings
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_settings_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.Variant
48  * 	- glib.VariantType
49  * 	- gobject.Value
50  * 	- gio.SettingsBackend
51  * structWrap:
52  * 	- GSettings* -> Settings
53  * 	- GSettingsBackend* -> SettingsBackend
54  * 	- GValue* -> Value
55  * 	- GVariant* -> Variant
56  * 	- GVariantType* -> VariantType
57  * module aliases:
58  * local aliases:
59  * overrides:
60  */
61 
62 module gio.Settings;
63 
64 public  import gtkc.giotypes;
65 
66 private import gtkc.gio;
67 private import glib.ConstructionException;
68 private import gobject.ObjectG;
69 
70 private import gobject.Signals;
71 public  import gtkc.gdktypes;
72 
73 private import glib.Str;
74 private import glib.Variant;
75 private import glib.VariantType;
76 private import gobject.Value;
77 private import gio.SettingsBackend;
78 
79 
80 
81 private import gobject.ObjectG;
82 
83 /**
84  * Description
85  * The GSettings class provides a convenient API for storing and retrieving
86  * application settings.
87  * Reads and writes can be considered to be non-blocking. Reading
88  * settings with GSettings is typically extremely fast: on
89  * approximately the same order of magnitude (but slower than) a
90  * GHashTable lookup. Writing settings is also extremely fast in terms
91  * of time to return to your application, but can be extremely expensive
92  * for other threads and other processes. Many settings backends
93  * (including dconf) have lazy initialisation which means in the common
94  * case of the user using their computer without modifying any settings
95  * a lot of work can be avoided. For dconf, the D-Bus service doesn't
96  * even need to be started in this case. For this reason, you should
97  * only ever modify GSettings keys in response to explicit user action.
98  * Particular care should be paid to ensure that modifications are not
99  * made during startup -- for example, when settings the initial value
100  * of preferences widgets. The built-in g_settings_bind() functionality
101  * is careful not to write settings in response to notify signals as a
102  * result of modifications that it makes to widgets.
103  * When creating a GSettings instance, you have to specify a schema
104  * that describes the keys in your settings and their types and default
105  * values, as well as some other information.
106  * Normally, a schema has as fixed path that determines where the settings
107  * are stored in the conceptual global tree of settings. However, schemas
108  * can also be 'relocatable', i.e. not equipped with a fixed path. This is
109  * useful e.g. when the schema describes an 'account', and you want to be
110  * able to store a arbitrary number of accounts.
111  * Unlike other configuration systems (like GConf), GSettings does not
112  * restrict keys to basic types like strings and numbers. GSettings stores
113  * values as GVariant, and allows any GVariantType for keys. Key names
114  * are restricted to lowercase characters, numbers and '-'. Furthermore,
115  * the names must begin with a lowercase character, must not end
116  * with a '-', and must not contain consecutive dashes. Key names can
117  * be up to 32 characters long.
118  * Similar to GConf, the default values in GSettings schemas can be
119  * localized, but the localized values are stored in gettext catalogs
120  * and looked up with the domain that is specified in the
121  * gettext-domain attribute of the
122  * <schemalist> or <schema>
123  * elements and the category that is specified in the l10n attribute of the
124  * <key> element.
125  * GSettings uses schemas in a compact binary form that is created
126  * by the glib-compile-schemas
127  * utility. The input is a schema description in an XML format that can be
128  * described by the following DTD:
129  * $(DDOC_COMMENT example)
130  * glib-compile-schemas expects schema files to have the extension .gschema.xml
131  * At runtime, schemas are identified by their id (as specified
132  * in the id attribute of the
133  * <schema> element). The
134  * convention for schema ids is to use a dotted name, similar in
135  * style to a D-Bus bus name, e.g. "org.gnome.SessionManager". In particular,
136  * if the settings are for a specific service that owns a D-Bus bus name,
137  * the D-Bus bus name and schema id should match. For schemas which deal
138  * with settings not associated with one named application, the id should
139  * not use StudlyCaps, e.g. "org.gnome.font-rendering".
140  * In addition to GVariant types, keys can have types that have enumerated
141  * types. These can be described by a <choice>,
142  * <enum> or <flags> element, see
143  *  Example 12, “Ranges, choices and enumerated types”. The underlying type of
144  * such a key is string, but you can use g_settings_get_enum(),
145  * g_settings_set_enum(), g_settings_get_flags(), g_settings_set_flags()
146  * access the numeric values corresponding to the string value of enum
147  * and flags keys.
148  * $(DDOC_COMMENT example)
149  * $(DDOC_COMMENT example)
150  * Vendor overrides
151  *  Default values are defined in the schemas that get installed by
152  *  an application. Sometimes, it is necessary for a vendor or distributor
153  *  to adjust these defaults. Since patching the XML source for the schema
154  *  is inconvenient and error-prone,
155  *  glib-compile-schemas reads
156  *  so-called 'vendor override' files. These are keyfiles in the same
157  *  directory as the XML schema sources which can override default values.
158  *  The schema id serves as the group name in the key file, and the values
159  *  are expected in serialized GVariant form, as in the following example:
160  * $(DDOC_COMMENT example)
161  *  glib-compile-schemas expects schema files to have the extension
162  *  .gschema.override
163  * Binding
164  *  A very convenient feature of GSettings lets you bind GObject properties
165  *  directly to settings, using g_settings_bind(). Once a GObject property
166  *  has been bound to a setting, changes on either side are automatically
167  *  propagated to the other side. GSettings handles details like
168  *  mapping between GObject and GVariant types, and preventing infinite
169  *  cycles.
170  *  This makes it very easy to hook up a preferences dialog to the
171  *  underlying settings. To make this even more convenient, GSettings
172  *  looks for a boolean property with the name "sensitivity" and
173  *  automatically binds it to the writability of the bound setting.
174  *  If this 'magic' gets in the way, it can be suppressed with the
175  *  G_SETTINGS_BIND_NO_SENSITIVITY flag.
176  */
177 public class Settings : ObjectG
178 {
179 	
180 	/** the main Gtk struct */
181 	protected GSettings* gSettings;
182 	
183 	
184 	public GSettings* getSettingsStruct()
185 	{
186 		return gSettings;
187 	}
188 	
189 	
190 	/** the main Gtk struct as a void* */
191 	protected override void* getStruct()
192 	{
193 		return cast(void*)gSettings;
194 	}
195 	
196 	/**
197 	 * Sets our main struct and passes it to the parent class
198 	 */
199 	public this (GSettings* gSettings)
200 	{
201 		super(cast(GObject*)gSettings);
202 		this.gSettings = gSettings;
203 	}
204 	
205 	protected override void setStruct(GObject* obj)
206 	{
207 		super.setStruct(obj);
208 		gSettings = cast(GSettings*)obj;
209 	}
210 	
211 	/**
212 	 */
213 	int[string] connectedSignals;
214 	
215 	bool delegate(void*, gint, Settings)[] onChangeListeners;
216 	/**
217 	 * The "change-event" signal is emitted once per change event that
218 	 * affects this settings object. You should connect to this signal
219 	 * only if you are interested in viewing groups of changes before they
220 	 * are split out into multiple emissions of the "changed" signal.
221 	 * For most use cases it is more appropriate to use the "changed" signal.
222 	 * In the event that the change event applies to one or more specified
223 	 * keys, keys will be an array of GQuark of length n_keys. In the
224 	 * event that the change event applies to the GSettings object as a
225 	 * whole (ie: potentially every key has been changed) then keys will
226 	 * be NULL and n_keys will be 0.
227 	 * The default handler for this signal invokes the "changed" signal
228 	 * for each affected key. If any other connected handler returns
229 	 * TRUE then this default functionality will be supressed.
230 	 * TRUE to stop other handlers from being invoked for the
231 	 * event. FALSE to propagate the event further.
232 	 */
233 	void addOnChange(bool delegate(void*, gint, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
234 	{
235 		if ( !("change-event" in connectedSignals) )
236 		{
237 			Signals.connectData(
238 			getStruct(),
239 			"change-event",
240 			cast(GCallback)&callBackChange,
241 			cast(void*)this,
242 			null,
243 			connectFlags);
244 			connectedSignals["change-event"] = 1;
245 		}
246 		onChangeListeners ~= dlg;
247 	}
248 	extern(C) static gboolean callBackChange(GSettings* settingsStruct, void* keys, gint nKeys, Settings _settings)
249 	{
250 		foreach ( bool delegate(void*, gint, Settings) dlg ; _settings.onChangeListeners )
251 		{
252 			if ( dlg(keys, nKeys, _settings) )
253 			{
254 				return 1;
255 			}
256 		}
257 		
258 		return 0;
259 	}
260 	
261 	void delegate(string, Settings)[] onChangedListeners;
262 	/**
263 	 * The "changed" signal is emitted when a key has potentially changed.
264 	 * You should call one of the g_settings_get() calls to check the new
265 	 * value.
266 	 * This signal supports detailed connections. You can connect to the
267 	 * detailed signal "changed::x" in order to only receive callbacks
268 	 * when key "x" changes.
269 	 */
270 	void addOnChanged(void delegate(string, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
271 	{
272 		if ( !("changed" in connectedSignals) )
273 		{
274 			Signals.connectData(
275 			getStruct(),
276 			"changed",
277 			cast(GCallback)&callBackChanged,
278 			cast(void*)this,
279 			null,
280 			connectFlags);
281 			connectedSignals["changed"] = 1;
282 		}
283 		onChangedListeners ~= dlg;
284 	}
285 	extern(C) static void callBackChanged(GSettings* settingsStruct, gchar* key, Settings _settings)
286 	{
287 		foreach ( void delegate(string, Settings) dlg ; _settings.onChangedListeners )
288 		{
289 			dlg(Str.toString(key), _settings);
290 		}
291 	}
292 	
293 	bool delegate(guint, Settings)[] onWritableChangeListeners;
294 	/**
295 	 * The "writable-change-event" signal is emitted once per writability
296 	 * change event that affects this settings object. You should connect
297 	 * to this signal if you are interested in viewing groups of changes
298 	 * before they are split out into multiple emissions of the
299 	 * "writable-changed" signal. For most use cases it is more
300 	 * appropriate to use the "writable-changed" signal.
301 	 * In the event that the writability change applies only to a single
302 	 * key, key will be set to the GQuark for that key. In the event
303 	 * that the writability change affects the entire settings object,
304 	 * key will be 0.
305 	 * The default handler for this signal invokes the "writable-changed"
306 	 * and "changed" signals for each affected key. This is done because
307 	 * changes in writability might also imply changes in value (if for
308 	 * example, a new mandatory setting is introduced). If any other
309 	 * connected handler returns TRUE then this default functionality
310 	 * will be supressed.
311 	 * TRUE to stop other handlers from being invoked for the
312 	 * event. FALSE to propagate the event further.
313 	 */
314 	void addOnWritableChange(bool delegate(guint, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
315 	{
316 		if ( !("writable-change-event" in connectedSignals) )
317 		{
318 			Signals.connectData(
319 			getStruct(),
320 			"writable-change-event",
321 			cast(GCallback)&callBackWritableChange,
322 			cast(void*)this,
323 			null,
324 			connectFlags);
325 			connectedSignals["writable-change-event"] = 1;
326 		}
327 		onWritableChangeListeners ~= dlg;
328 	}
329 	extern(C) static gboolean callBackWritableChange(GSettings* settingsStruct, guint key, Settings _settings)
330 	{
331 		foreach ( bool delegate(guint, Settings) dlg ; _settings.onWritableChangeListeners )
332 		{
333 			if ( dlg(key, _settings) )
334 			{
335 				return 1;
336 			}
337 		}
338 		
339 		return 0;
340 	}
341 	
342 	void delegate(string, Settings)[] onWritableChangedListeners;
343 	/**
344 	 * The "writable-changed" signal is emitted when the writability of a
345 	 * key has potentially changed. You should call
346 	 * g_settings_is_writable() in order to determine the new status.
347 	 * This signal supports detailed connections. You can connect to the
348 	 * detailed signal "writable-changed::x" in order to only receive
349 	 * callbacks when the writability of "x" changes.
350 	 */
351 	void addOnWritableChanged(void delegate(string, Settings) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
352 	{
353 		if ( !("writable-changed" in connectedSignals) )
354 		{
355 			Signals.connectData(
356 			getStruct(),
357 			"writable-changed",
358 			cast(GCallback)&callBackWritableChanged,
359 			cast(void*)this,
360 			null,
361 			connectFlags);
362 			connectedSignals["writable-changed"] = 1;
363 		}
364 		onWritableChangedListeners ~= dlg;
365 	}
366 	extern(C) static void callBackWritableChanged(GSettings* settingsStruct, gchar* key, Settings _settings)
367 	{
368 		foreach ( void delegate(string, Settings) dlg ; _settings.onWritableChangedListeners )
369 		{
370 			dlg(Str.toString(key), _settings);
371 		}
372 	}
373 	
374 	
375 	/**
376 	 * Creates a new GSettings object with a given schema.
377 	 * Signals on the newly created GSettings object will be dispatched
378 	 * via the thread-default GMainContext in effect at the time of the
379 	 * call to g_settings_new(). The new GSettings will hold a reference
380 	 * on the context. See g_main_context_push_thread_default().
381 	 * Since 2.26
382 	 * Params:
383 	 * schema = the name of the schema
384 	 * Throws: ConstructionException GTK+ fails to create the object.
385 	 */
386 	public this (string schema)
387 	{
388 		// GSettings * g_settings_new (const gchar *schema);
389 		auto p = g_settings_new(Str.toStringz(schema));
390 		if(p is null)
391 		{
392 			throw new ConstructionException("null returned by g_settings_new(Str.toStringz(schema))");
393 		}
394 		this(cast(GSettings*) p);
395 	}
396 	
397 	/**
398 	 * Creates a new GSettings object with a given schema and path.
399 	 * You only need to do this if you want to directly create a settings
400 	 * object with a schema that doesn't have a specified path of its own.
401 	 * That's quite rare.
402 	 * It is a programmer error to call this function for a schema that
403 	 * has an explicitly specified path.
404 	 * Since 2.26
405 	 * Params:
406 	 * schema = the name of the schema
407 	 * path = the path to use
408 	 * Throws: ConstructionException GTK+ fails to create the object.
409 	 */
410 	public this (string schema, string path)
411 	{
412 		// GSettings * g_settings_new_with_path (const gchar *schema,  const gchar *path);
413 		auto p = g_settings_new_with_path(Str.toStringz(schema), Str.toStringz(path));
414 		if(p is null)
415 		{
416 			throw new ConstructionException("null returned by g_settings_new_with_path(Str.toStringz(schema), Str.toStringz(path))");
417 		}
418 		this(cast(GSettings*) p);
419 	}
420 	
421 	/**
422 	 * Creates a new GSettings object with a given schema and backend.
423 	 * Creating settings objects with an different backend allows accessing settings
424 	 * from a database other than the usual one. For example, it may make
425 	 * sense to pass a backend corresponding to the "defaults" settings database on
426 	 * the system to get a settings object that modifies the system default
427 	 * settings instead of the settings for this user.
428 	 * Since 2.26
429 	 * Params:
430 	 * schema = the name of the schema
431 	 * backend = the GSettingsBackend to use
432 	 * Throws: ConstructionException GTK+ fails to create the object.
433 	 */
434 	public this (string schema, SettingsBackend backend)
435 	{
436 		// GSettings * g_settings_new_with_backend (const gchar *schema,  GSettingsBackend *backend);
437 		auto p = g_settings_new_with_backend(Str.toStringz(schema), (backend is null) ? null : backend.getSettingsBackendStruct());
438 		if(p is null)
439 		{
440 			throw new ConstructionException("null returned by g_settings_new_with_backend(Str.toStringz(schema), (backend is null) ? null : backend.getSettingsBackendStruct())");
441 		}
442 		this(cast(GSettings*) p);
443 	}
444 	
445 	/**
446 	 * Creates a new GSettings object with a given schema, backend and
447 	 * path.
448 	 * This is a mix of g_settings_new_with_backend() and
449 	 * g_settings_new_with_path().
450 	 * Since 2.26
451 	 * Params:
452 	 * schema = the name of the schema
453 	 * backend = the GSettingsBackend to use
454 	 * path = the path to use
455 	 * Throws: ConstructionException GTK+ fails to create the object.
456 	 */
457 	public this (string schema, SettingsBackend backend, string path)
458 	{
459 		// GSettings * g_settings_new_with_backend_and_path  (const gchar *schema,  GSettingsBackend *backend,  const gchar *path);
460 		auto p = g_settings_new_with_backend_and_path(Str.toStringz(schema), (backend is null) ? null : backend.getSettingsBackendStruct(), Str.toStringz(path));
461 		if(p is null)
462 		{
463 			throw new ConstructionException("null returned by g_settings_new_with_backend_and_path(Str.toStringz(schema), (backend is null) ? null : backend.getSettingsBackendStruct(), Str.toStringz(path))");
464 		}
465 		this(cast(GSettings*) p);
466 	}
467 	
468 	/**
469 	 * Ensures that all pending operations for the given are complete for
470 	 * the default backend.
471 	 * Writes made to a GSettings are handled asynchronously. For this
472 	 * reason, it is very unlikely that the changes have it to disk by the
473 	 * time g_settings_set() returns.
474 	 * This call will block until all of the writes have made it to the
475 	 * backend. Since the mainloop is not running, no change notifications
476 	 * will be dispatched during this call (but some may be queued by the
477 	 * time the call is done).
478 	 */
479 	public static void sync()
480 	{
481 		// void g_settings_sync (void);
482 		g_settings_sync();
483 	}
484 	
485 	/**
486 	 * Gets the value that is stored in settings for key.
487 	 * It is a programmer error to give a key that isn't contained in the
488 	 * schema for settings.
489 	 * Since 2.26
490 	 * Params:
491 	 * key = the key to get the value for
492 	 * Returns: a new GVariant
493 	 */
494 	public Variant getValue(string key)
495 	{
496 		// GVariant * g_settings_get_value (GSettings *settings,  const gchar *key);
497 		auto p = g_settings_get_value(gSettings, Str.toStringz(key));
498 		
499 		if(p is null)
500 		{
501 			return null;
502 		}
503 		
504 		return ObjectG.getDObject!(Variant)(cast(GVariant*) p);
505 	}
506 	
507 	/**
508 	 * Sets key in settings to value.
509 	 * It is a programmer error to give a key that isn't contained in the
510 	 * schema for settings or for value to have the incorrect type, per
511 	 * the schema.
512 	 * If value is floating then this function consumes the reference.
513 	 * Since 2.26
514 	 * Params:
515 	 * key = the name of the key to set
516 	 * value = a GVariant of the correct type
517 	 * Returns: TRUE if setting the key succeeded, FALSE if the key was not writable
518 	 */
519 	public int setValue(string key, Variant value)
520 	{
521 		// gboolean g_settings_set_value (GSettings *settings,  const gchar *key,  GVariant *value);
522 		return g_settings_set_value(gSettings, Str.toStringz(key), (value is null) ? null : value.getVariantStruct());
523 	}
524 	
525 	/**
526 	 * Finds out if a key can be written or not
527 	 * Since 2.26
528 	 * Params:
529 	 * name = the name of a key
530 	 * Returns: TRUE if the key name is writable
531 	 */
532 	public int isWritable(string name)
533 	{
534 		// gboolean g_settings_is_writable (GSettings *settings,  const gchar *name);
535 		return g_settings_is_writable(gSettings, Str.toStringz(name));
536 	}
537 	
538 	/**
539 	 * Changes the GSettings object into 'delay-apply' mode. In this
540 	 * mode, changes to settings are not immediately propagated to the
541 	 * backend, but kept locally until g_settings_apply() is called.
542 	 * Since 2.26
543 	 */
544 	public void delay()
545 	{
546 		// void g_settings_delay (GSettings *settings);
547 		g_settings_delay(gSettings);
548 	}
549 	
550 	/**
551 	 * Applies any changes that have been made to the settings. This
552 	 * function does nothing unless settings is in 'delay-apply' mode;
553 	 * see g_settings_delay(). In the normal case settings are always
554 	 * applied immediately.
555 	 */
556 	public void apply()
557 	{
558 		// void g_settings_apply (GSettings *settings);
559 		g_settings_apply(gSettings);
560 	}
561 	
562 	/**
563 	 * Reverts all non-applied changes to the settings. This function
564 	 * does nothing unless settings is in 'delay-apply' mode; see
565 	 * g_settings_delay(). In the normal case settings are always applied
566 	 * immediately.
567 	 * Change notifications will be emitted for affected keys.
568 	 */
569 	public void revert()
570 	{
571 		// void g_settings_revert (GSettings *settings);
572 		g_settings_revert(gSettings);
573 	}
574 	
575 	/**
576 	 * Returns whether the GSettings object has any unapplied
577 	 * changes. This can only be the case if it is in 'delayed-apply' mode.
578 	 * Since 2.26
579 	 * Returns: TRUE if settings has unapplied changes
580 	 */
581 	public int getHasUnapplied()
582 	{
583 		// gboolean g_settings_get_has_unapplied (GSettings *settings);
584 		return g_settings_get_has_unapplied(gSettings);
585 	}
586 	
587 	/**
588 	 * Creates a 'child' settings object which has a base path of
589 	 * base-path/name, where
590 	 * base-path is the base path of settings.
591 	 * The schema for the child settings object must have been declared
592 	 * in the schema of settings using a <child> element.
593 	 * Since 2.26
594 	 * Params:
595 	 * name = the name of the 'child' schema
596 	 * Returns: a 'child' settings object. [transfer full]
597 	 */
598 	public Settings getChild(string name)
599 	{
600 		// GSettings * g_settings_get_child (GSettings *settings,  const gchar *name);
601 		auto p = g_settings_get_child(gSettings, Str.toStringz(name));
602 		
603 		if(p is null)
604 		{
605 			return null;
606 		}
607 		
608 		return ObjectG.getDObject!(Settings)(cast(GSettings*) p);
609 	}
610 	
611 	/**
612 	 * Resets key to its default value.
613 	 * This call resets the key, as much as possible, to its default value.
614 	 * That might the value specified in the schema or the one set by the
615 	 * administrator.
616 	 * Params:
617 	 * key = the name of a key
618 	 */
619 	public void reset(string key)
620 	{
621 		// void g_settings_reset (GSettings *settings,  const gchar *key);
622 		g_settings_reset(gSettings, Str.toStringz(key));
623 	}
624 	
625 	/**
626 	 * Gets a list of the GSettings schemas installed on the system. The
627 	 * returned list is exactly the list of schemas for which you may call
628 	 * g_settings_new() without adverse effects.
629 	 * This function does not list the schemas that do not provide their own
630 	 * paths (ie: schemas for which you must use
631 	 * g_settings_new_with_path()). See
632 	 * g_settings_list_relocatable_schemas() for that.
633 	 * Since 2.26
634 	 * Returns: a list of GSettings schemas that are available. The list must not be modified or freed. [element-type utf8][transfer none]
635 	 */
636 	public static string[] listSchemas()
637 	{
638 		// const gchar * const * g_settings_list_schemas (void);
639 		return Str.toStringArray(g_settings_list_schemas());
640 	}
641 	
642 	/**
643 	 * Gets a list of the relocatable GSettings schemas installed on the
644 	 * system. These are schemas that do not provide their own path. It is
645 	 * usual to instantiate these schemas directly, but if you want to you
646 	 * can use g_settings_new_with_path() to specify the path.
647 	 * The output of this function, tTaken together with the output of
648 	 * g_settings_list_schemas() represents the complete list of all
649 	 * installed schemas.
650 	 * Since 2.28
651 	 * Returns: a list of relocatable GSettings schemas that are available. The list must not be modified or freed. [element-type utf8][transfer none]
652 	 */
653 	public static string[] listRelocatableSchemas()
654 	{
655 		// const gchar * const * g_settings_list_relocatable_schemas  (void);
656 		return Str.toStringArray(g_settings_list_relocatable_schemas());
657 	}
658 	
659 	/**
660 	 * Introspects the list of keys on settings.
661 	 * You should probably not be calling this function from "normal" code
662 	 * (since you should already know what keys are in your schema). This
663 	 * function is intended for introspection reasons.
664 	 * You should free the return value with g_strfreev() when you are done
665 	 * with it.
666 	 * Returns: a list of the keys on settings. [transfer full][element-type utf8]
667 	 */
668 	public string[] listKeys()
669 	{
670 		// gchar ** g_settings_list_keys (GSettings *settings);
671 		return Str.toStringArray(g_settings_list_keys(gSettings));
672 	}
673 	
674 	/**
675 	 * Gets the list of children on settings.
676 	 * The list is exactly the list of strings for which it is not an error
677 	 * to call g_settings_get_child().
678 	 * For GSettings objects that are lists, this value can change at any
679 	 * time and you should connect to the "children-changed" signal to watch
680 	 * for those changes. Note that there is a race condition here: you may
681 	 * request a child after listing it only for it to have been destroyed
682 	 * in the meantime. For this reason, g_settings_get_child() may return
683 	 * NULL even for a child that was listed by this function.
684 	 * For GSettings objects that are not lists, you should probably not be
685 	 * calling this function from "normal" code (since you should already
686 	 * know what children are in your schema). This function may still be
687 	 * useful there for introspection reasons, however.
688 	 * You should free the return value with g_strfreev() when you are done
689 	 * with it.
690 	 * Returns: a list of the children on settings. [transfer full][element-type utf8]
691 	 */
692 	public string[] listChildren()
693 	{
694 		// gchar ** g_settings_list_children (GSettings *settings);
695 		return Str.toStringArray(g_settings_list_children(gSettings));
696 	}
697 	
698 	/**
699 	 * Queries the range of a key.
700 	 * This function will return a GVariant that fully describes the range
701 	 * of values that are valid for key.
702 	 * The type of GVariant returned is (sv). The
703 	 * string describes the type of range restriction in effect. The type
704 	 * and meaning of the value contained in the variant depends on the
705 	 * string.
706 	 * If the string is 'type' then the variant contains
707 	 * an empty array. The element type of that empty array is the expected
708 	 * type of value and all values of that type are valid.
709 	 * If the string is 'enum' then the variant contains
710 	 * an array enumerating the possible values. Each item in the array is
711 	 * a possible valid value and no other values are valid.
712 	 * If the string is 'flags' then the variant contains
713 	 * an array. Each item in the array is a value that may appear zero or
714 	 * one times in an array to be used as the value for this key. For
715 	 * example, if the variant contained the array ['x',
716 	 * 'y'] then the valid values for the key would be
717 	 * [], ['x'],
718 	 * ['y'], ['x', 'y'] and
719 	 * ['y', 'x'].
720 	 * Finally, if the string is 'range' then the variant
721 	 * contains a pair of like-typed values -- the minimum and maximum
722 	 * permissible values for this key.
723 	 * This information should not be used by normal programs. It is
724 	 * considered to be a hint for introspection purposes. Normal programs
725 	 * should already know what is permitted by their own schema. The
726 	 * format may change in any way in the future -- but particularly, new
727 	 * forms may be added to the possibilities described above.
728 	 * It is a programmer error to give a key that isn't contained in the
729 	 * schema for settings.
730 	 * You should free the returned value with g_variant_unref() when it is
731 	 * no longer needed.
732 	 * Since 2.28
733 	 * Params:
734 	 * key = the key to query the range of
735 	 * Returns: a GVariant describing the range
736 	 */
737 	public Variant getRange(string key)
738 	{
739 		// GVariant * g_settings_get_range (GSettings *settings,  const gchar *key);
740 		auto p = g_settings_get_range(gSettings, Str.toStringz(key));
741 		
742 		if(p is null)
743 		{
744 			return null;
745 		}
746 		
747 		return ObjectG.getDObject!(Variant)(cast(GVariant*) p);
748 	}
749 	
750 	/**
751 	 * Checks if the given value is of the correct type and within the
752 	 * permitted range for key.
753 	 * This API is not intended to be used by normal programs -- they should
754 	 * already know what is permitted by their own schemas. This API is
755 	 * meant to be used by programs such as editors or commandline tools.
756 	 * It is a programmer error to give a key that isn't contained in the
757 	 * schema for settings.
758 	 * Since 2.28
759 	 * Params:
760 	 * key = the key to check
761 	 * value = the value to check
762 	 * Returns: TRUE if value is valid for key
763 	 */
764 	public int rangeCheck(string key, Variant value)
765 	{
766 		// gboolean g_settings_range_check (GSettings *settings,  const gchar *key,  GVariant *value);
767 		return g_settings_range_check(gSettings, Str.toStringz(key), (value is null) ? null : value.getVariantStruct());
768 	}
769 	
770 	/**
771 	 * Gets the value that is stored at key in settings.
772 	 * A convenience variant of g_settings_get() for booleans.
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 	 * Since 2.26
776 	 * Params:
777 	 * key = the key to get the value for
778 	 * Returns: a boolean
779 	 */
780 	public int getBoolean(string key)
781 	{
782 		// gboolean g_settings_get_boolean (GSettings *settings,  const gchar *key);
783 		return g_settings_get_boolean(gSettings, Str.toStringz(key));
784 	}
785 	
786 	/**
787 	 * Sets key in settings to value.
788 	 * A convenience variant of g_settings_set() for booleans.
789 	 * It is a programmer error to give a key that isn't specified as
790 	 * having a boolean type in the schema for settings.
791 	 * Since 2.26
792 	 * Params:
793 	 * key = the name of the key to set
794 	 * value = the value to set it to
795 	 * Returns: TRUE if setting the key succeeded, FALSE if the key was not writable
796 	 */
797 	public int setBoolean(string key, int value)
798 	{
799 		// gboolean g_settings_set_boolean (GSettings *settings,  const gchar *key,  gboolean value);
800 		return g_settings_set_boolean(gSettings, Str.toStringz(key), value);
801 	}
802 	
803 	/**
804 	 * Gets the value that is stored at key in settings.
805 	 * A convenience variant of g_settings_get() for 32-bit integers.
806 	 * It is a programmer error to give a key that isn't specified as
807 	 * having a int32 type in the schema for settings.
808 	 * Since 2.26
809 	 * Params:
810 	 * key = the key to get the value for
811 	 * Returns: an integer
812 	 */
813 	public int getInt(string key)
814 	{
815 		// gint g_settings_get_int (GSettings *settings,  const gchar *key);
816 		return g_settings_get_int(gSettings, Str.toStringz(key));
817 	}
818 	
819 	/**
820 	 * Sets key in settings to value.
821 	 * A convenience variant of g_settings_set() for 32-bit integers.
822 	 * It is a programmer error to give a key that isn't specified as
823 	 * having a int32 type in the schema for settings.
824 	 * Since 2.26
825 	 * Params:
826 	 * key = the name of the key to set
827 	 * value = the value to set it to
828 	 * Returns: TRUE if setting the key succeeded, FALSE if the key was not writable
829 	 */
830 	public int setInt(string key, int value)
831 	{
832 		// gboolean g_settings_set_int (GSettings *settings,  const gchar *key,  gint value);
833 		return g_settings_set_int(gSettings, Str.toStringz(key), value);
834 	}
835 	
836 	/**
837 	 * Gets the value that is stored at key in settings.
838 	 * A convenience variant of g_settings_get() for doubles.
839 	 * It is a programmer error to give a key that isn't specified as
840 	 * having a 'double' type in the schema for settings.
841 	 * Since 2.26
842 	 * Params:
843 	 * key = the key to get the value for
844 	 * Returns: a double
845 	 */
846 	public double getDouble(string key)
847 	{
848 		// gdouble g_settings_get_double (GSettings *settings,  const gchar *key);
849 		return g_settings_get_double(gSettings, Str.toStringz(key));
850 	}
851 	
852 	/**
853 	 * Sets key in settings to value.
854 	 * A convenience variant of g_settings_set() for doubles.
855 	 * It is a programmer error to give a key that isn't specified as
856 	 * having a 'double' type in the schema for settings.
857 	 * Since 2.26
858 	 * Params:
859 	 * key = the name of the key to set
860 	 * value = the value to set it to
861 	 * Returns: TRUE if setting the key succeeded, FALSE if the key was not writable
862 	 */
863 	public int setDouble(string key, double value)
864 	{
865 		// gboolean g_settings_set_double (GSettings *settings,  const gchar *key,  gdouble value);
866 		return g_settings_set_double(gSettings, Str.toStringz(key), value);
867 	}
868 	
869 	/**
870 	 * Gets the value that is stored at key in settings.
871 	 * A convenience variant of g_settings_get() for strings.
872 	 * It is a programmer error to give a key that isn't specified as
873 	 * having a string type in the schema for settings.
874 	 * Since 2.26
875 	 * Params:
876 	 * key = the key to get the value for
877 	 * Returns: a newly-allocated string
878 	 */
879 	public string getString(string key)
880 	{
881 		// gchar * g_settings_get_string (GSettings *settings,  const gchar *key);
882 		return Str.toString(g_settings_get_string(gSettings, Str.toStringz(key)));
883 	}
884 	
885 	/**
886 	 * Sets key in settings to value.
887 	 * A convenience variant of g_settings_set() for strings.
888 	 * It is a programmer error to give a key that isn't specified as
889 	 * having a string type in the schema for settings.
890 	 * Since 2.26
891 	 * Params:
892 	 * key = the name of the key to set
893 	 * value = the value to set it to
894 	 * Returns: TRUE if setting the key succeeded, FALSE if the key was not writable
895 	 */
896 	public int setString(string key, string value)
897 	{
898 		// gboolean g_settings_set_string (GSettings *settings,  const gchar *key,  const gchar *value);
899 		return g_settings_set_string(gSettings, Str.toStringz(key), Str.toStringz(value));
900 	}
901 	
902 	/**
903 	 * A convenience variant of g_settings_get() for string arrays.
904 	 * It is a programmer error to give a key that isn't specified as
905 	 * having an array of strings type in the schema for settings.
906 	 * Since 2.26
907 	 * Params:
908 	 * key = the key to get the value for
909 	 * Returns: a newly-allocated, NULL-terminated array of strings, the value that is stored at key in settings. [array zero-terminated=1][transfer full]
910 	 */
911 	public string[] getStrv(string key)
912 	{
913 		// gchar ** g_settings_get_strv (GSettings *settings,  const gchar *key);
914 		return Str.toStringArray(g_settings_get_strv(gSettings, Str.toStringz(key)));
915 	}
916 	
917 	/**
918 	 * Sets key in settings to value.
919 	 * A convenience variant of g_settings_set() for string arrays. If
920 	 * value is NULL, then key is set to be the empty array.
921 	 * It is a programmer error to give a key that isn't specified as
922 	 * having an array of strings type in the schema for settings.
923 	 * Since 2.26
924 	 * Params:
925 	 * key = the name of the key to set
926 	 * value = the value to set it to, or NULL. [allow-none][array zero-terminated=1]
927 	 * Returns: TRUE if setting the key succeeded, FALSE if the key was not writable
928 	 */
929 	public int setStrv(string key, string[] value)
930 	{
931 		// gboolean g_settings_set_strv (GSettings *settings,  const gchar *key,  const gchar *const *value);
932 		return g_settings_set_strv(gSettings, Str.toStringz(key), Str.toStringzArray(value));
933 	}
934 	
935 	/**
936 	 * Gets the value that is stored in settings for key and converts it
937 	 * to the enum value that it represents.
938 	 * In order to use this function the type of the value must be a string
939 	 * and it must be marked in the schema file as an enumerated type.
940 	 * It is a programmer error to give a key that isn't contained in the
941 	 * schema for settings or is not marked as an enumerated type.
942 	 * If the value stored in the configuration database is not a valid
943 	 * value for the enumerated type then this function will return the
944 	 * default value.
945 	 * Since 2.26
946 	 * Params:
947 	 * key = the key to get the value for
948 	 * Returns: the enum value
949 	 */
950 	public int getEnum(string key)
951 	{
952 		// gint g_settings_get_enum (GSettings *settings,  const gchar *key);
953 		return g_settings_get_enum(gSettings, Str.toStringz(key));
954 	}
955 	
956 	/**
957 	 * Looks up the enumerated type nick for value and writes it to key,
958 	 * within settings.
959 	 * It is a programmer error to give a key that isn't contained in the
960 	 * schema for settings or is not marked as an enumerated type, or for
961 	 * value not to be a valid value for the named type.
962 	 * After performing the write, accessing key directly with
963 	 * g_settings_get_string() will return the 'nick' associated with
964 	 * value.
965 	 * Params:
966 	 * key = a key, within settings
967 	 * value = an enumerated value
968 	 * Returns: TRUE, if the set succeeds
969 	 */
970 	public int setEnum(string key, int value)
971 	{
972 		// gboolean g_settings_set_enum (GSettings *settings,  const gchar *key,  gint value);
973 		return g_settings_set_enum(gSettings, Str.toStringz(key), value);
974 	}
975 	
976 	/**
977 	 * Gets the value that is stored in settings for key and converts it
978 	 * to the flags value that it represents.
979 	 * In order to use this function the type of the value must be an array
980 	 * of strings and it must be marked in the schema file as an flags type.
981 	 * It is a programmer error to give a key that isn't contained in the
982 	 * schema for settings or is not marked as a flags type.
983 	 * If the value stored in the configuration database is not a valid
984 	 * value for the flags type then this function will return the default
985 	 * value.
986 	 * Since 2.26
987 	 * Params:
988 	 * key = the key to get the value for
989 	 * Returns: the flags value
990 	 */
991 	public uint getFlags(string key)
992 	{
993 		// guint g_settings_get_flags (GSettings *settings,  const gchar *key);
994 		return g_settings_get_flags(gSettings, Str.toStringz(key));
995 	}
996 	
997 	/**
998 	 * Looks up the flags type nicks for the bits specified by value, puts
999 	 * them in an array of strings and writes the array to key, withing
1000 	 * settings.
1001 	 * It is a programmer error to give a key that isn't contained in the
1002 	 * schema for settings or is not marked as a flags type, or for value
1003 	 * to contain any bits that are not value for the named type.
1004 	 * After performing the write, accessing key directly with
1005 	 * g_settings_get_strv() will return an array of 'nicks'; one for each
1006 	 * bit in value.
1007 	 * Params:
1008 	 * key = a key, within settings
1009 	 * value = a flags value
1010 	 * Returns: TRUE, if the set succeeds
1011 	 */
1012 	public int setFlags(string key, uint value)
1013 	{
1014 		// gboolean g_settings_set_flags (GSettings *settings,  const gchar *key,  guint value);
1015 		return g_settings_set_flags(gSettings, Str.toStringz(key), value);
1016 	}
1017 	
1018 	/**
1019 	 * Gets the value that is stored at key in settings, subject to
1020 	 * application-level validation/mapping.
1021 	 * You should use this function when the application needs to perform
1022 	 * some processing on the value of the key (for example, parsing). The
1023 	 * mapping function performs that processing. If the function
1024 	 * indicates that the processing was unsuccessful (due to a parse error,
1025 	 * for example) then the mapping is tried again with another value.
1026 	 * This allows a robust 'fall back to defaults' behaviour to be
1027 	 * implemented somewhat automatically.
1028 	 * The first value that is tried is the user's setting for the key. If
1029 	 * the mapping function fails to map this value, other values may be
1030 	 * tried in an unspecified order (system or site defaults, translated
1031 	 * schema default values, untranslated schema default values, etc).
1032 	 * If the mapping function fails for all possible values, one additional
1033 	 * attempt is made: the mapping function is called with a NULL value.
1034 	 * If the mapping function still indicates failure at this point then
1035 	 * the application will be aborted.
1036 	 * The result parameter for the mapping function is pointed to a
1037 	 * gpointer which is initially set to NULL. The same pointer is given
1038 	 * to each invocation of mapping. The final value of that gpointer is
1039 	 * what is returned by this function. NULL is valid; it is returned
1040 	 * just as any other value would be.
1041 	 * Params:
1042 	 * key = the key to get the value for
1043 	 * mapping = the function to map the value in the
1044 	 * settings database to the value used by the application. [scope call]
1045 	 * userData = user data for mapping
1046 	 * Returns: the result, which may be NULL. [transfer full]
1047 	 */
1048 	public void* getMapped(string key, GSettingsGetMapping mapping, void* userData)
1049 	{
1050 		// gpointer g_settings_get_mapped (GSettings *settings,  const gchar *key,  GSettingsGetMapping mapping,  gpointer user_data);
1051 		return g_settings_get_mapped(gSettings, Str.toStringz(key), mapping, userData);
1052 	}
1053 	
1054 	/**
1055 	 * Create a binding between the key in the settings object
1056 	 * and the property property of object.
1057 	 * The binding uses the default GIO mapping functions to map
1058 	 * between the settings and property values. These functions
1059 	 * handle booleans, numeric types and string types in a
1060 	 * straightforward way. Use g_settings_bind_with_mapping() if
1061 	 * you need a custom mapping, or map between types that are not
1062 	 * supported by the default mapping functions.
1063 	 * Unless the flags include G_SETTINGS_BIND_NO_SENSITIVITY, this
1064 	 * function also establishes a binding between the writability of
1065 	 * key and the "sensitive" property of object (if object has
1066 	 * a boolean property by that name). See g_settings_bind_writable()
1067 	 * for more details about writable bindings.
1068 	 * Note that the lifecycle of the binding is tied to the object,
1069 	 * and that you can have only one binding per object property.
1070 	 * If you bind the same property twice on the same object, the second
1071 	 * binding overrides the first one.
1072 	 * Since 2.26
1073 	 * Params:
1074 	 * key = the key to bind
1075 	 * object = a GObject. [type GObject.Object]
1076 	 * property = the name of the property to bind
1077 	 * flags = flags for the binding
1078 	 */
1079 	public void bind(string key, void* object, string property, GSettingsBindFlags flags)
1080 	{
1081 		// void g_settings_bind (GSettings *settings,  const gchar *key,  gpointer object,  const gchar *property,  GSettingsBindFlags flags);
1082 		g_settings_bind(gSettings, Str.toStringz(key), object, Str.toStringz(property), flags);
1083 	}
1084 	
1085 	/**
1086 	 * Create a binding between the key in the settings object
1087 	 * and the property property of object.
1088 	 * The binding uses the provided mapping functions to map between
1089 	 * settings and property values.
1090 	 * Note that the lifecycle of the binding is tied to the object,
1091 	 * and that you can have only one binding per object property.
1092 	 * If you bind the same property twice on the same object, the second
1093 	 * binding overrides the first one.
1094 	 * Since 2.26
1095 	 * Params:
1096 	 * key = the key to bind
1097 	 * object = a GObject. [type GObject.Object]
1098 	 * property = the name of the property to bind
1099 	 * flags = flags for the binding
1100 	 * getMapping = a function that gets called to convert values
1101 	 * from settings to object, or NULL to use the default GIO mapping
1102 	 * setMapping = a function that gets called to convert values
1103 	 * from object to settings, or NULL to use the default GIO mapping
1104 	 * userData = data that gets passed to get_mapping and set_mapping
1105 	 * destroy = GDestroyNotify function for user_data
1106 	 */
1107 	public void bindWithMapping(string key, void* object, string property, GSettingsBindFlags flags, GSettingsBindGetMapping getMapping, GSettingsBindSetMapping setMapping, void* userData, GDestroyNotify destroy)
1108 	{
1109 		// void g_settings_bind_with_mapping (GSettings *settings,  const gchar *key,  gpointer object,  const gchar *property,  GSettingsBindFlags flags,  GSettingsBindGetMapping get_mapping,  GSettingsBindSetMapping set_mapping,  gpointer user_data,  GDestroyNotify destroy);
1110 		g_settings_bind_with_mapping(gSettings, Str.toStringz(key), object, Str.toStringz(property), flags, getMapping, setMapping, userData, destroy);
1111 	}
1112 	
1113 	/**
1114 	 * Create a binding between the writability of key in the
1115 	 * settings object and the property property of object.
1116 	 * The property must be boolean; "sensitive" or "visible"
1117 	 * properties of widgets are the most likely candidates.
1118 	 * Writable bindings are always uni-directional; changes of the
1119 	 * writability of the setting will be propagated to the object
1120 	 * property, not the other way.
1121 	 * When the inverted argument is TRUE, the binding inverts the
1122 	 * value as it passes from the setting to the object, i.e. property
1123 	 * will be set to TRUE if the key is not
1124 	 * writable.
1125 	 * Note that the lifecycle of the binding is tied to the object,
1126 	 * and that you can have only one binding per object property.
1127 	 * If you bind the same property twice on the same object, the second
1128 	 * binding overrides the first one.
1129 	 * Since 2.26
1130 	 * Params:
1131 	 * key = the key to bind
1132 	 * object = a GObject. [type GObject.Object]
1133 	 * property = the name of a boolean property to bind
1134 	 * inverted = whether to 'invert' the value
1135 	 */
1136 	public void bindWritable(string key, void* object, string property, int inverted)
1137 	{
1138 		// void g_settings_bind_writable (GSettings *settings,  const gchar *key,  gpointer object,  const gchar *property,  gboolean inverted);
1139 		g_settings_bind_writable(gSettings, Str.toStringz(key), object, Str.toStringz(property), inverted);
1140 	}
1141 	
1142 	/**
1143 	 * Removes an existing binding for property on object.
1144 	 * Note that bindings are automatically removed when the
1145 	 * object is finalized, so it is rarely necessary to call this
1146 	 * function.
1147 	 * Since 2.26
1148 	 * Params:
1149 	 * object = the object
1150 	 * property = the property whose binding is removed
1151 	 */
1152 	public static void unbind(void* object, string property)
1153 	{
1154 		// void g_settings_unbind (gpointer object,  const gchar *property);
1155 		g_settings_unbind(object, Str.toStringz(property));
1156 	}
1157 }