1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "fmt"
6 "structs"
7 "unsafe"
8
9 "github.com/ebitengine/purego"
10
11 "github.com/bnema/puregotk/pkg/core"
12 "github.com/bnema/puregotk/v4/glib"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15)
16
17// The type for the function that is used to convert from [class@Gio.Settings]
18// to an object property.
19//
20// The @value is already initialized to hold values of the appropriate type.
21type SettingsBindGetMapping func(*gobject.Value, *glib.Variant, uintptr) bool
22
23// The type for the function that is used to convert an object property
24// value to a [struct@GLib.Variant] for storing it in [class@Gio.Settings].
25type SettingsBindSetMapping func(*gobject.Value, *glib.VariantType, uintptr) *glib.Variant
26
27// The type of the function that is used to convert from a value stored
28// in a [class@Gio.Settings] to a value that is useful to the application.
29//
30// If the value is successfully mapped, the result should be stored at
31// @result and true returned. If mapping fails (for example, if @value
32// is not in the right format) then false should be returned.
33//
34// If @value is `NULL` then it means that the mapping function is being
35// given a ‘last chance’ to successfully return a valid value. True
36// must be returned in this case.
37type SettingsGetMapping func(*glib.Variant, *uintptr, uintptr) bool
38
39type SettingsClass struct {
40 _ structs.HostLayout
41
42 ParentClass gobject.ObjectClass
43
44 xWritableChanged uintptr
45
46 xChanged uintptr
47
48 xWritableChangeEvent uintptr
49
50 xChangeEvent uintptr
51
52 Padding [20]uintptr
53}
54
55func (x *SettingsClass) GoPointer() uintptr {
56 return uintptr(unsafe.Pointer(x))
57}
58
59// OverrideWritableChanged sets the "writable_changed" callback function.
60func (x *SettingsClass) OverrideWritableChanged(cb func(*Settings, string)) {
61 if cb == nil {
62 x.xWritableChanged = 0
63 } else {
64 x.xWritableChanged = purego.NewCallback(func(SettingsVarp uintptr, KeyVarp string) {
65 cb(SettingsNewFromInternalPtr(SettingsVarp), KeyVarp)
66 })
67 }
68}
69
70// GetWritableChanged gets the "writable_changed" callback function.
71func (x *SettingsClass) GetWritableChanged() func(*Settings, string) {
72 if x.xWritableChanged == 0 {
73 return nil
74 }
75 var rawCallback func(SettingsVarp uintptr, KeyVarp string)
76 purego.RegisterFunc(&rawCallback, x.xWritableChanged)
77 return func(SettingsVar *Settings, KeyVar string) {
78 rawCallback(SettingsVar.GoPointer(), KeyVar)
79 }
80}
81
82// OverrideChanged sets the "changed" callback function.
83func (x *SettingsClass) OverrideChanged(cb func(*Settings, string)) {
84 if cb == nil {
85 x.xChanged = 0
86 } else {
87 x.xChanged = purego.NewCallback(func(SettingsVarp uintptr, KeyVarp string) {
88 cb(SettingsNewFromInternalPtr(SettingsVarp), KeyVarp)
89 })
90 }
91}
92
93// GetChanged gets the "changed" callback function.
94func (x *SettingsClass) GetChanged() func(*Settings, string) {
95 if x.xChanged == 0 {
96 return nil
97 }
98 var rawCallback func(SettingsVarp uintptr, KeyVarp string)
99 purego.RegisterFunc(&rawCallback, x.xChanged)
100 return func(SettingsVar *Settings, KeyVar string) {
101 rawCallback(SettingsVar.GoPointer(), KeyVar)
102 }
103}
104
105// OverrideWritableChangeEvent sets the "writable_change_event" callback function.
106func (x *SettingsClass) OverrideWritableChangeEvent(cb func(*Settings, glib.Quark) bool) {
107 if cb == nil {
108 x.xWritableChangeEvent = 0
109 } else {
110 x.xWritableChangeEvent = purego.NewCallback(func(SettingsVarp uintptr, KeyVarp glib.Quark) bool {
111 return cb(SettingsNewFromInternalPtr(SettingsVarp), KeyVarp)
112 })
113 }
114}
115
116// GetWritableChangeEvent gets the "writable_change_event" callback function.
117func (x *SettingsClass) GetWritableChangeEvent() func(*Settings, glib.Quark) bool {
118 if x.xWritableChangeEvent == 0 {
119 return nil
120 }
121 var rawCallback func(SettingsVarp uintptr, KeyVarp glib.Quark) bool
122 purego.RegisterFunc(&rawCallback, x.xWritableChangeEvent)
123 return func(SettingsVar *Settings, KeyVar glib.Quark) bool {
124 return rawCallback(SettingsVar.GoPointer(), KeyVar)
125 }
126}
127
128// OverrideChangeEvent sets the "change_event" callback function.
129func (x *SettingsClass) OverrideChangeEvent(cb func(*Settings, *glib.Quark, int) bool) {
130 if cb == nil {
131 x.xChangeEvent = 0
132 } else {
133 x.xChangeEvent = purego.NewCallback(func(SettingsVarp uintptr, KeysVarp *glib.Quark, NKeysVarp int) bool {
134 return cb(SettingsNewFromInternalPtr(SettingsVarp), KeysVarp, NKeysVarp)
135 })
136 }
137}
138
139// GetChangeEvent gets the "change_event" callback function.
140func (x *SettingsClass) GetChangeEvent() func(*Settings, *glib.Quark, int) bool {
141 if x.xChangeEvent == 0 {
142 return nil
143 }
144 var rawCallback func(SettingsVarp uintptr, KeysVarp *glib.Quark, NKeysVarp int) bool
145 purego.RegisterFunc(&rawCallback, x.xChangeEvent)
146 return func(SettingsVar *Settings, KeysVar *glib.Quark, NKeysVar int) bool {
147 return rawCallback(SettingsVar.GoPointer(), KeysVar, NKeysVar)
148 }
149}
150
151type SettingsPrivate struct {
152 _ structs.HostLayout
153}
154
155func (x *SettingsPrivate) GoPointer() uintptr {
156 return uintptr(unsafe.Pointer(x))
157}
158
159// Flags used when creating a binding.
160//
161// These flags determine in which direction the binding works. The default is to
162// synchronize in both directions.
163type SettingsBindFlags int
164
165var xSettingsBindFlagsGLibType func() types.GType
166
167func SettingsBindFlagsGLibType() types.GType {
168 return xSettingsBindFlagsGLibType()
169}
170
171const (
172
173 // Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET`
174 GSettingsBindDefaultValue SettingsBindFlags = 0
175 // Update the [class@GObject.Object] property when the setting changes.
176 // It is an error to use this flag if the property is not writable.
177 GSettingsBindGetValue SettingsBindFlags = 1
178 // Update the setting when the [class@GObject.Object] property changes.
179 // It is an error to use this flag if the property is not readable.
180 GSettingsBindSetValue SettingsBindFlags = 2
181 // Do not try to bind a ‘sensitivity’ property to the writability of the setting
182 GSettingsBindNoSensitivityValue SettingsBindFlags = 4
183 // When set in addition to [flags@Gio.SettingsBindFlags.GET],
184 // set the [class@GObject.Object] property
185 // value initially from the setting, but do not listen for changes of the setting
186 GSettingsBindGetNoChangesValue SettingsBindFlags = 8
187 // When passed to [method@Gio.Settings.bind],
188 // uses a pair of mapping functions that invert
189 // the boolean value when mapping between the setting and the property. The setting and property must both
190 // be booleans. You cannot pass this flag to [method@Gio.Settings.bind_with_mapping].
191 GSettingsBindInvertBooleanValue SettingsBindFlags = 16
192)
193
194// The `GSettings` class provides a convenient API for storing and retrieving
195// application settings.
196//
197// Reads and writes can be considered to be non-blocking. Reading
198// settings with `GSettings` is typically extremely fast: on
199// approximately the same order of magnitude (but slower than) a
200// [struct@GLib.HashTable] lookup. Writing settings is also extremely fast in
201// terms of time to return to your application, but can be extremely expensive
202// for other threads and other processes. Many settings backends
203// (including dconf) have lazy initialisation which means in the common
204// case of the user using their computer without modifying any settings
205// a lot of work can be avoided. For dconf, the D-Bus service doesn’t
206// even need to be started in this case. For this reason, you should
207// only ever modify `GSettings` keys in response to explicit user action.
208// Particular care should be paid to ensure that modifications are not
209// made during startup — for example, when setting the initial value
210// of preferences widgets. The built-in [method@Gio.Settings.bind]
211// functionality is careful not to write settings in response to notify signals
212// as a result of modifications that it makes to widgets.
213//
214// When creating a `GSettings` instance, you have to specify a schema
215// that describes the keys in your settings and their types and default
216// values, as well as some other information.
217//
218// Normally, a schema has a fixed path that determines where the settings
219// are stored in the conceptual global tree of settings. However, schemas
220// can also be ‘[relocatable](#relocatable-schemas)’, i.e. not equipped with
221// a fixed path. This is
222// useful e.g. when the schema describes an ‘account’, and you want to be
223// able to store a arbitrary number of accounts.
224//
225// Paths must start with and end with a forward slash character (`/`)
226// and must not contain two sequential slash characters. Paths should
227// be chosen based on a domain name associated with the program or
228// library to which the settings belong. Examples of paths are
229// `/org/gtk/settings/file-chooser/` and `/ca/desrt/dconf-editor/`.
230// Paths should not start with `/apps/`, `/desktop/` or `/system/` as
231// they often did in GConf.
232//
233// Unlike other configuration systems (like GConf), GSettings does not
234// restrict keys to basic types like strings and numbers. GSettings stores
235// values as [struct@GLib.Variant], and allows any [type@GLib.VariantType] for
236// keys. Key names are restricted to lowercase characters, numbers and `-`.
237// Furthermore, the names must begin with a lowercase character, must not end
238// with a `-`, and must not contain consecutive dashes.
239//
240// Similar to GConf, the default values in GSettings schemas can be
241// localized, but the localized values are stored in gettext catalogs
242// and looked up with the domain that is specified in the
243// `gettext-domain` attribute of the `<schemalist>` or `<schema>`
244// elements and the category that is specified in the `l10n` attribute of
245// the `<default>` element. The string which is translated includes all text in
246// the `<default>` element, including any surrounding quotation marks.
247//
248// The `l10n` attribute must be set to `messages` or `time`, and sets the
249// [locale category for
250// translation](https://www.gnu.org/software/gettext/manual/html_node/Aspects.html#index-locale-categories-1).
251// The `messages` category should be used by default; use `time` for
252// translatable date or time formats. A translation comment can be added as an
253// XML comment immediately above the `<default>` element — it is recommended to
254// add these comments to aid translators understand the meaning and
255// implications of the default value. An optional translation `context`
256// attribute can be set on the `<default>` element to disambiguate multiple
257// defaults which use the same string.
258//
259// For example:
260// ```xml
261//
262// <!-- Translators: A list of words which are not allowed to be typed, in
263// GVariant serialization syntax.
264// See: https://developer.gnome.org/glib/stable/gvariant-text.html -->
265// <default l10n='messages' context='Banned words'>['bad', 'words']</default>
266//
267// ```
268//
269// Translations of default values must remain syntactically valid serialized
270// [struct@GLib.Variant]s (e.g. retaining any surrounding quotation marks) or
271// runtime errors will occur.
272//
273// GSettings uses schemas in a compact binary form that is created
274// by the [`glib-compile-schemas`](glib-compile-schemas.html)
275// utility. The input is a schema description in an XML format.
276//
277// A DTD for the gschema XML format can be found here:
278// [gschema.dtd](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/gschema.dtd)
279//
280// The [`glib-compile-schemas`](glib-compile-schemas.html) tool expects schema
281// files to have the extension `.gschema.xml`.
282//
283// At runtime, schemas are identified by their ID (as specified in the
284// `id` attribute of the `<schema>` element). The convention for schema
285// IDs is to use a dotted name, similar in style to a D-Bus bus name,
286// e.g. `org.gnome.SessionManager`. In particular, if the settings are
287// for a specific service that owns a D-Bus bus name, the D-Bus bus name
288// and schema ID should match. For schemas which deal with settings not
289// associated with one named application, the ID should not use
290// StudlyCaps, e.g. `org.gnome.font-rendering`.
291//
292// In addition to [struct@GLib.Variant] types, keys can have types that have
293// enumerated types. These can be described by a `<choice>`,
294// `<enum>` or `<flags>` element, as seen in the
295// second example below. The underlying type of such a key
296// is string, but you can use [method@Gio.Settings.get_enum],
297// [method@Gio.Settings.set_enum], [method@Gio.Settings.get_flags],
298// [method@Gio.Settings.set_flags] access the numeric values corresponding to
299// the string value of enum and flags keys.
300//
301// An example for default value:
302// ```xml
303// <schemalist>
304//
305// <schema id="org.gtk.Test" path="/org/gtk/Test/" gettext-domain="test">
306//
307// <key name="greeting" type="s">
308// <default l10n="messages">"Hello, earthlings"</default>
309// <summary>A greeting</summary>
310// <description>
311// Greeting of the invading martians
312// </description>
313// </key>
314//
315// <key name="box" type="(ii)">
316// <default>(20,30)</default>
317// </key>
318//
319// <key name="empty-string" type="s">
320// <default>""</default>
321// <summary>Empty strings have to be provided in GVariant form</summary>
322// </key>
323//
324// </schema>
325//
326// </schemalist>
327// ```
328//
329// An example for ranges, choices and enumerated types:
330// ```xml
331// <schemalist>
332//
333// <enum id="org.gtk.Test.myenum">
334// <value nick="first" value="1"/>
335// <value nick="second" value="2"/>
336// </enum>
337//
338// <flags id="org.gtk.Test.myflags">
339// <value nick="flag1" value="1"/>
340// <value nick="flag2" value="2"/>
341// <value nick="flag3" value="4"/>
342// </flags>
343//
344// <schema id="org.gtk.Test">
345//
346// <key name="key-with-range" type="i">
347// <range min="1" max="100"/>
348// <default>10</default>
349// </key>
350//
351// <key name="key-with-choices" type="s">
352// <choices>
353// <choice value='Elisabeth'/>
354// <choice value='Annabeth'/>
355// <choice value='Joe'/>
356// </choices>
357// <aliases>
358// <alias value='Anna' target='Annabeth'/>
359// <alias value='Beth' target='Elisabeth'/>
360// </aliases>
361// <default>'Joe'</default>
362// </key>
363//
364// <key name='enumerated-key' enum='org.gtk.Test.myenum'>
365// <default>'first'</default>
366// </key>
367//
368// <key name='flags-key' flags='org.gtk.Test.myflags'>
369// <default>["flag1","flag2"]</default>
370// </key>
371// </schema>
372//
373// </schemalist>
374// ```
375//
376// ## Vendor overrides
377//
378// Default values are defined in the schemas that get installed by
379// an application. Sometimes, it is necessary for a vendor or distributor
380// to adjust these defaults. Since patching the XML source for the schema
381// is inconvenient and error-prone,
382// [`glib-compile-schemas`](glib-compile-schemas.html) reads so-called ‘vendor
383// override’ files. These are keyfiles in the same directory as the XML
384// schema sources which can override default values. The schema ID serves
385// as the group name in the key file, and the values are expected in
386// serialized [struct@GLib.Variant] form, as in the following example:
387// ```
388// [org.gtk.Example]
389// key1='string'
390// key2=1.5
391// ```
392//
393// `glib-compile-schemas` expects schema files to have the extension
394// `.gschema.override`.
395//
396// ## Delay-apply mode
397//
398// By default, values set on a [class@Gio.Settings] instance immediately start
399// to be written to the backend (although these writes may not complete by the
400// time that [method@Gio.Settings.set]) returns; see [func@Gio.Settings.sync]).
401//
402// In order to allow groups of settings to be changed simultaneously and
403// atomically, GSettings also supports a ‘delay-apply’ mode. In this mode,
404// updated values are kept locally in the [class@Gio.Settings] instance until
405// they are explicitly applied by calling [method@Gio.Settings.apply].
406//
407// For example, this could be useful for a preferences dialog where the
408// preferences all need to be applied simultaneously when the user clicks ‘Save’.
409//
410// Switching a [class@Gio.Settings] instance to ‘delay-apply’ mode is a one-time
411// irreversible operation: from that point onwards, *all* changes made to that
412// [class@Gio.Settings] have to be explicitly applied by calling
413// [method@Gio.Settings.apply]. The ‘delay-apply’ mode is also propagated to any
414// child settings objects subsequently created using
415// [method@Gio.Settings.get_child].
416//
417// At any point, the set of unapplied changes can be queried using
418// [property@Gio.Settings:has-unapplied], and discarded by calling
419// [method@Gio.Settings.revert].
420//
421// ## Binding
422//
423// A very convenient feature of GSettings lets you bind [class@GObject.Object]
424// properties directly to settings, using [method@Gio.Settings.bind]. Once a
425// [class@GObject.Object] property has been bound to a setting, changes on
426// either side are automatically propagated to the other side. GSettings handles
427// details like mapping between [class@GObject.Object] and [struct@GLib.Variant]
428// types, and preventing infinite cycles.
429//
430// This makes it very easy to hook up a preferences dialog to the
431// underlying settings. To make this even more convenient, GSettings
432// looks for a boolean property with the name `sensitivity` and
433// automatically binds it to the writability of the bound setting.
434// If this ‘magic’ gets in the way, it can be suppressed with the
435// `G_SETTINGS_BIND_NO_SENSITIVITY` flag.
436//
437// ## Relocatable schemas
438//
439// A relocatable schema is one with no `path` attribute specified on its
440// `<schema>` element. By using [ctor@Gio.Settings.new_with_path], a `GSettings`
441// object can be instantiated for a relocatable schema, assigning a path to the
442// instance. Paths passed to [ctor@Gio.Settings.new_with_path] will typically be
443// constructed dynamically from a constant prefix plus some form of instance
444// identifier; but they must still be valid GSettings paths. Paths could also
445// be constant and used with a globally installed schema originating from a
446// dependency library.
447//
448// For example, a relocatable schema could be used to store geometry information
449// for different windows in an application. If the schema ID was
450// `org.foo.MyApp.Window`, it could be instantiated for paths
451// `/org/foo/MyApp/main/`, `/org/foo/MyApp/document-1/`,
452// `/org/foo/MyApp/document-2/`, etc. If any of the paths are well-known
453// they can be specified as `<child>` elements in the parent schema, e.g.:
454// ```xml
455// <schema id="org.foo.MyApp" path="/org/foo/MyApp/">
456//
457// <child name="main" schema="org.foo.MyApp.Window"/>
458//
459// </schema>
460// ```
461//
462// ## Build system integration
463//
464// ### Meson
465//
466// GSettings is natively supported by Meson’s [GNOME module](https://mesonbuild.com/Gnome-module.html).
467//
468// You can install the schemas as any other data file:
469//
470// ```
471// install_data(
472//
473// 'org.foo.MyApp.gschema.xml',
474// install_dir: get_option('datadir') / 'glib-2.0/schemas',
475//
476// )
477// ```
478//
479// You can use `gnome.post_install()` function to compile the schemas on
480// installation:
481//
482// ```
483// gnome = import('gnome')
484// gnome.post_install(
485//
486// glib_compile_schemas: true,
487//
488// )
489// ```
490//
491// If an enumerated type defined in a C header file is to be used in a GSettings
492// schema, it can either be defined manually using an `<enum>` element in the
493// schema XML, or it can be extracted automatically from the C header. This
494// approach is preferred, as it ensures the two representations are always
495// synchronised. To do so, you will need to use the `gnome.mkenums()` function
496// with the following templates:
497//
498// ```
499// schemas_enums = gnome.mkenums('org.foo.MyApp.enums.xml',
500//
501// comments: '<!-- @comment@ -->',
502// fhead: '<schemalist>',
503// vhead: ' <@type@ id="org.foo.MyApp.@EnumName@">',
504// vprod: ' <value nick="@valuenick@" value="@valuenum@"/>',
505// vtail: ' </@type@>',
506// ftail: '</schemalist>',
507// sources: enum_sources,
508// install_header: true,
509// install_dir: get_option('datadir') / 'glib-2.0/schemas',
510//
511// )
512// ```
513//
514// It is recommended to validate your schemas as part of the test suite for
515// your application:
516//
517// ```
518// test('validate-schema',
519//
520// find_program('glib-compile-schemas'),
521// args: ['--strict', '--dry-run', meson.current_source_dir()],
522//
523// )
524// ```
525//
526// If your application allows running uninstalled, you should also use the
527// `gnome.compile_schemas()` function to compile the schemas in the current
528// build directory:
529//
530// ```
531// gnome.compile_schemas()
532// ```
533//
534// ### Autotools
535//
536// GSettings comes with autotools integration to simplify compiling and
537// installing schemas. To add GSettings support to an application, add the
538// following to your `configure.ac`:
539// ```
540// GLIB_GSETTINGS
541// ```
542//
543// In the appropriate `Makefile.am`, use the following snippet to compile and
544// install the named schema:
545// ```
546// gsettings_SCHEMAS = org.foo.MyApp.gschema.xml
547// EXTRA_DIST = $(gsettings_SCHEMAS)
548//
549// @GSETTINGS_RULES@
550// ```
551//
552// If an enumerated type defined in a C header file is to be used in a GSettings
553// schema, it can either be defined manually using an `<enum>` element in the
554// schema XML, or it can be extracted automatically from the C header. This
555// approach is preferred, as it ensures the two representations are always
556// synchronised. To do so, add the following to the relevant `Makefile.am`:
557// ```
558// gsettings_ENUM_NAMESPACE = org.foo.MyApp
559// gsettings_ENUM_FILES = my-app-enums.h my-app-misc.h
560// ```
561//
562// `gsettings_ENUM_NAMESPACE` specifies the schema namespace for the enum files,
563// which are specified in `gsettings_ENUM_FILES`. This will generate a
564// `org.foo.MyApp.enums.xml` file containing the extracted enums, which will be
565// automatically included in the schema compilation, install and uninstall
566// rules. It should not be committed to version control or included in
567// `EXTRA_DIST`.
568//
569// ## Localization
570//
571// No changes are needed to the build system to mark a schema XML file for
572// translation. Assuming it sets the `gettext-domain` attribute, a schema may
573// be marked for translation by adding it to `POTFILES.in`, assuming gettext
574// 0.19 or newer is in use (the preferred method for translation):
575// ```
576// data/org.foo.MyApp.gschema.xml
577// ```
578//
579// Alternatively, if intltool 0.50.1 is in use:
580// ```
581// [type: gettext/gsettings]data/org.foo.MyApp.gschema.xml
582// ```
583//
584// GSettings will use gettext to look up translations for the `<summary>` and
585// `<description>` elements, and also any `<default>` elements which have a
586// `l10n` attribute set.
587//
588// Translations **must not** be included in the `.gschema.xml` file by the build
589// system, for example by using a rule to generate the XML file from a template.
590type Settings struct {
591 gobject.Object
592}
593
594var xSettingsGLibType func() types.GType
595
596func SettingsGLibType() types.GType {
597 return xSettingsGLibType()
598}
599
600func SettingsNewFromInternalPtr(ptr uintptr) *Settings {
601 cls := &Settings{}
602 cls.Ptr = ptr
603 return cls
604}
605
606var xNewSettings func(string) uintptr
607
608// Creates a new [class@Gio.Settings] object with the schema specified by
609// @schema_id.
610//
611// It is an error for the schema to not exist: schemas are an
612// essential part of a program, as they provide type information.
613// If schemas need to be dynamically loaded (for example, from an
614// optional runtime dependency), [method@Gio.SettingsSchemaSource.lookup]
615// can be used to test for their existence before loading them.
616//
617// Signals on the newly created [class@Gio.Settings] object will be dispatched
618// via the thread-default [struct@GLib.MainContext] in effect at the time of the
619// call to [ctor@Gio.Settings.new]. The new [class@Gio.Settings] will hold a reference
620// on the context. See [method@GLib.MainContext.push_thread_default].
621func NewSettings(SchemaIdVar string) *Settings {
622 var cls *Settings
623
624 cret := xNewSettings(SchemaIdVar)
625
626 if cret == 0 {
627 return nil
628 }
629 cls = &Settings{}
630 cls.Ptr = cret
631 return cls
632}
633
634var xNewSettingsFull func(*SettingsSchema, uintptr, uintptr) uintptr
635
636// Creates a new [class@Gio.Settings] object with a given schema, backend and
637// path.
638//
639// It should be extremely rare that you ever want to use this function.
640// It is made available for advanced use-cases (such as plugin systems
641// that want to provide access to schemas loaded from custom locations,
642// etc).
643//
644// At the most basic level, a [class@Gio.Settings] object is a pure composition of
645// four things: a [struct@Gio.SettingsSchema], a [class@Gio.SettingsBackend], a path within that
646// backend, and a [struct@GLib.MainContext] to which signals are dispatched.
647//
648// This constructor therefore gives you full control over constructing
649// [class@Gio.Settings] instances. The first 3 parameters are given directly as
650// @schema, @backend and @path, and the main context is taken from the
651// thread-default (as per [ctor@Gio.Settings.new]).
652//
653// If @backend is `NULL` then the default backend is used.
654//
655// If @path is `NULL` then the path from the schema is used. It is an
656// error if @path is `NULL` and the schema has no path of its own or if
657// @path is non-`NULL` and not equal to the path that the schema does
658// have.
659func NewSettingsFull(SchemaVar *SettingsSchema, BackendVar *SettingsBackend, PathVar *string) *Settings {
660 var cls *Settings
661
662 PathVarPtr := core.GStrdupNullable(PathVar)
663 defer core.GFreeNullable(PathVarPtr)
664
665 cret := xNewSettingsFull(SchemaVar, BackendVar.GoPointer(), PathVarPtr)
666
667 if cret == 0 {
668 return nil
669 }
670 cls = &Settings{}
671 cls.Ptr = cret
672 return cls
673}
674
675var xNewSettingsWithBackend func(string, uintptr) uintptr
676
677// Creates a new [class@Gio.Settings] object with the schema specified by
678// @schema_id and a given [class@Gio.SettingsBackend].
679//
680// Creating a [class@Gio.Settings] object with a different backend allows accessing
681// settings from a database other than the usual one. For example, it may make
682// sense to pass a backend corresponding to the ‘defaults’ settings database on
683// the system to get a settings object that modifies the system default
684// settings instead of the settings for this user.
685func NewSettingsWithBackend(SchemaIdVar string, BackendVar *SettingsBackend) *Settings {
686 var cls *Settings
687
688 cret := xNewSettingsWithBackend(SchemaIdVar, BackendVar.GoPointer())
689
690 if cret == 0 {
691 return nil
692 }
693 cls = &Settings{}
694 cls.Ptr = cret
695 return cls
696}
697
698var xNewSettingsWithBackendAndPath func(string, uintptr, string) uintptr
699
700// Creates a new [class@Gio.Settings] object with the schema specified by
701// @schema_id and a given [class@Gio.SettingsBackend] and path.
702//
703// This is a mix of [ctor@Gio.Settings.new_with_backend] and
704// [ctor@Gio.Settings.new_with_path].
705func NewSettingsWithBackendAndPath(SchemaIdVar string, BackendVar *SettingsBackend, PathVar string) *Settings {
706 var cls *Settings
707
708 cret := xNewSettingsWithBackendAndPath(SchemaIdVar, BackendVar.GoPointer(), PathVar)
709
710 if cret == 0 {
711 return nil
712 }
713 cls = &Settings{}
714 cls.Ptr = cret
715 return cls
716}
717
718var xNewSettingsWithPath func(string, string) uintptr
719
720// Creates a new [class@Gio.Settings] object with the relocatable schema specified
721// by @schema_id and a given path.
722//
723// You only need to do this if you want to directly create a settings
724// object with a schema that doesn’t have a specified path of its own.
725// That’s quite rare.
726//
727// It is a programmer error to call this function for a schema that
728// has an explicitly specified path.
729//
730// It is a programmer error if @path is not a valid path. A valid path
731// begins and ends with `/` and does not contain two consecutive `/`
732// characters.
733func NewSettingsWithPath(SchemaIdVar string, PathVar string) *Settings {
734 var cls *Settings
735
736 cret := xNewSettingsWithPath(SchemaIdVar, PathVar)
737
738 if cret == 0 {
739 return nil
740 }
741 cls = &Settings{}
742 cls.Ptr = cret
743 return cls
744}
745
746var xSettingsApply func(uintptr)
747
748// Applies any changes that have been made to the settings.
749//
750// This function does nothing unless @settings is in
751// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode). In the normal
752// case settings are always applied immediately.
753func (x *Settings) Apply() {
754
755 xSettingsApply(x.GoPointer())
756
757}
758
759var xSettingsBind func(uintptr, string, uintptr, string, SettingsBindFlags)
760
761// Create a binding between the @key in the @settings object
762// and the property @property of @object.
763//
764// The binding uses the default GIO mapping functions to map
765// between the settings and property values. These functions
766// handle booleans, numeric types and string types in a
767// straightforward way. Use [method@Gio.Settings.bind_with_mapping] if
768// you need a custom mapping, or map between types that are not
769// supported by the default mapping functions.
770//
771// Unless the @flags include [flags@Gio.SettingsBindFlags.NO_SENSITIVITY], this
772// function also establishes a binding between the writability of
773// @key and the `sensitive` property of @object (if @object has
774// a boolean property by that name). See [method@Gio.Settings.bind_writable]
775// for more details about writable bindings.
776//
777// Note that the lifecycle of the binding is tied to @object,
778// and that you can have only one binding per object property.
779// If you bind the same property twice on the same object, the second
780// binding overrides the first one.
781func (x *Settings) Bind(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags) {
782
783 xSettingsBind(x.GoPointer(), KeyVar, ObjectVar.GoPointer(), PropertyVar, FlagsVar)
784
785}
786
787var xSettingsBindWithMapping func(uintptr, string, uintptr, string, SettingsBindFlags, uintptr, uintptr, uintptr, uintptr)
788
789// Create a binding between the @key in the @settings object
790// and the property @property of @object.
791//
792// The binding uses the provided mapping functions to map between
793// settings and property values.
794//
795// Note that the lifecycle of the binding is tied to @object,
796// and that you can have only one binding per object property.
797// If you bind the same property twice on the same object, the second
798// binding overrides the first one.
799func (x *Settings) BindWithMapping(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags, GetMappingVar *SettingsBindGetMapping, SetMappingVar *SettingsBindSetMapping, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) {
800
801 var GetMappingVarRef uintptr
802 if GetMappingVar != nil {
803 GetMappingVarPtr := uintptr(unsafe.Pointer(GetMappingVar))
804 if cbRefPtr, ok := glib.GetCallback(GetMappingVarPtr); ok {
805 GetMappingVarRef = cbRefPtr
806 } else {
807 fcb := func(arg0 *gobject.Value, arg1 *glib.Variant, arg2 uintptr) bool {
808 cbFn := *GetMappingVar
809 return cbFn(arg0, arg1, arg2)
810 }
811 GetMappingVarRef = purego.NewCallback(fcb)
812 glib.SaveCallbackWithClosure(GetMappingVarPtr, GetMappingVarRef, GetMappingVar)
813 }
814 }
815
816 var SetMappingVarRef uintptr
817 if SetMappingVar != nil {
818 SetMappingVarPtr := uintptr(unsafe.Pointer(SetMappingVar))
819 if cbRefPtr, ok := glib.GetCallback(SetMappingVarPtr); ok {
820 SetMappingVarRef = cbRefPtr
821 } else {
822 fcb := func(arg0 *gobject.Value, arg1 *glib.VariantType, arg2 uintptr) *glib.Variant {
823 cbFn := *SetMappingVar
824 return cbFn(arg0, arg1, arg2)
825 }
826 SetMappingVarRef = purego.NewCallback(fcb)
827 glib.SaveCallbackWithClosure(SetMappingVarPtr, SetMappingVarRef, SetMappingVar)
828 }
829 }
830
831 var DestroyVarRef uintptr
832 if DestroyVar != nil {
833 DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
834 if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok {
835 DestroyVarRef = cbRefPtr
836 } else {
837 fcb := func(arg0 uintptr) {
838 cbFn := *DestroyVar
839 cbFn(arg0)
840 }
841 DestroyVarRef = purego.NewCallback(fcb)
842 glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
843 }
844 }
845
846 xSettingsBindWithMapping(x.GoPointer(), KeyVar, ObjectVar.GoPointer(), PropertyVar, FlagsVar, GetMappingVarRef, SetMappingVarRef, UserDataVar, DestroyVarRef)
847
848}
849
850var xSettingsBindWithMappingClosures func(uintptr, string, uintptr, string, SettingsBindFlags, *gobject.Closure, *gobject.Closure)
851
852// Version of [method@Gio.Settings.bind_with_mapping] using closures instead of
853// callbacks for easier binding in other languages.
854func (x *Settings) BindWithMappingClosures(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags, GetMappingVar *gobject.Closure, SetMappingVar *gobject.Closure) {
855
856 xSettingsBindWithMappingClosures(x.GoPointer(), KeyVar, ObjectVar.GoPointer(), PropertyVar, FlagsVar, GetMappingVar, SetMappingVar)
857
858}
859
860var xSettingsBindWritable func(uintptr, string, uintptr, string, bool)
861
862// Create a binding between the writability of @key in the
863// @settings object and the property @property of @object.
864//
865// The property must be boolean; `sensitive` or `visible`
866// properties of widgets are the most likely candidates.
867//
868// Writable bindings are always uni-directional; changes of the
869// writability of the setting will be propagated to the object
870// property, not the other way.
871//
872// When the @inverted argument is true, the binding inverts the
873// value as it passes from the setting to the object, i.e. @property
874// will be set to true if the key is not writable.
875//
876// Note that the lifecycle of the binding is tied to @object,
877// and that you can have only one binding per object property.
878// If you bind the same property twice on the same object, the second
879// binding overrides the first one.
880func (x *Settings) BindWritable(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, InvertedVar bool) {
881
882 xSettingsBindWritable(x.GoPointer(), KeyVar, ObjectVar.GoPointer(), PropertyVar, InvertedVar)
883
884}
885
886var xSettingsCreateAction func(uintptr, string) uintptr
887
888// Creates a [iface@Gio.Action] corresponding to a given [class@Gio.Settings] key.
889//
890// The action has the same name as the key.
891//
892// The value of the key becomes the state of the action and the action
893// is enabled when the key is writable. Changing the state of the
894// action results in the key being written to. Changes to the value or
895// writability of the key cause appropriate change notifications to be
896// emitted for the action.
897//
898// For boolean-valued keys, action activations take no parameter and
899// result in the toggling of the value. For all other types,
900// activations take the new value for the key (which must have the
901// correct type).
902func (x *Settings) CreateAction(KeyVar string) *ActionBase {
903 var cls *ActionBase
904
905 cret := xSettingsCreateAction(x.GoPointer(), KeyVar)
906
907 if cret == 0 {
908 return nil
909 }
910 cls = &ActionBase{}
911 cls.Ptr = cret
912 return cls
913}
914
915var xSettingsDelay func(uintptr)
916
917// Changes the [class@Gio.Settings] object into
918// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).
919//
920// In this
921// mode, changes to @settings are not immediately propagated to the
922// backend, but kept locally until [method@Gio.Settings.apply] is called.
923func (x *Settings) Delay() {
924
925 xSettingsDelay(x.GoPointer())
926
927}
928
929var xSettingsGet func(uintptr, string, string, ...interface{})
930
931// Gets the value that is stored at @key in @settings.
932//
933// A convenience function that combines [method@Gio.Settings.get_value] with
934// [method@GLib.Variant.get].
935//
936// It is a programmer error to give a @key that isn’t contained in the
937// schema for @settings or for the [struct@GLib.VariantType] of @format to mismatch
938// the type given in the schema.
939func (x *Settings) Get(KeyVar string, FormatVar string, varArgs ...interface{}) {
940
941 xSettingsGet(x.GoPointer(), KeyVar, FormatVar, varArgs...)
942
943}
944
945var xSettingsGetBoolean func(uintptr, string) bool
946
947// Gets the value that is stored at @key in @settings.
948//
949// A convenience variant of [method@Gio.Settings.get] for booleans.
950//
951// It is a programmer error to give a @key that isn’t specified as
952// having a `b` type in the schema for @settings (see [struct@GLib.VariantType]).
953func (x *Settings) GetBoolean(KeyVar string) bool {
954
955 cret := xSettingsGetBoolean(x.GoPointer(), KeyVar)
956 return cret
957}
958
959var xSettingsGetChild func(uintptr, string) uintptr
960
961// Creates a child settings object which has a base path of
962// `base-path/name`, where `base-path` is the base path of
963// @settings and `name` is as specified by the caller.
964//
965// The schema for the child settings object must have been declared
966// in the schema of @settings using a `<child>` element.
967//
968// The created child settings object will inherit the
969// [property@Gio.Settings:delay-apply] mode from @settings.
970func (x *Settings) GetChild(NameVar string) *Settings {
971 var cls *Settings
972
973 cret := xSettingsGetChild(x.GoPointer(), NameVar)
974
975 if cret == 0 {
976 return nil
977 }
978 cls = &Settings{}
979 cls.Ptr = cret
980 return cls
981}
982
983var xSettingsGetDefaultValue func(uintptr, string) *glib.Variant
984
985// Gets the ‘default value’ of a key.
986//
987// This is the value that would be read if [method@Gio.Settings.reset] were to be
988// called on the key.
989//
990// Note that this may be a different value than returned by
991// [method@Gio.SettingsSchemaKey.get_default_value] if the system administrator
992// has provided a default value.
993//
994// Comparing the return values of [method@Gio.Settings.get_default_value] and
995// [method@Gio.Settings.get_value] is not sufficient for determining if a value
996// has been set because the user may have explicitly set the value to
997// something that happens to be equal to the default. The difference
998// here is that if the default changes in the future, the user’s key
999// will still be set.
1000//
1001// This function may be useful for adding an indication to a UI of what
1002// the default value was before the user set it.
1003//
1004// It is a programmer error to give a @key that isn’t contained in the
1005// schema for @settings.
1006func (x *Settings) GetDefaultValue(KeyVar string) *glib.Variant {
1007
1008 cret := xSettingsGetDefaultValue(x.GoPointer(), KeyVar)
1009 return cret
1010}
1011
1012var xSettingsGetDouble func(uintptr, string) float64
1013
1014// Gets the value that is stored at @key in @settings.
1015//
1016// A convenience variant of [method@Gio.Settings.get] for doubles.
1017//
1018// It is a programmer error to give a @key that isn’t specified as
1019// having a `d` type in the schema for @settings (see [struct@GLib.VariantType]).
1020func (x *Settings) GetDouble(KeyVar string) float64 {
1021
1022 cret := xSettingsGetDouble(x.GoPointer(), KeyVar)
1023 return cret
1024}
1025
1026var xSettingsGetEnum func(uintptr, string) int
1027
1028// Gets the value that is stored in @settings for @key and converts it
1029// to the enum value that it represents.
1030//
1031// In order to use this function the type of the value must be a string
1032// and it must be marked in the schema file as an enumerated type.
1033//
1034// It is a programmer error to give a @key that isn’t contained in the
1035// schema for @settings or is not marked as an enumerated type.
1036//
1037// If the value stored in the configuration database is not a valid
1038// value for the enumerated type then this function will return the
1039// default value.
1040func (x *Settings) GetEnum(KeyVar string) int {
1041
1042 cret := xSettingsGetEnum(x.GoPointer(), KeyVar)
1043 return cret
1044}
1045
1046var xSettingsGetFlags func(uintptr, string) uint
1047
1048// Gets the value that is stored in @settings for @key and converts it
1049// to the flags value that it represents.
1050//
1051// In order to use this function the type of the value must be an array
1052// of strings and it must be marked in the schema file as a flags type.
1053//
1054// It is a programmer error to give a @key that isn’t contained in the
1055// schema for @settings or is not marked as a flags type.
1056//
1057// If the value stored in the configuration database is not a valid
1058// value for the flags type then this function will return the default
1059// value.
1060func (x *Settings) GetFlags(KeyVar string) uint {
1061
1062 cret := xSettingsGetFlags(x.GoPointer(), KeyVar)
1063 return cret
1064}
1065
1066var xSettingsGetHasUnapplied func(uintptr) bool
1067
1068// Returns whether the [class@Gio.Settings] object has any unapplied
1069// changes.
1070//
1071// This can only be the case if it is in
1072// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).
1073func (x *Settings) GetHasUnapplied() bool {
1074
1075 cret := xSettingsGetHasUnapplied(x.GoPointer())
1076 return cret
1077}
1078
1079var xSettingsGetInt func(uintptr, string) int
1080
1081// Gets the value that is stored at @key in @settings.
1082//
1083// A convenience variant of [method@Gio.Settings.get] for 32-bit integers.
1084//
1085// It is a programmer error to give a @key that isn’t specified as
1086// having an `i` type in the schema for @settings (see [struct@GLib.VariantType]).
1087func (x *Settings) GetInt(KeyVar string) int {
1088
1089 cret := xSettingsGetInt(x.GoPointer(), KeyVar)
1090 return cret
1091}
1092
1093var xSettingsGetInt64 func(uintptr, string) int64
1094
1095// Gets the value that is stored at @key in @settings.
1096//
1097// A convenience variant of [method@Gio.Settings.get] for 64-bit integers.
1098//
1099// It is a programmer error to give a @key that isn’t specified as
1100// having an `x` type in the schema for @settings (see [struct@GLib.VariantType]).
1101func (x *Settings) GetInt64(KeyVar string) int64 {
1102
1103 cret := xSettingsGetInt64(x.GoPointer(), KeyVar)
1104 return cret
1105}
1106
1107var xSettingsGetMapped func(uintptr, string, uintptr, uintptr) uintptr
1108
1109// Gets the value that is stored at @key in @settings, subject to
1110// application-level validation/mapping.
1111//
1112// You should use this function when the application needs to perform
1113// some processing on the value of the key (for example, parsing). The
1114// @mapping function performs that processing. If the function
1115// indicates that the processing was unsuccessful (due to a parse error,
1116// for example) then the mapping is tried again with another value.
1117//
1118// This allows a robust ‘fall back to defaults’ behaviour to be
1119// implemented somewhat automatically.
1120//
1121// The first value that is tried is the user’s setting for the key. If
1122// the mapping function fails to map this value, other values may be
1123// tried in an unspecified order (system or site defaults, translated
1124// schema default values, untranslated schema default values, etc).
1125//
1126// If the mapping function fails for all possible values, one additional
1127// attempt is made: the mapping function is called with a `NULL` value.
1128// If the mapping function still indicates failure at this point then
1129// the application will be aborted.
1130//
1131// The result parameter for the @mapping function is pointed to a
1132// `gpointer` which is initially set to `NULL`. The same pointer is given
1133// to each invocation of @mapping. The final value of that `gpointer` is
1134// what is returned by this function. `NULL` is valid; it is returned
1135// just as any other value would be.
1136func (x *Settings) GetMapped(KeyVar string, MappingVar *SettingsGetMapping, UserDataVar uintptr) uintptr {
1137
1138 var MappingVarRef uintptr
1139 if MappingVar != nil {
1140 MappingVarPtr := uintptr(unsafe.Pointer(MappingVar))
1141 if cbRefPtr, ok := glib.GetCallback(MappingVarPtr); ok {
1142 MappingVarRef = cbRefPtr
1143 } else {
1144 fcb := func(arg0 *glib.Variant, arg1 *uintptr, arg2 uintptr) bool {
1145 cbFn := *MappingVar
1146 return cbFn(arg0, arg1, arg2)
1147 }
1148 MappingVarRef = purego.NewCallback(fcb)
1149 glib.SaveCallbackWithClosure(MappingVarPtr, MappingVarRef, MappingVar)
1150 }
1151 }
1152
1153 cret := xSettingsGetMapped(x.GoPointer(), KeyVar, MappingVarRef, UserDataVar)
1154 return cret
1155}
1156
1157var xSettingsGetRange func(uintptr, string) *glib.Variant
1158
1159// Queries the range of a key.
1160func (x *Settings) GetRange(KeyVar string) *glib.Variant {
1161
1162 cret := xSettingsGetRange(x.GoPointer(), KeyVar)
1163 return cret
1164}
1165
1166var xSettingsGetString func(uintptr, string) string
1167
1168// Gets the value that is stored at @key in @settings.
1169//
1170// A convenience variant of [method@Gio.Settings.get] for strings.
1171//
1172// It is a programmer error to give a @key that isn’t specified as
1173// having an `s` type in the schema for @settings (see [struct@GLib.VariantType]).
1174func (x *Settings) GetString(KeyVar string) string {
1175
1176 cret := xSettingsGetString(x.GoPointer(), KeyVar)
1177 return cret
1178}
1179
1180var xSettingsGetStrv func(uintptr, string) []string
1181
1182// A convenience variant of [method@Gio.Settings.get] for string arrays.
1183//
1184// It is a programmer error to give a @key that isn’t specified as
1185// having an `as` type in the schema for @settings (see [struct@GLib.VariantType]).
1186func (x *Settings) GetStrv(KeyVar string) []string {
1187
1188 cret := xSettingsGetStrv(x.GoPointer(), KeyVar)
1189 return cret
1190}
1191
1192var xSettingsGetUint func(uintptr, string) uint
1193
1194// Gets the value that is stored at @key in @settings.
1195//
1196// A convenience variant of [method@Gio.Settings.get] for 32-bit unsigned
1197// integers.
1198//
1199// It is a programmer error to give a @key that isn’t specified as
1200// having a `u` type in the schema for @settings (see [struct@GLib.VariantType]).
1201func (x *Settings) GetUint(KeyVar string) uint {
1202
1203 cret := xSettingsGetUint(x.GoPointer(), KeyVar)
1204 return cret
1205}
1206
1207var xSettingsGetUint64 func(uintptr, string) uint64
1208
1209// Gets the value that is stored at @key in @settings.
1210//
1211// A convenience variant of [method@Gio.Settings.get] for 64-bit unsigned
1212// integers.
1213//
1214// It is a programmer error to give a @key that isn’t specified as
1215// having a `t` type in the schema for @settings (see [struct@GLib.VariantType]).
1216func (x *Settings) GetUint64(KeyVar string) uint64 {
1217
1218 cret := xSettingsGetUint64(x.GoPointer(), KeyVar)
1219 return cret
1220}
1221
1222var xSettingsGetUserValue func(uintptr, string) *glib.Variant
1223
1224// Checks the ‘user value’ of a key, if there is one.
1225//
1226// The user value of a key is the last value that was set by the user.
1227//
1228// After calling [method@Gio.Settings.reset] this function should always return
1229// `NULL` (assuming something is not wrong with the system
1230// configuration).
1231//
1232// It is possible that [method@Gio.Settings.get_value] will return a different
1233// value than this function. This can happen in the case that the user
1234// set a value for a key that was subsequently locked down by the system
1235// administrator — this function will return the user’s old value.
1236//
1237// This function may be useful for adding a ‘reset’ option to a UI or
1238// for providing indication that a particular value has been changed.
1239//
1240// It is a programmer error to give a @key that isn’t contained in the
1241// schema for @settings.
1242func (x *Settings) GetUserValue(KeyVar string) *glib.Variant {
1243
1244 cret := xSettingsGetUserValue(x.GoPointer(), KeyVar)
1245 return cret
1246}
1247
1248var xSettingsGetValue func(uintptr, string) *glib.Variant
1249
1250// Gets the value that is stored in @settings for @key.
1251//
1252// It is a programmer error to give a @key that isn’t contained in the
1253// schema for @settings.
1254func (x *Settings) GetValue(KeyVar string) *glib.Variant {
1255
1256 cret := xSettingsGetValue(x.GoPointer(), KeyVar)
1257 return cret
1258}
1259
1260var xSettingsIsWritable func(uintptr, string) bool
1261
1262// Finds out if a key can be written.
1263func (x *Settings) IsWritable(NameVar string) bool {
1264
1265 cret := xSettingsIsWritable(x.GoPointer(), NameVar)
1266 return cret
1267}
1268
1269var xSettingsListChildren func(uintptr) []string
1270
1271// Gets the list of children on @settings.
1272//
1273// The list is exactly the list of strings for which it is not an error
1274// to call [method@Gio.Settings.get_child].
1275//
1276// There is little reason to call this function from ‘normal’ code, since
1277// you should already know what children are in your schema. This function
1278// may still be useful there for introspection reasons, however.
1279//
1280// You should free the return value with [func@GLib.strfreev] when you are done
1281// with it.
1282func (x *Settings) ListChildren() []string {
1283
1284 cret := xSettingsListChildren(x.GoPointer())
1285 return cret
1286}
1287
1288var xSettingsListKeys func(uintptr) []string
1289
1290// Introspects the list of keys on @settings.
1291//
1292// You should probably not be calling this function from ‘normal’ code
1293// (since you should already know what keys are in your schema). This
1294// function is intended for introspection reasons.
1295//
1296// You should free the return value with [func@GLib.strfreev] when you are done
1297// with it.
1298func (x *Settings) ListKeys() []string {
1299
1300 cret := xSettingsListKeys(x.GoPointer())
1301 return cret
1302}
1303
1304var xSettingsRangeCheck func(uintptr, string, *glib.Variant) bool
1305
1306// Checks if the given @value is of the correct type and within the
1307// permitted range for @key.
1308func (x *Settings) RangeCheck(KeyVar string, ValueVar *glib.Variant) bool {
1309
1310 cret := xSettingsRangeCheck(x.GoPointer(), KeyVar, ValueVar)
1311 return cret
1312}
1313
1314var xSettingsReset func(uintptr, string)
1315
1316// Resets @key to its default value.
1317//
1318// This call resets the key, as much as possible, to its default value.
1319// That might be the value specified in the schema or the one set by the
1320// administrator.
1321func (x *Settings) Reset(KeyVar string) {
1322
1323 xSettingsReset(x.GoPointer(), KeyVar)
1324
1325}
1326
1327var xSettingsRevert func(uintptr)
1328
1329// Reverts all unapplied changes to the settings.
1330//
1331// This function does nothing unless @settings is in
1332// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode). In the normal
1333// case settings are always applied immediately.
1334//
1335// Change notifications will be emitted for affected keys.
1336func (x *Settings) Revert() {
1337
1338 xSettingsRevert(x.GoPointer())
1339
1340}
1341
1342var xSettingsSet func(uintptr, string, string, ...interface{}) bool
1343
1344// Sets @key in @settings to @value.
1345//
1346// A convenience function that combines [method@Gio.Settings.set_value] with
1347// [ctor@GLib.Variant.new].
1348//
1349// It is a programmer error to give a @key that isn’t contained in the
1350// schema for @settings or for the [struct@GLib.VariantType] of @format to mismatch
1351// the type given in the schema.
1352func (x *Settings) Set(KeyVar string, FormatVar string, varArgs ...interface{}) bool {
1353
1354 cret := xSettingsSet(x.GoPointer(), KeyVar, FormatVar, varArgs...)
1355 return cret
1356}
1357
1358var xSettingsSetBoolean func(uintptr, string, bool) bool
1359
1360// Sets @key in @settings to @value.
1361//
1362// A convenience variant of [method@Gio.Settings.set] for booleans.
1363//
1364// It is a programmer error to give a @key that isn’t specified as
1365// having a `b` type in the schema for @settings (see [struct@GLib.VariantType]).
1366func (x *Settings) SetBoolean(KeyVar string, ValueVar bool) bool {
1367
1368 cret := xSettingsSetBoolean(x.GoPointer(), KeyVar, ValueVar)
1369 return cret
1370}
1371
1372var xSettingsSetDouble func(uintptr, string, float64) bool
1373
1374// Sets @key in @settings to @value.
1375//
1376// A convenience variant of [method@Gio.Settings.set] for doubles.
1377//
1378// It is a programmer error to give a @key that isn’t specified as
1379// having a `d` type in the schema for @settings (see [struct@GLib.VariantType]).
1380func (x *Settings) SetDouble(KeyVar string, ValueVar float64) bool {
1381
1382 cret := xSettingsSetDouble(x.GoPointer(), KeyVar, ValueVar)
1383 return cret
1384}
1385
1386var xSettingsSetEnum func(uintptr, string, int) bool
1387
1388// Looks up the enumerated type nick for @value and writes it to @key,
1389// within @settings.
1390//
1391// It is a programmer error to give a @key that isn’t contained in the
1392// schema for @settings or is not marked as an enumerated type, or for
1393// @value not to be a valid value for the named type.
1394//
1395// After performing the write, accessing @key directly with
1396// [method@Gio.Settings.get_string] will return the ‘nick’ associated with
1397// @value.
1398func (x *Settings) SetEnum(KeyVar string, ValueVar int) bool {
1399
1400 cret := xSettingsSetEnum(x.GoPointer(), KeyVar, ValueVar)
1401 return cret
1402}
1403
1404var xSettingsSetFlags func(uintptr, string, uint) bool
1405
1406// Looks up the flags type nicks for the bits specified by @value, puts
1407// them in an array of strings and writes the array to @key, within
1408// @settings.
1409//
1410// It is a programmer error to give a @key that isn’t contained in the
1411// schema for @settings or is not marked as a flags type, or for @value
1412// to contain any bits that are not value for the named type.
1413//
1414// After performing the write, accessing @key directly with
1415// [method@Gio.Settings.get_strv] will return an array of ‘nicks’; one for each
1416// bit in @value.
1417func (x *Settings) SetFlags(KeyVar string, ValueVar uint) bool {
1418
1419 cret := xSettingsSetFlags(x.GoPointer(), KeyVar, ValueVar)
1420 return cret
1421}
1422
1423var xSettingsSetInt func(uintptr, string, int) bool
1424
1425// Sets @key in @settings to @value.
1426//
1427// A convenience variant of [method@Gio.Settings.set] for 32-bit integers.
1428//
1429// It is a programmer error to give a @key that isn’t specified as
1430// having an `i` type in the schema for @settings (see [struct@GLib.VariantType]).
1431func (x *Settings) SetInt(KeyVar string, ValueVar int) bool {
1432
1433 cret := xSettingsSetInt(x.GoPointer(), KeyVar, ValueVar)
1434 return cret
1435}
1436
1437var xSettingsSetInt64 func(uintptr, string, int64) bool
1438
1439// Sets @key in @settings to @value.
1440//
1441// A convenience variant of [method@Gio.Settings.set] for 64-bit integers.
1442//
1443// It is a programmer error to give a @key that isn’t specified as
1444// having an `x` type in the schema for @settings (see [struct@GLib.VariantType]).
1445func (x *Settings) SetInt64(KeyVar string, ValueVar int64) bool {
1446
1447 cret := xSettingsSetInt64(x.GoPointer(), KeyVar, ValueVar)
1448 return cret
1449}
1450
1451var xSettingsSetString func(uintptr, string, string) bool
1452
1453// Sets @key in @settings to @value.
1454//
1455// A convenience variant of [method@Gio.Settings.set] for strings.
1456//
1457// It is a programmer error to give a @key that isn’t specified as
1458// having an `s` type in the schema for @settings (see [struct@GLib.VariantType]).
1459func (x *Settings) SetString(KeyVar string, ValueVar string) bool {
1460
1461 cret := xSettingsSetString(x.GoPointer(), KeyVar, ValueVar)
1462 return cret
1463}
1464
1465var xSettingsSetStrv func(uintptr, string, []string) bool
1466
1467// Sets @key in @settings to @value.
1468//
1469// A convenience variant of [method@Gio.Settings.set] for string arrays. If
1470// @value is `NULL`, then @key is set to be the empty array.
1471//
1472// It is a programmer error to give a @key that isn’t specified as
1473// having an `as` type in the schema for @settings (see [struct@GLib.VariantType]).
1474func (x *Settings) SetStrv(KeyVar string, ValueVar []string) bool {
1475
1476 cret := xSettingsSetStrv(x.GoPointer(), KeyVar, ValueVar)
1477 return cret
1478}
1479
1480var xSettingsSetUint func(uintptr, string, uint) bool
1481
1482// Sets @key in @settings to @value.
1483//
1484// A convenience variant of [method@Gio.Settings.set] for 32-bit unsigned
1485// integers.
1486//
1487// It is a programmer error to give a @key that isn’t specified as
1488// having a `u` type in the schema for @settings (see [struct@GLib.VariantType]).
1489func (x *Settings) SetUint(KeyVar string, ValueVar uint) bool {
1490
1491 cret := xSettingsSetUint(x.GoPointer(), KeyVar, ValueVar)
1492 return cret
1493}
1494
1495var xSettingsSetUint64 func(uintptr, string, uint64) bool
1496
1497// Sets @key in @settings to @value.
1498//
1499// A convenience variant of [method@Gio.Settings.set] for 64-bit unsigned
1500// integers.
1501//
1502// It is a programmer error to give a @key that isn’t specified as
1503// having a `t` type in the schema for @settings (see [struct@GLib.VariantType]).
1504func (x *Settings) SetUint64(KeyVar string, ValueVar uint64) bool {
1505
1506 cret := xSettingsSetUint64(x.GoPointer(), KeyVar, ValueVar)
1507 return cret
1508}
1509
1510var xSettingsSetValue func(uintptr, string, *glib.Variant) bool
1511
1512// Sets @key in @settings to @value.
1513//
1514// It is a programmer error to give a @key that isn’t contained in the
1515// schema for @settings or for @value to have the incorrect type, per
1516// the schema.
1517//
1518// If @value is floating then this function consumes the reference.
1519func (x *Settings) SetValue(KeyVar string, ValueVar *glib.Variant) bool {
1520
1521 cret := xSettingsSetValue(x.GoPointer(), KeyVar, ValueVar)
1522 return cret
1523}
1524
1525func (c *Settings) GoPointer() uintptr {
1526 if c == nil {
1527 return 0
1528 }
1529 return c.Ptr
1530}
1531
1532func (c *Settings) SetGoPointer(ptr uintptr) {
1533 c.Ptr = ptr
1534}
1535
1536// GetPropertyDelayApply gets the "delay-apply" property.
1537// Whether the [class@Gio.Settings] object is in
1538// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).
1539func (x *Settings) GetPropertyDelayApply() bool {
1540 var v gobject.Value
1541 x.GetProperty("delay-apply", &v)
1542 return v.GetBoolean()
1543}
1544
1545// GetPropertyHasUnapplied gets the "has-unapplied" property.
1546// Whether the [class@Gio.Settings] object has outstanding changes.
1547//
1548// These changes will be applied when [method@Gio.Settings.apply] is called.
1549func (x *Settings) GetPropertyHasUnapplied() bool {
1550 var v gobject.Value
1551 x.GetProperty("has-unapplied", &v)
1552 return v.GetBoolean()
1553}
1554
1555// SetPropertyPath sets the "path" property.
1556// The path within the backend where the settings are stored.
1557func (x *Settings) SetPropertyPath(value string) {
1558 var v gobject.Value
1559 v.Init(gobject.TypeStringVal)
1560 v.SetString(&value)
1561 x.SetProperty("path", &v)
1562}
1563
1564// GetPropertyPath gets the "path" property.
1565// The path within the backend where the settings are stored.
1566func (x *Settings) GetPropertyPath() string {
1567 var v gobject.Value
1568 x.GetProperty("path", &v)
1569 return v.GetString()
1570}
1571
1572// SetPropertySchema sets the "schema" property.
1573// The name of the schema that describes the types of keys
1574// for this [class@Gio.Settings] object.
1575//
1576// The type of this property is *not* [struct@Gio.SettingsSchema].
1577// [struct@Gio.SettingsSchema] has only existed since version 2.32 and
1578// unfortunately this name was used in previous versions to refer to
1579// the schema ID rather than the schema itself. Take care to use the
1580// [property@Gio.Settings:settings-schema] property if you wish to pass in a
1581// [struct@Gio.SettingsSchema].
1582func (x *Settings) SetPropertySchema(value string) {
1583 var v gobject.Value
1584 v.Init(gobject.TypeStringVal)
1585 v.SetString(&value)
1586 x.SetProperty("schema", &v)
1587}
1588
1589// GetPropertySchema gets the "schema" property.
1590// The name of the schema that describes the types of keys
1591// for this [class@Gio.Settings] object.
1592//
1593// The type of this property is *not* [struct@Gio.SettingsSchema].
1594// [struct@Gio.SettingsSchema] has only existed since version 2.32 and
1595// unfortunately this name was used in previous versions to refer to
1596// the schema ID rather than the schema itself. Take care to use the
1597// [property@Gio.Settings:settings-schema] property if you wish to pass in a
1598// [struct@Gio.SettingsSchema].
1599func (x *Settings) GetPropertySchema() string {
1600 var v gobject.Value
1601 x.GetProperty("schema", &v)
1602 return v.GetString()
1603}
1604
1605// SetPropertySchemaId sets the "schema-id" property.
1606// The name of the schema that describes the types of keys
1607// for this [class@Gio.Settings] object.
1608func (x *Settings) SetPropertySchemaId(value string) {
1609 var v gobject.Value
1610 v.Init(gobject.TypeStringVal)
1611 v.SetString(&value)
1612 x.SetProperty("schema-id", &v)
1613}
1614
1615// GetPropertySchemaId gets the "schema-id" property.
1616// The name of the schema that describes the types of keys
1617// for this [class@Gio.Settings] object.
1618func (x *Settings) GetPropertySchemaId() string {
1619 var v gobject.Value
1620 x.GetProperty("schema-id", &v)
1621 return v.GetString()
1622}
1623
1624// SetPropertySettingsSchema sets the "settings-schema" property.
1625// The [struct@Gio.SettingsSchema] describing the types of keys for this
1626// [class@Gio.Settings] object.
1627//
1628// Ideally, this property would be called [property@Gio.Settings:schema].
1629// [struct@Gio.SettingsSchema]
1630// has only existed since version 2.32, however, and before then the
1631// [property@Gio.Settings:schema] property was used to refer to the ID of the schema rather
1632// than the schema itself. Take care.
1633func (x *Settings) SetPropertySettingsSchema(value uintptr) {
1634 var v gobject.Value
1635 v.Init(gobject.TypePointerVal)
1636 v.SetPointer(value)
1637 x.SetProperty("settings-schema", &v)
1638}
1639
1640// GetPropertySettingsSchema gets the "settings-schema" property.
1641// The [struct@Gio.SettingsSchema] describing the types of keys for this
1642// [class@Gio.Settings] object.
1643//
1644// Ideally, this property would be called [property@Gio.Settings:schema].
1645// [struct@Gio.SettingsSchema]
1646// has only existed since version 2.32, however, and before then the
1647// [property@Gio.Settings:schema] property was used to refer to the ID of the schema rather
1648// than the schema itself. Take care.
1649func (x *Settings) GetPropertySettingsSchema() uintptr {
1650 var v gobject.Value
1651 x.GetProperty("settings-schema", &v)
1652 return v.GetPointer()
1653}
1654
1655// Emitted once per change event that affects this settings object.
1656//
1657// You should connect to this signal
1658// only if you are interested in viewing groups of changes before they
1659// are split out into multiple emissions of the [signal@Gio.Settings::changed] signal.
1660// For most use cases it is more appropriate to use the [signal@Gio.Settings::changed] signal.
1661//
1662// In the event that the change event applies to one or more specified
1663// keys, @keys will be an array of [alias@GLib.Quark]s of length @n_keys. In the
1664// event that the change event applies to the [class@Gio.Settings] object as a
1665// whole (ie: potentially every key has been changed) then @keys will
1666// be `NULL` and @n_keys will be `0`.
1667//
1668// The default handler for this signal invokes the [signal@Gio.Settings::changed] signal
1669// for each affected key. If any other connected handler returns
1670// true then this default functionality will be suppressed.
1671func (x *Settings) ConnectChangeEvent(cb *func(Settings, uintptr, int) bool) uint {
1672 cbPtr := uintptr(unsafe.Pointer(cb))
1673 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1674 handlerID := gobject.SignalConnect(x.GoPointer(), "change-event", cbRefPtr)
1675 glib.SaveHandlerMapping(handlerID, cbPtr)
1676 return handlerID
1677 }
1678
1679 fcb := func(clsPtr uintptr, KeysVarp uintptr, NKeysVarp int) bool {
1680 fa := Settings{}
1681 fa.Ptr = clsPtr
1682 cbFn := *cb
1683
1684 return cbFn(fa, KeysVarp, NKeysVarp)
1685
1686 }
1687 cbRefPtr := purego.NewCallback(fcb)
1688 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1689 handlerID := gobject.SignalConnect(x.GoPointer(), "change-event", cbRefPtr)
1690 glib.SaveHandlerMapping(handlerID, cbPtr)
1691 return handlerID
1692}
1693
1694// Emitted when a key has potentially changed.
1695//
1696// You should call one of the [method@Gio.Settings.get] calls to check the new
1697// value.
1698//
1699// This signal supports detailed connections. You can connect to the
1700// detailed signal `changed::x` in order to only receive callbacks
1701// when key `x` changes.
1702//
1703// Note that @settings only emits this signal if you have read @key at
1704// least once while a signal handler was already connected for @key.
1705func (x *Settings) ConnectChanged(cb *func(Settings, string)) uint {
1706 cbPtr := uintptr(unsafe.Pointer(cb))
1707 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1708 handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
1709 glib.SaveHandlerMapping(handlerID, cbPtr)
1710 return handlerID
1711 }
1712
1713 fcb := func(clsPtr uintptr, KeyVarp uintptr) {
1714 fa := Settings{}
1715 fa.Ptr = clsPtr
1716 cbFn := *cb
1717
1718 cbFn(fa, core.GoString(KeyVarp))
1719
1720 }
1721 cbRefPtr := purego.NewCallback(fcb)
1722 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1723 handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
1724 glib.SaveHandlerMapping(handlerID, cbPtr)
1725 return handlerID
1726}
1727
1728// ConnectChangedWithDetail connects to the "changed" signal with a detail string.
1729// The detail is appended as "changed::<detail>".
1730func (x *Settings) ConnectChangedWithDetail(detail string, cb *func(Settings, string)) uint {
1731 cbPtr := uintptr(unsafe.Pointer(cb))
1732 signalName := fmt.Sprintf("changed::%s", detail)
1733 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1734 handlerID := gobject.SignalConnect(x.GoPointer(), signalName, cbRefPtr)
1735 glib.SaveHandlerMapping(handlerID, cbPtr)
1736 return handlerID
1737 }
1738
1739 fcb := func(clsPtr uintptr, KeyVarp uintptr) {
1740 fa := Settings{}
1741 fa.Ptr = clsPtr
1742 cbFn := *cb
1743
1744 cbFn(fa, core.GoString(KeyVarp))
1745
1746 }
1747 cbRefPtr := purego.NewCallback(fcb)
1748 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1749 handlerID := gobject.SignalConnect(x.GoPointer(), signalName, cbRefPtr)
1750 glib.SaveHandlerMapping(handlerID, cbPtr)
1751 return handlerID
1752}
1753
1754// Emitted once per writability change event that affects this settings object.
1755//
1756// You should connect
1757// to this signal if you are interested in viewing groups of changes
1758// before they are split out into multiple emissions of the
1759// [signal@Gio.Settings::writable-changed] signal. For most use cases it is more
1760// appropriate to use the [signal@Gio.Settings::writable-changed] signal.
1761//
1762// In the event that the writability change applies only to a single
1763// key, @key will be set to the [alias@GLib.Quark] for that key. In the event
1764// that the writability change affects the entire settings object,
1765// @key will be `0`.
1766//
1767// The default handler for this signal invokes the [signal@Gio.Settings::writable-changed]
1768// and [signal@Gio.Settings::changed] signals for each affected key. This is done because
1769// changes in writability might also imply changes in value (if for
1770// example, a new mandatory setting is introduced). If any other
1771// connected handler returns true then this default functionality
1772// will be suppressed.
1773func (x *Settings) ConnectWritableChangeEvent(cb *func(Settings, uint) bool) uint {
1774 cbPtr := uintptr(unsafe.Pointer(cb))
1775 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1776 handlerID := gobject.SignalConnect(x.GoPointer(), "writable-change-event", cbRefPtr)
1777 glib.SaveHandlerMapping(handlerID, cbPtr)
1778 return handlerID
1779 }
1780
1781 fcb := func(clsPtr uintptr, KeyVarp uint) bool {
1782 fa := Settings{}
1783 fa.Ptr = clsPtr
1784 cbFn := *cb
1785
1786 return cbFn(fa, KeyVarp)
1787
1788 }
1789 cbRefPtr := purego.NewCallback(fcb)
1790 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1791 handlerID := gobject.SignalConnect(x.GoPointer(), "writable-change-event", cbRefPtr)
1792 glib.SaveHandlerMapping(handlerID, cbPtr)
1793 return handlerID
1794}
1795
1796// Emitted when the writability of a key has potentially changed.
1797//
1798// You should call [method@Gio.Settings.is_writable] in order to determine the
1799// new status.
1800//
1801// This signal supports detailed connections. You can connect to the
1802// detailed signal `writable-changed::x` in order to only receive
1803// callbacks when the writability of `x` changes.
1804func (x *Settings) ConnectWritableChanged(cb *func(Settings, string)) uint {
1805 cbPtr := uintptr(unsafe.Pointer(cb))
1806 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1807 handlerID := gobject.SignalConnect(x.GoPointer(), "writable-changed", cbRefPtr)
1808 glib.SaveHandlerMapping(handlerID, cbPtr)
1809 return handlerID
1810 }
1811
1812 fcb := func(clsPtr uintptr, KeyVarp uintptr) {
1813 fa := Settings{}
1814 fa.Ptr = clsPtr
1815 cbFn := *cb
1816
1817 cbFn(fa, core.GoString(KeyVarp))
1818
1819 }
1820 cbRefPtr := purego.NewCallback(fcb)
1821 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1822 handlerID := gobject.SignalConnect(x.GoPointer(), "writable-changed", cbRefPtr)
1823 glib.SaveHandlerMapping(handlerID, cbPtr)
1824 return handlerID
1825}
1826
1827// ConnectWritableChangedWithDetail connects to the "writable-changed" signal with a detail string.
1828// The detail is appended as "writable-changed::<detail>".
1829func (x *Settings) ConnectWritableChangedWithDetail(detail string, cb *func(Settings, string)) uint {
1830 cbPtr := uintptr(unsafe.Pointer(cb))
1831 signalName := fmt.Sprintf("writable-changed::%s", detail)
1832 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
1833 handlerID := gobject.SignalConnect(x.GoPointer(), signalName, cbRefPtr)
1834 glib.SaveHandlerMapping(handlerID, cbPtr)
1835 return handlerID
1836 }
1837
1838 fcb := func(clsPtr uintptr, KeyVarp uintptr) {
1839 fa := Settings{}
1840 fa.Ptr = clsPtr
1841 cbFn := *cb
1842
1843 cbFn(fa, core.GoString(KeyVarp))
1844
1845 }
1846 cbRefPtr := purego.NewCallback(fcb)
1847 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
1848 handlerID := gobject.SignalConnect(x.GoPointer(), signalName, cbRefPtr)
1849 glib.SaveHandlerMapping(handlerID, cbPtr)
1850 return handlerID
1851}
1852
1853var xSettingsListRelocatableSchemas func() []string
1854
1855// Deprecated.
1856func SettingsListRelocatableSchemas() []string {
1857
1858 cret := xSettingsListRelocatableSchemas()
1859 return cret
1860}
1861
1862var xSettingsListSchemas func() []string
1863
1864// Deprecated.
1865func SettingsListSchemas() []string {
1866
1867 cret := xSettingsListSchemas()
1868 return cret
1869}
1870
1871var xSettingsSync func()
1872
1873// Ensures that all pending operations are complete for the default backend.
1874//
1875// Writes made to a [class@Gio.Settings] are handled asynchronously. For this
1876// reason, it is very unlikely that the changes have it to disk by the
1877// time [method@Gio.Settings.set] returns.
1878//
1879// This call will block until all of the writes have made it to the
1880// backend. Since the main loop is not running, no change notifications
1881// will be dispatched during this call (but some may be queued by the
1882// time the call is done).
1883func SettingsSync() {
1884
1885 xSettingsSync()
1886
1887}
1888
1889var xSettingsUnbind func(uintptr, string)
1890
1891// Removes an existing binding for @property on @object.
1892//
1893// Note that bindings are automatically removed when the
1894// object is finalized, so it is rarely necessary to call this
1895// function.
1896func SettingsUnbind(ObjectVar *gobject.Object, PropertyVar string) {
1897
1898 xSettingsUnbind(ObjectVar.GoPointer(), PropertyVar)
1899
1900}
1901
1902func init() {
1903 core.SetPackageName("GIO", "gio-2.0")
1904 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
1905 var libs []uintptr
1906 for _, libPath := range core.GetPaths("GIO") {
1907 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1908 if err != nil {
1909 panic(err)
1910 }
1911 libs = append(libs, lib)
1912 }
1913
1914 core.PuregoSafeRegister(&xSettingsBindFlagsGLibType, libs, "g_settings_bind_flags_get_type")
1915
1916 core.PuregoSafeRegister(&xSettingsGLibType, libs, "g_settings_get_type")
1917
1918 core.PuregoSafeRegister(&xNewSettings, libs, "g_settings_new")
1919 core.PuregoSafeRegister(&xNewSettingsFull, libs, "g_settings_new_full")
1920 core.PuregoSafeRegister(&xNewSettingsWithBackend, libs, "g_settings_new_with_backend")
1921 core.PuregoSafeRegister(&xNewSettingsWithBackendAndPath, libs, "g_settings_new_with_backend_and_path")
1922 core.PuregoSafeRegister(&xNewSettingsWithPath, libs, "g_settings_new_with_path")
1923
1924 core.PuregoSafeRegister(&xSettingsApply, libs, "g_settings_apply")
1925 core.PuregoSafeRegister(&xSettingsBind, libs, "g_settings_bind")
1926 core.PuregoSafeRegister(&xSettingsBindWithMapping, libs, "g_settings_bind_with_mapping")
1927 core.PuregoSafeRegister(&xSettingsBindWithMappingClosures, libs, "g_settings_bind_with_mapping_closures")
1928 core.PuregoSafeRegister(&xSettingsBindWritable, libs, "g_settings_bind_writable")
1929 core.PuregoSafeRegister(&xSettingsCreateAction, libs, "g_settings_create_action")
1930 core.PuregoSafeRegister(&xSettingsDelay, libs, "g_settings_delay")
1931 core.PuregoSafeRegister(&xSettingsGet, libs, "g_settings_get")
1932 core.PuregoSafeRegister(&xSettingsGetBoolean, libs, "g_settings_get_boolean")
1933 core.PuregoSafeRegister(&xSettingsGetChild, libs, "g_settings_get_child")
1934 core.PuregoSafeRegister(&xSettingsGetDefaultValue, libs, "g_settings_get_default_value")
1935 core.PuregoSafeRegister(&xSettingsGetDouble, libs, "g_settings_get_double")
1936 core.PuregoSafeRegister(&xSettingsGetEnum, libs, "g_settings_get_enum")
1937 core.PuregoSafeRegister(&xSettingsGetFlags, libs, "g_settings_get_flags")
1938 core.PuregoSafeRegister(&xSettingsGetHasUnapplied, libs, "g_settings_get_has_unapplied")
1939 core.PuregoSafeRegister(&xSettingsGetInt, libs, "g_settings_get_int")
1940 core.PuregoSafeRegister(&xSettingsGetInt64, libs, "g_settings_get_int64")
1941 core.PuregoSafeRegister(&xSettingsGetMapped, libs, "g_settings_get_mapped")
1942 core.PuregoSafeRegister(&xSettingsGetRange, libs, "g_settings_get_range")
1943 core.PuregoSafeRegister(&xSettingsGetString, libs, "g_settings_get_string")
1944 core.PuregoSafeRegister(&xSettingsGetStrv, libs, "g_settings_get_strv")
1945 core.PuregoSafeRegister(&xSettingsGetUint, libs, "g_settings_get_uint")
1946 core.PuregoSafeRegister(&xSettingsGetUint64, libs, "g_settings_get_uint64")
1947 core.PuregoSafeRegister(&xSettingsGetUserValue, libs, "g_settings_get_user_value")
1948 core.PuregoSafeRegister(&xSettingsGetValue, libs, "g_settings_get_value")
1949 core.PuregoSafeRegister(&xSettingsIsWritable, libs, "g_settings_is_writable")
1950 core.PuregoSafeRegister(&xSettingsListChildren, libs, "g_settings_list_children")
1951 core.PuregoSafeRegister(&xSettingsListKeys, libs, "g_settings_list_keys")
1952 core.PuregoSafeRegister(&xSettingsRangeCheck, libs, "g_settings_range_check")
1953 core.PuregoSafeRegister(&xSettingsReset, libs, "g_settings_reset")
1954 core.PuregoSafeRegister(&xSettingsRevert, libs, "g_settings_revert")
1955 core.PuregoSafeRegister(&xSettingsSet, libs, "g_settings_set")
1956 core.PuregoSafeRegister(&xSettingsSetBoolean, libs, "g_settings_set_boolean")
1957 core.PuregoSafeRegister(&xSettingsSetDouble, libs, "g_settings_set_double")
1958 core.PuregoSafeRegister(&xSettingsSetEnum, libs, "g_settings_set_enum")
1959 core.PuregoSafeRegister(&xSettingsSetFlags, libs, "g_settings_set_flags")
1960 core.PuregoSafeRegister(&xSettingsSetInt, libs, "g_settings_set_int")
1961 core.PuregoSafeRegister(&xSettingsSetInt64, libs, "g_settings_set_int64")
1962 core.PuregoSafeRegister(&xSettingsSetString, libs, "g_settings_set_string")
1963 core.PuregoSafeRegister(&xSettingsSetStrv, libs, "g_settings_set_strv")
1964 core.PuregoSafeRegister(&xSettingsSetUint, libs, "g_settings_set_uint")
1965 core.PuregoSafeRegister(&xSettingsSetUint64, libs, "g_settings_set_uint64")
1966 core.PuregoSafeRegister(&xSettingsSetValue, libs, "g_settings_set_value")
1967
1968 core.PuregoSafeRegister(&xSettingsListRelocatableSchemas, libs, "g_settings_list_relocatable_schemas")
1969 core.PuregoSafeRegister(&xSettingsListSchemas, libs, "g_settings_list_schemas")
1970 core.PuregoSafeRegister(&xSettingsSync, libs, "g_settings_sync")
1971 core.PuregoSafeRegister(&xSettingsUnbind, libs, "g_settings_unbind")
1972
1973}