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