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
749mod sealed {
750 pub trait Sealed {}
751 impl<T: super::IsA<super::Settings>> Sealed for T {}
752}
753
754/// Trait containing all [`struct@Settings`] methods.
755///
756/// # Implementors
757///
758/// [`Settings`][struct@crate::Settings]
759pub trait SettingsExt: IsA<Settings> + sealed::Sealed + 'static {
760 /// Applies any changes that have been made to the settings.
761 ///
762 /// This function does nothing unless @self is in
763 /// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode). In the normal
764 /// case settings are always applied immediately.
765 #[doc(alias = "g_settings_apply")]
766 fn apply(&self) {
767 unsafe {
768 ffi::g_settings_apply(self.as_ref().to_glib_none().0);
769 }
770 }
771
772 /// Version of [`SettingsExtManual::bind_with_mapping()`][crate::prelude::SettingsExtManual::bind_with_mapping()] using closures instead of
773 /// callbacks for easier binding in other languages.
774 /// ## `key`
775 /// the key to bind
776 /// ## `object`
777 /// the object with property to bind
778 /// ## `property`
779 /// the name of the property to bind
780 /// ## `flags`
781 /// flags for the binding
782 /// ## `get_mapping`
783 /// a function that gets called to convert values
784 /// from @self to @object, or `NULL` to use the default GIO mapping
785 /// ## `set_mapping`
786 /// a function that gets called to convert values
787 /// from @object to @self, or `NULL` to use the default GIO mapping
788 #[cfg(feature = "v2_82")]
789 #[cfg_attr(docsrs, doc(cfg(feature = "v2_82")))]
790 #[doc(alias = "g_settings_bind_with_mapping_closures")]
791 fn bind_with_mapping_closures(
792 &self,
793 key: &str,
794 object: &impl IsA<glib::Object>,
795 property: &str,
796 flags: SettingsBindFlags,
797 get_mapping: Option<&glib::Closure>,
798 set_mapping: Option<&glib::Closure>,
799 ) {
800 unsafe {
801 ffi::g_settings_bind_with_mapping_closures(
802 self.as_ref().to_glib_none().0,
803 key.to_glib_none().0,
804 object.as_ref().to_glib_none().0,
805 property.to_glib_none().0,
806 flags.into_glib(),
807 get_mapping.to_glib_none().0,
808 set_mapping.to_glib_none().0,
809 );
810 }
811 }
812
813 /// Create a binding between the writability of @key in the
814 /// @self object and the property @property of @object.
815 ///
816 /// The property must be boolean; `sensitive` or `visible`
817 /// properties of widgets are the most likely candidates.
818 ///
819 /// Writable bindings are always uni-directional; changes of the
820 /// writability of the setting will be propagated to the object
821 /// property, not the other way.
822 ///
823 /// When the @inverted argument is true, the binding inverts the
824 /// value as it passes from the setting to the object, i.e. @property
825 /// will be set to true if the key is not writable.
826 ///
827 /// Note that the lifecycle of the binding is tied to @object,
828 /// and that you can have only one binding per object property.
829 /// If you bind the same property twice on the same object, the second
830 /// binding overrides the first one.
831 /// ## `key`
832 /// the key to bind
833 /// ## `object`
834 /// the object with property to bind
835 /// ## `property`
836 /// the name of a boolean property to bind
837 /// ## `inverted`
838 /// whether to ‘invert’ the value
839 #[doc(alias = "g_settings_bind_writable")]
840 fn bind_writable(
841 &self,
842 key: &str,
843 object: &impl IsA<glib::Object>,
844 property: &str,
845 inverted: bool,
846 ) {
847 unsafe {
848 ffi::g_settings_bind_writable(
849 self.as_ref().to_glib_none().0,
850 key.to_glib_none().0,
851 object.as_ref().to_glib_none().0,
852 property.to_glib_none().0,
853 inverted.into_glib(),
854 );
855 }
856 }
857
858 /// Creates a [`Action`][crate::Action] corresponding to a given [`Settings`][crate::Settings] key.
859 ///
860 /// The action has the same name as the key.
861 ///
862 /// The value of the key becomes the state of the action and the action
863 /// is enabled when the key is writable. Changing the state of the
864 /// action results in the key being written to. Changes to the value or
865 /// writability of the key cause appropriate change notifications to be
866 /// emitted for the action.
867 ///
868 /// For boolean-valued keys, action activations take no parameter and
869 /// result in the toggling of the value. For all other types,
870 /// activations take the new value for the key (which must have the
871 /// correct type).
872 /// ## `key`
873 /// the name of a key in @self
874 ///
875 /// # Returns
876 ///
877 /// a new [`Action`][crate::Action]
878 #[doc(alias = "g_settings_create_action")]
879 fn create_action(&self, key: &str) -> Action {
880 unsafe {
881 from_glib_full(ffi::g_settings_create_action(
882 self.as_ref().to_glib_none().0,
883 key.to_glib_none().0,
884 ))
885 }
886 }
887
888 /// Changes the [`Settings`][crate::Settings] object into
889 /// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).
890 ///
891 /// In this
892 /// mode, changes to @self are not immediately propagated to the
893 /// backend, but kept locally until [`apply()`][Self::apply()] is called.
894 #[doc(alias = "g_settings_delay")]
895 fn delay(&self) {
896 unsafe {
897 ffi::g_settings_delay(self.as_ref().to_glib_none().0);
898 }
899 }
900
901 //#[doc(alias = "g_settings_get")]
902 //fn get(&self, key: &str, format: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
903 // unsafe { TODO: call ffi:g_settings_get() }
904 //}
905
906 /// Gets the value that is stored at @key in @self.
907 ///
908 /// A convenience variant of `Gio::Settings::get()` for booleans.
909 ///
910 /// It is a programmer error to give a @key that isn’t specified as
911 /// having a `b` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
912 /// ## `key`
913 /// the key to get the value for
914 ///
915 /// # Returns
916 ///
917 /// a boolean
918 #[doc(alias = "g_settings_get_boolean")]
919 #[doc(alias = "get_boolean")]
920 fn boolean(&self, key: &str) -> bool {
921 unsafe {
922 from_glib(ffi::g_settings_get_boolean(
923 self.as_ref().to_glib_none().0,
924 key.to_glib_none().0,
925 ))
926 }
927 }
928
929 /// Creates a child settings object which has a base path of
930 /// `base-path/name`, where `base-path` is the base path of
931 /// @self and `name` is as specified by the caller.
932 ///
933 /// The schema for the child settings object must have been declared
934 /// in the schema of @self using a `<child>` element.
935 ///
936 /// The created child settings object will inherit the
937 /// [`delay-apply`][struct@crate::Settings#delay-apply] mode from @self.
938 /// ## `name`
939 /// the name of the child schema
940 ///
941 /// # Returns
942 ///
943 /// a ‘child’ settings object
944 #[doc(alias = "g_settings_get_child")]
945 #[doc(alias = "get_child")]
946 #[must_use]
947 fn child(&self, name: &str) -> Settings {
948 unsafe {
949 from_glib_full(ffi::g_settings_get_child(
950 self.as_ref().to_glib_none().0,
951 name.to_glib_none().0,
952 ))
953 }
954 }
955
956 /// Gets the ‘default value’ of a key.
957 ///
958 /// This is the value that would be read if [`reset()`][Self::reset()] were to be
959 /// called on the key.
960 ///
961 /// Note that this may be a different value than returned by
962 /// [`SettingsSchemaKey::default_value()`][crate::SettingsSchemaKey::default_value()] if the system administrator
963 /// has provided a default value.
964 ///
965 /// Comparing the return values of [`default_value()`][Self::default_value()] and
966 /// [`value()`][Self::value()] is not sufficient for determining if a value
967 /// has been set because the user may have explicitly set the value to
968 /// something that happens to be equal to the default. The difference
969 /// here is that if the default changes in the future, the user’s key
970 /// will still be set.
971 ///
972 /// This function may be useful for adding an indication to a UI of what
973 /// the default value was before the user set it.
974 ///
975 /// It is a programmer error to give a @key that isn’t contained in the
976 /// schema for @self.
977 /// ## `key`
978 /// the key to get the default value for
979 ///
980 /// # Returns
981 ///
982 /// the default value
983 #[doc(alias = "g_settings_get_default_value")]
984 #[doc(alias = "get_default_value")]
985 fn default_value(&self, key: &str) -> Option<glib::Variant> {
986 unsafe {
987 from_glib_full(ffi::g_settings_get_default_value(
988 self.as_ref().to_glib_none().0,
989 key.to_glib_none().0,
990 ))
991 }
992 }
993
994 /// Gets the value that is stored at @key in @self.
995 ///
996 /// A convenience variant of `Gio::Settings::get()` for doubles.
997 ///
998 /// It is a programmer error to give a @key that isn’t specified as
999 /// having a `d` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1000 /// ## `key`
1001 /// the key to get the value for
1002 ///
1003 /// # Returns
1004 ///
1005 /// a double
1006 #[doc(alias = "g_settings_get_double")]
1007 #[doc(alias = "get_double")]
1008 fn double(&self, key: &str) -> f64 {
1009 unsafe { ffi::g_settings_get_double(self.as_ref().to_glib_none().0, key.to_glib_none().0) }
1010 }
1011
1012 /// Gets the value that is stored in @self for @key and converts it
1013 /// to the enum value that it represents.
1014 ///
1015 /// In order to use this function the type of the value must be a string
1016 /// and it must be marked in the schema file as an enumerated type.
1017 ///
1018 /// It is a programmer error to give a @key that isn’t contained in the
1019 /// schema for @self or is not marked as an enumerated type.
1020 ///
1021 /// If the value stored in the configuration database is not a valid
1022 /// value for the enumerated type then this function will return the
1023 /// default value.
1024 /// ## `key`
1025 /// the key to get the value for
1026 ///
1027 /// # Returns
1028 ///
1029 /// the enum value
1030 #[doc(alias = "g_settings_get_enum")]
1031 #[doc(alias = "get_enum")]
1032 fn enum_(&self, key: &str) -> i32 {
1033 unsafe { ffi::g_settings_get_enum(self.as_ref().to_glib_none().0, key.to_glib_none().0) }
1034 }
1035
1036 /// Gets the value that is stored in @self for @key and converts it
1037 /// to the flags value that it represents.
1038 ///
1039 /// In order to use this function the type of the value must be an array
1040 /// of strings and it must be marked in the schema file as a flags type.
1041 ///
1042 /// It is a programmer error to give a @key that isn’t contained in the
1043 /// schema for @self or is not marked as a flags type.
1044 ///
1045 /// If the value stored in the configuration database is not a valid
1046 /// value for the flags type then this function will return the default
1047 /// value.
1048 /// ## `key`
1049 /// the key to get the value for
1050 ///
1051 /// # Returns
1052 ///
1053 /// the flags value
1054 #[doc(alias = "g_settings_get_flags")]
1055 #[doc(alias = "get_flags")]
1056 fn flags(&self, key: &str) -> u32 {
1057 unsafe { ffi::g_settings_get_flags(self.as_ref().to_glib_none().0, key.to_glib_none().0) }
1058 }
1059
1060 /// Returns whether the [`Settings`][crate::Settings] object has any unapplied
1061 /// changes.
1062 ///
1063 /// This can only be the case if it is in
1064 /// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).
1065 ///
1066 /// # Returns
1067 ///
1068 /// true if @self has unapplied changes, false otherwise
1069 #[doc(alias = "g_settings_get_has_unapplied")]
1070 #[doc(alias = "get_has_unapplied")]
1071 #[doc(alias = "has-unapplied")]
1072 fn has_unapplied(&self) -> bool {
1073 unsafe {
1074 from_glib(ffi::g_settings_get_has_unapplied(
1075 self.as_ref().to_glib_none().0,
1076 ))
1077 }
1078 }
1079
1080 /// Gets the value that is stored at @key in @self.
1081 ///
1082 /// A convenience variant of `Gio::Settings::get()` for 32-bit integers.
1083 ///
1084 /// It is a programmer error to give a @key that isn’t specified as
1085 /// having an `i` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1086 /// ## `key`
1087 /// the key to get the value for
1088 ///
1089 /// # Returns
1090 ///
1091 /// an integer
1092 #[doc(alias = "g_settings_get_int")]
1093 #[doc(alias = "get_int")]
1094 fn int(&self, key: &str) -> i32 {
1095 unsafe { ffi::g_settings_get_int(self.as_ref().to_glib_none().0, key.to_glib_none().0) }
1096 }
1097
1098 /// Gets the value that is stored at @key in @self.
1099 ///
1100 /// A convenience variant of `Gio::Settings::get()` for 64-bit integers.
1101 ///
1102 /// It is a programmer error to give a @key that isn’t specified as
1103 /// having an `x` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1104 /// ## `key`
1105 /// the key to get the value for
1106 ///
1107 /// # Returns
1108 ///
1109 /// a 64-bit integer
1110 #[doc(alias = "g_settings_get_int64")]
1111 #[doc(alias = "get_int64")]
1112 fn int64(&self, key: &str) -> i64 {
1113 unsafe { ffi::g_settings_get_int64(self.as_ref().to_glib_none().0, key.to_glib_none().0) }
1114 }
1115
1116 //#[doc(alias = "g_settings_get_mapped")]
1117 //#[doc(alias = "get_mapped")]
1118 //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> {
1119 // unsafe { TODO: call ffi:g_settings_get_mapped() }
1120 //}
1121
1122 /// Gets the value that is stored at @key in @self.
1123 ///
1124 /// A convenience variant of `Gio::Settings::get()` for strings.
1125 ///
1126 /// It is a programmer error to give a @key that isn’t specified as
1127 /// having an `s` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1128 /// ## `key`
1129 /// the key to get the value for
1130 ///
1131 /// # Returns
1132 ///
1133 /// a newly-allocated string
1134 #[doc(alias = "g_settings_get_string")]
1135 #[doc(alias = "get_string")]
1136 fn string(&self, key: &str) -> glib::GString {
1137 unsafe {
1138 from_glib_full(ffi::g_settings_get_string(
1139 self.as_ref().to_glib_none().0,
1140 key.to_glib_none().0,
1141 ))
1142 }
1143 }
1144
1145 /// Gets the value that is stored at @key in @self.
1146 ///
1147 /// A convenience variant of `Gio::Settings::get()` for 32-bit unsigned
1148 /// integers.
1149 ///
1150 /// It is a programmer error to give a @key that isn’t specified as
1151 /// having a `u` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1152 /// ## `key`
1153 /// the key to get the value for
1154 ///
1155 /// # Returns
1156 ///
1157 /// an unsigned integer
1158 #[doc(alias = "g_settings_get_uint")]
1159 #[doc(alias = "get_uint")]
1160 fn uint(&self, key: &str) -> u32 {
1161 unsafe { ffi::g_settings_get_uint(self.as_ref().to_glib_none().0, key.to_glib_none().0) }
1162 }
1163
1164 /// Gets the value that is stored at @key in @self.
1165 ///
1166 /// A convenience variant of `Gio::Settings::get()` for 64-bit unsigned
1167 /// integers.
1168 ///
1169 /// It is a programmer error to give a @key that isn’t specified as
1170 /// having a `t` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1171 /// ## `key`
1172 /// the key to get the value for
1173 ///
1174 /// # Returns
1175 ///
1176 /// a 64-bit unsigned integer
1177 #[doc(alias = "g_settings_get_uint64")]
1178 #[doc(alias = "get_uint64")]
1179 fn uint64(&self, key: &str) -> u64 {
1180 unsafe { ffi::g_settings_get_uint64(self.as_ref().to_glib_none().0, key.to_glib_none().0) }
1181 }
1182
1183 /// Checks the ‘user value’ of a key, if there is one.
1184 ///
1185 /// The user value of a key is the last value that was set by the user.
1186 ///
1187 /// After calling [`reset()`][Self::reset()] this function should always return
1188 /// `NULL` (assuming something is not wrong with the system
1189 /// configuration).
1190 ///
1191 /// It is possible that [`value()`][Self::value()] will return a different
1192 /// value than this function. This can happen in the case that the user
1193 /// set a value for a key that was subsequently locked down by the system
1194 /// administrator — this function will return the user’s old value.
1195 ///
1196 /// This function may be useful for adding a ‘reset’ option to a UI or
1197 /// for providing indication that a particular value has been changed.
1198 ///
1199 /// It is a programmer error to give a @key that isn’t contained in the
1200 /// schema for @self.
1201 /// ## `key`
1202 /// the key to get the user value for
1203 ///
1204 /// # Returns
1205 ///
1206 /// the user’s value, if set
1207 #[doc(alias = "g_settings_get_user_value")]
1208 #[doc(alias = "get_user_value")]
1209 fn user_value(&self, key: &str) -> Option<glib::Variant> {
1210 unsafe {
1211 from_glib_full(ffi::g_settings_get_user_value(
1212 self.as_ref().to_glib_none().0,
1213 key.to_glib_none().0,
1214 ))
1215 }
1216 }
1217
1218 /// Gets the value that is stored in @self for @key.
1219 ///
1220 /// It is a programmer error to give a @key that isn’t contained in the
1221 /// schema for @self.
1222 /// ## `key`
1223 /// the key to get the value for
1224 ///
1225 /// # Returns
1226 ///
1227 /// a new [`glib::Variant`][struct@crate::glib::Variant]
1228 #[doc(alias = "g_settings_get_value")]
1229 #[doc(alias = "get_value")]
1230 fn value(&self, key: &str) -> glib::Variant {
1231 unsafe {
1232 from_glib_full(ffi::g_settings_get_value(
1233 self.as_ref().to_glib_none().0,
1234 key.to_glib_none().0,
1235 ))
1236 }
1237 }
1238
1239 /// Finds out if a key can be written.
1240 /// ## `name`
1241 /// the name of a key
1242 ///
1243 /// # Returns
1244 ///
1245 /// true if the key @name is writable, false otherwise
1246 #[doc(alias = "g_settings_is_writable")]
1247 fn is_writable(&self, name: &str) -> bool {
1248 unsafe {
1249 from_glib(ffi::g_settings_is_writable(
1250 self.as_ref().to_glib_none().0,
1251 name.to_glib_none().0,
1252 ))
1253 }
1254 }
1255
1256 /// Gets the list of children on @self.
1257 ///
1258 /// The list is exactly the list of strings for which it is not an error
1259 /// to call [`child()`][Self::child()].
1260 ///
1261 /// There is little reason to call this function from ‘normal’ code, since
1262 /// you should already know what children are in your schema. This function
1263 /// may still be useful there for introspection reasons, however.
1264 ///
1265 /// You should free the return value with `strfreev()` when you are done
1266 /// with it.
1267 ///
1268 /// # Returns
1269 ///
1270 /// a list of the children
1271 /// on @self, in no defined order
1272 #[doc(alias = "g_settings_list_children")]
1273 fn list_children(&self) -> Vec<glib::GString> {
1274 unsafe {
1275 FromGlibPtrContainer::from_glib_full(ffi::g_settings_list_children(
1276 self.as_ref().to_glib_none().0,
1277 ))
1278 }
1279 }
1280
1281 /// Resets @key to its default value.
1282 ///
1283 /// This call resets the key, as much as possible, to its default value.
1284 /// That might be the value specified in the schema or the one set by the
1285 /// administrator.
1286 /// ## `key`
1287 /// the name of a key
1288 #[doc(alias = "g_settings_reset")]
1289 fn reset(&self, key: &str) {
1290 unsafe {
1291 ffi::g_settings_reset(self.as_ref().to_glib_none().0, key.to_glib_none().0);
1292 }
1293 }
1294
1295 /// Reverts all unapplied changes to the settings.
1296 ///
1297 /// This function does nothing unless @self is in
1298 /// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode). In the normal
1299 /// case settings are always applied immediately.
1300 ///
1301 /// Change notifications will be emitted for affected keys.
1302 #[doc(alias = "g_settings_revert")]
1303 fn revert(&self) {
1304 unsafe {
1305 ffi::g_settings_revert(self.as_ref().to_glib_none().0);
1306 }
1307 }
1308
1309 //#[doc(alias = "g_settings_set")]
1310 //fn set(&self, key: &str, format: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> bool {
1311 // unsafe { TODO: call ffi:g_settings_set() }
1312 //}
1313
1314 /// Sets @key in @self to @value.
1315 ///
1316 /// A convenience variant of `Gio::Settings::set()` for booleans.
1317 ///
1318 /// It is a programmer error to give a @key that isn’t specified as
1319 /// having a `b` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1320 /// ## `key`
1321 /// the key to set the value for
1322 /// ## `value`
1323 /// the value to set it to
1324 ///
1325 /// # Returns
1326 ///
1327 /// true if setting the key succeeded,
1328 /// false if the key was not writable
1329 #[doc(alias = "g_settings_set_boolean")]
1330 fn set_boolean(&self, key: &str, value: bool) -> Result<(), glib::error::BoolError> {
1331 unsafe {
1332 glib::result_from_gboolean!(
1333 ffi::g_settings_set_boolean(
1334 self.as_ref().to_glib_none().0,
1335 key.to_glib_none().0,
1336 value.into_glib()
1337 ),
1338 "Can't set readonly key"
1339 )
1340 }
1341 }
1342
1343 /// Sets @key in @self to @value.
1344 ///
1345 /// A convenience variant of `Gio::Settings::set()` for doubles.
1346 ///
1347 /// It is a programmer error to give a @key that isn’t specified as
1348 /// having a `d` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1349 /// ## `key`
1350 /// the key to set the value for
1351 /// ## `value`
1352 /// the value to set it to
1353 ///
1354 /// # Returns
1355 ///
1356 /// true if setting the key succeeded,
1357 /// false if the key was not writable
1358 #[doc(alias = "g_settings_set_double")]
1359 fn set_double(&self, key: &str, value: f64) -> Result<(), glib::error::BoolError> {
1360 unsafe {
1361 glib::result_from_gboolean!(
1362 ffi::g_settings_set_double(
1363 self.as_ref().to_glib_none().0,
1364 key.to_glib_none().0,
1365 value
1366 ),
1367 "Can't set readonly key"
1368 )
1369 }
1370 }
1371
1372 /// Looks up the enumerated type nick for @value and writes it to @key,
1373 /// within @self.
1374 ///
1375 /// It is a programmer error to give a @key that isn’t contained in the
1376 /// schema for @self or is not marked as an enumerated type, or for
1377 /// @value not to be a valid value for the named type.
1378 ///
1379 /// After performing the write, accessing @key directly with
1380 /// [`string()`][Self::string()] will return the ‘nick’ associated with
1381 /// @value.
1382 /// ## `key`
1383 /// the key to set the value for
1384 /// ## `value`
1385 /// an enumerated value
1386 ///
1387 /// # Returns
1388 ///
1389 /// true if the set succeeds, false otherwise
1390 #[doc(alias = "g_settings_set_enum")]
1391 fn set_enum(&self, key: &str, value: i32) -> Result<(), glib::error::BoolError> {
1392 unsafe {
1393 glib::result_from_gboolean!(
1394 ffi::g_settings_set_enum(
1395 self.as_ref().to_glib_none().0,
1396 key.to_glib_none().0,
1397 value
1398 ),
1399 "Can't set readonly key"
1400 )
1401 }
1402 }
1403
1404 /// Looks up the flags type nicks for the bits specified by @value, puts
1405 /// them in an array of strings and writes the array to @key, within
1406 /// @self.
1407 ///
1408 /// It is a programmer error to give a @key that isn’t contained in the
1409 /// schema for @self or is not marked as a flags type, or for @value
1410 /// to contain any bits that are not value for the named type.
1411 ///
1412 /// After performing the write, accessing @key directly with
1413 /// [`SettingsExtManual::strv()`][crate::prelude::SettingsExtManual::strv()] will return an array of ‘nicks’; one for each
1414 /// bit in @value.
1415 /// ## `key`
1416 /// the key to set the value for
1417 /// ## `value`
1418 /// a flags value
1419 ///
1420 /// # Returns
1421 ///
1422 /// true if the set succeeds, false otherwise
1423 #[doc(alias = "g_settings_set_flags")]
1424 fn set_flags(&self, key: &str, value: u32) -> Result<(), glib::error::BoolError> {
1425 unsafe {
1426 glib::result_from_gboolean!(
1427 ffi::g_settings_set_flags(
1428 self.as_ref().to_glib_none().0,
1429 key.to_glib_none().0,
1430 value
1431 ),
1432 "Can't set readonly key"
1433 )
1434 }
1435 }
1436
1437 /// Sets @key in @self to @value.
1438 ///
1439 /// A convenience variant of `Gio::Settings::set()` for 32-bit integers.
1440 ///
1441 /// It is a programmer error to give a @key that isn’t specified as
1442 /// having an `i` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1443 /// ## `key`
1444 /// the key to set the value for
1445 /// ## `value`
1446 /// the value to set it to
1447 ///
1448 /// # Returns
1449 ///
1450 /// true if setting the key succeeded,
1451 /// false if the key was not writable
1452 #[doc(alias = "g_settings_set_int")]
1453 fn set_int(&self, key: &str, value: i32) -> Result<(), glib::error::BoolError> {
1454 unsafe {
1455 glib::result_from_gboolean!(
1456 ffi::g_settings_set_int(
1457 self.as_ref().to_glib_none().0,
1458 key.to_glib_none().0,
1459 value
1460 ),
1461 "Can't set readonly key"
1462 )
1463 }
1464 }
1465
1466 /// Sets @key in @self to @value.
1467 ///
1468 /// A convenience variant of `Gio::Settings::set()` for 64-bit integers.
1469 ///
1470 /// It is a programmer error to give a @key that isn’t specified as
1471 /// having an `x` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1472 /// ## `key`
1473 /// the key to set the value for
1474 /// ## `value`
1475 /// the value to set it to
1476 ///
1477 /// # Returns
1478 ///
1479 /// true if setting the key succeeded,
1480 /// false if the key was not writable
1481 #[doc(alias = "g_settings_set_int64")]
1482 fn set_int64(&self, key: &str, value: i64) -> Result<(), glib::error::BoolError> {
1483 unsafe {
1484 glib::result_from_gboolean!(
1485 ffi::g_settings_set_int64(
1486 self.as_ref().to_glib_none().0,
1487 key.to_glib_none().0,
1488 value
1489 ),
1490 "Can't set readonly key"
1491 )
1492 }
1493 }
1494
1495 /// Sets @key in @self to @value.
1496 ///
1497 /// A convenience variant of `Gio::Settings::set()` for strings.
1498 ///
1499 /// It is a programmer error to give a @key that isn’t specified as
1500 /// having an `s` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1501 /// ## `key`
1502 /// the key to set the value for
1503 /// ## `value`
1504 /// the value to set it to
1505 ///
1506 /// # Returns
1507 ///
1508 /// true if setting the key succeeded,
1509 /// false if the key was not writable
1510 #[doc(alias = "g_settings_set_string")]
1511 fn set_string(&self, key: &str, value: &str) -> Result<(), glib::error::BoolError> {
1512 unsafe {
1513 glib::result_from_gboolean!(
1514 ffi::g_settings_set_string(
1515 self.as_ref().to_glib_none().0,
1516 key.to_glib_none().0,
1517 value.to_glib_none().0
1518 ),
1519 "Can't set readonly key"
1520 )
1521 }
1522 }
1523
1524 /// Sets @key in @self to @value.
1525 ///
1526 /// A convenience variant of `Gio::Settings::set()` for 32-bit unsigned
1527 /// integers.
1528 ///
1529 /// It is a programmer error to give a @key that isn’t specified as
1530 /// having a `u` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1531 /// ## `key`
1532 /// the key to set the value for
1533 /// ## `value`
1534 /// the value to set it to
1535 ///
1536 /// # Returns
1537 ///
1538 /// true if setting the key succeeded,
1539 /// false if the key was not writable
1540 #[doc(alias = "g_settings_set_uint")]
1541 fn set_uint(&self, key: &str, value: u32) -> Result<(), glib::error::BoolError> {
1542 unsafe {
1543 glib::result_from_gboolean!(
1544 ffi::g_settings_set_uint(
1545 self.as_ref().to_glib_none().0,
1546 key.to_glib_none().0,
1547 value
1548 ),
1549 "Can't set readonly key"
1550 )
1551 }
1552 }
1553
1554 /// Sets @key in @self to @value.
1555 ///
1556 /// A convenience variant of `Gio::Settings::set()` for 64-bit unsigned
1557 /// integers.
1558 ///
1559 /// It is a programmer error to give a @key that isn’t specified as
1560 /// having a `t` type in the schema for @self (see [`glib::VariantType`][crate::glib::VariantType]).
1561 /// ## `key`
1562 /// the key to set the value for
1563 /// ## `value`
1564 /// the value to set it to
1565 ///
1566 /// # Returns
1567 ///
1568 /// true if setting the key succeeded,
1569 /// false if the key was not writable
1570 #[doc(alias = "g_settings_set_uint64")]
1571 fn set_uint64(&self, key: &str, value: u64) -> Result<(), glib::error::BoolError> {
1572 unsafe {
1573 glib::result_from_gboolean!(
1574 ffi::g_settings_set_uint64(
1575 self.as_ref().to_glib_none().0,
1576 key.to_glib_none().0,
1577 value
1578 ),
1579 "Can't set readonly key"
1580 )
1581 }
1582 }
1583
1584 /// Sets @key in @self to @value.
1585 ///
1586 /// It is a programmer error to give a @key that isn’t contained in the
1587 /// schema for @self or for @value to have the incorrect type, per
1588 /// the schema.
1589 ///
1590 /// If @value is floating then this function consumes the reference.
1591 /// ## `key`
1592 /// the key to set the value for
1593 /// ## `value`
1594 /// a [`glib::Variant`][struct@crate::glib::Variant] of the correct type
1595 ///
1596 /// # Returns
1597 ///
1598 /// true if setting the key succeeded,
1599 /// false if the key was not writable
1600 #[doc(alias = "g_settings_set_value")]
1601 fn set_value(&self, key: &str, value: &glib::Variant) -> Result<(), glib::error::BoolError> {
1602 unsafe {
1603 glib::result_from_gboolean!(
1604 ffi::g_settings_set_value(
1605 self.as_ref().to_glib_none().0,
1606 key.to_glib_none().0,
1607 value.to_glib_none().0
1608 ),
1609 "Can't set readonly key"
1610 )
1611 }
1612 }
1613
1614 /// The name of the context that the settings are stored in.
1615 fn backend(&self) -> Option<SettingsBackend> {
1616 ObjectExt::property(self.as_ref(), "backend")
1617 }
1618
1619 /// Whether the [`Settings`][crate::Settings] object is in
1620 /// [‘delay-apply’ mode](class.Settings.html#delay-apply-mode).
1621 #[doc(alias = "delay-apply")]
1622 fn is_delay_apply(&self) -> bool {
1623 ObjectExt::property(self.as_ref(), "delay-apply")
1624 }
1625
1626 /// The path within the backend where the settings are stored.
1627 fn path(&self) -> Option<glib::GString> {
1628 ObjectExt::property(self.as_ref(), "path")
1629 }
1630
1631 /// The name of the schema that describes the types of keys
1632 /// for this [`Settings`][crate::Settings] object.
1633 #[doc(alias = "schema-id")]
1634 fn schema_id(&self) -> Option<glib::GString> {
1635 ObjectExt::property(self.as_ref(), "schema-id")
1636 }
1637
1638 /// The [`SettingsSchema`][crate::SettingsSchema] describing the types of keys for this
1639 /// [`Settings`][crate::Settings] object.
1640 ///
1641 /// Ideally, this property would be called [`schema`][struct@crate::Settings#schema].
1642 /// [`SettingsSchema`][crate::SettingsSchema]
1643 /// has only existed since version 2.32, however, and before then the
1644 /// [`schema`][struct@crate::Settings#schema] property was used to refer to the ID of the schema rather
1645 /// than the schema itself. Take care.
1646 #[doc(alias = "settings-schema")]
1647 fn settings_schema(&self) -> Option<SettingsSchema> {
1648 ObjectExt::property(self.as_ref(), "settings-schema")
1649 }
1650
1651 //#[doc(alias = "change-event")]
1652 //fn connect_change_event<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
1653 // Unimplemented keys: *.CArray TypeId { ns_id: 2, id: 5 }
1654 //}
1655
1656 /// Emitted when a key has potentially changed.
1657 ///
1658 /// You should call one of the `Gio::Settings::get()` calls to check the new
1659 /// value.
1660 ///
1661 /// This signal supports detailed connections. You can connect to the
1662 /// detailed signal `changed::x` in order to only receive callbacks
1663 /// when key `x` changes.
1664 ///
1665 /// Note that @settings only emits this signal if you have read @key at
1666 /// least once while a signal handler was already connected for @key.
1667 /// ## `key`
1668 /// the name of the key that changed
1669 #[doc(alias = "changed")]
1670 fn connect_changed<F: Fn(&Self, &str) + 'static>(
1671 &self,
1672 detail: Option<&str>,
1673 f: F,
1674 ) -> SignalHandlerId {
1675 unsafe extern "C" fn changed_trampoline<P: IsA<Settings>, F: Fn(&P, &str) + 'static>(
1676 this: *mut ffi::GSettings,
1677 key: *mut std::ffi::c_char,
1678 f: glib::ffi::gpointer,
1679 ) {
1680 let f: &F = &*(f as *const F);
1681 f(
1682 Settings::from_glib_borrow(this).unsafe_cast_ref(),
1683 &glib::GString::from_glib_borrow(key),
1684 )
1685 }
1686 unsafe {
1687 let f: Box_<F> = Box_::new(f);
1688 let detailed_signal_name = detail.map(|name| format!("changed::{name}\0"));
1689 let signal_name: &[u8] = detailed_signal_name
1690 .as_ref()
1691 .map_or(&b"changed\0"[..], |n| n.as_bytes());
1692 connect_raw(
1693 self.as_ptr() as *mut _,
1694 signal_name.as_ptr() as *const _,
1695 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1696 changed_trampoline::<Self, F> as *const (),
1697 )),
1698 Box_::into_raw(f),
1699 )
1700 }
1701 }
1702
1703 /// Emitted once per writability change event that affects this settings object.
1704 ///
1705 /// You should connect
1706 /// to this signal if you are interested in viewing groups of changes
1707 /// before they are split out into multiple emissions of the
1708 /// [`writable-changed`][struct@crate::Settings#writable-changed] signal. For most use cases it is more
1709 /// appropriate to use the [`writable-changed`][struct@crate::Settings#writable-changed] signal.
1710 ///
1711 /// In the event that the writability change applies only to a single
1712 /// key, @key will be set to the `alias::GLib.Quark` for that key. In the event
1713 /// that the writability change affects the entire settings object,
1714 /// @key will be `0`.
1715 ///
1716 /// The default handler for this signal invokes the [`writable-changed`][struct@crate::Settings#writable-changed]
1717 /// and [`changed`][struct@crate::Settings#changed] signals for each affected key. This is done because
1718 /// changes in writability might also imply changes in value (if for
1719 /// example, a new mandatory setting is introduced). If any other
1720 /// connected handler returns true then this default functionality
1721 /// will be suppressed.
1722 /// ## `key`
1723 /// the quark of the key, or `0`
1724 ///
1725 /// # Returns
1726 ///
1727 /// true to stop other handlers from being invoked for the
1728 /// event, false to propagate the event further
1729 #[doc(alias = "writable-change-event")]
1730 fn connect_writable_change_event<F: Fn(&Self, u32) -> glib::Propagation + 'static>(
1731 &self,
1732 f: F,
1733 ) -> SignalHandlerId {
1734 unsafe extern "C" fn writable_change_event_trampoline<
1735 P: IsA<Settings>,
1736 F: Fn(&P, u32) -> glib::Propagation + 'static,
1737 >(
1738 this: *mut ffi::GSettings,
1739 key: std::ffi::c_uint,
1740 f: glib::ffi::gpointer,
1741 ) -> glib::ffi::gboolean {
1742 let f: &F = &*(f as *const F);
1743 f(Settings::from_glib_borrow(this).unsafe_cast_ref(), key).into_glib()
1744 }
1745 unsafe {
1746 let f: Box_<F> = Box_::new(f);
1747 connect_raw(
1748 self.as_ptr() as *mut _,
1749 b"writable-change-event\0".as_ptr() as *const _,
1750 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1751 writable_change_event_trampoline::<Self, F> as *const (),
1752 )),
1753 Box_::into_raw(f),
1754 )
1755 }
1756 }
1757
1758 /// Emitted when the writability of a key has potentially changed.
1759 ///
1760 /// You should call [`is_writable()`][Self::is_writable()] in order to determine the
1761 /// new status.
1762 ///
1763 /// This signal supports detailed connections. You can connect to the
1764 /// detailed signal `writable-changed::x` in order to only receive
1765 /// callbacks when the writability of `x` changes.
1766 /// ## `key`
1767 /// the key
1768 #[doc(alias = "writable-changed")]
1769 fn connect_writable_changed<F: Fn(&Self, &str) + 'static>(
1770 &self,
1771 detail: Option<&str>,
1772 f: F,
1773 ) -> SignalHandlerId {
1774 unsafe extern "C" fn writable_changed_trampoline<
1775 P: IsA<Settings>,
1776 F: Fn(&P, &str) + 'static,
1777 >(
1778 this: *mut ffi::GSettings,
1779 key: *mut std::ffi::c_char,
1780 f: glib::ffi::gpointer,
1781 ) {
1782 let f: &F = &*(f as *const F);
1783 f(
1784 Settings::from_glib_borrow(this).unsafe_cast_ref(),
1785 &glib::GString::from_glib_borrow(key),
1786 )
1787 }
1788 unsafe {
1789 let f: Box_<F> = Box_::new(f);
1790 let detailed_signal_name = detail.map(|name| format!("writable-changed::{name}\0"));
1791 let signal_name: &[u8] = detailed_signal_name
1792 .as_ref()
1793 .map_or(&b"writable-changed\0"[..], |n| n.as_bytes());
1794 connect_raw(
1795 self.as_ptr() as *mut _,
1796 signal_name.as_ptr() as *const _,
1797 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1798 writable_changed_trampoline::<Self, F> as *const (),
1799 )),
1800 Box_::into_raw(f),
1801 )
1802 }
1803 }
1804
1805 #[doc(alias = "delay-apply")]
1806 fn connect_delay_apply_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1807 unsafe extern "C" fn notify_delay_apply_trampoline<
1808 P: IsA<Settings>,
1809 F: Fn(&P) + 'static,
1810 >(
1811 this: *mut ffi::GSettings,
1812 _param_spec: glib::ffi::gpointer,
1813 f: glib::ffi::gpointer,
1814 ) {
1815 let f: &F = &*(f as *const F);
1816 f(Settings::from_glib_borrow(this).unsafe_cast_ref())
1817 }
1818 unsafe {
1819 let f: Box_<F> = Box_::new(f);
1820 connect_raw(
1821 self.as_ptr() as *mut _,
1822 b"notify::delay-apply\0".as_ptr() as *const _,
1823 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1824 notify_delay_apply_trampoline::<Self, F> as *const (),
1825 )),
1826 Box_::into_raw(f),
1827 )
1828 }
1829 }
1830
1831 #[doc(alias = "has-unapplied")]
1832 fn connect_has_unapplied_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1833 unsafe extern "C" fn notify_has_unapplied_trampoline<
1834 P: IsA<Settings>,
1835 F: Fn(&P) + 'static,
1836 >(
1837 this: *mut ffi::GSettings,
1838 _param_spec: glib::ffi::gpointer,
1839 f: glib::ffi::gpointer,
1840 ) {
1841 let f: &F = &*(f as *const F);
1842 f(Settings::from_glib_borrow(this).unsafe_cast_ref())
1843 }
1844 unsafe {
1845 let f: Box_<F> = Box_::new(f);
1846 connect_raw(
1847 self.as_ptr() as *mut _,
1848 b"notify::has-unapplied\0".as_ptr() as *const _,
1849 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1850 notify_has_unapplied_trampoline::<Self, F> as *const (),
1851 )),
1852 Box_::into_raw(f),
1853 )
1854 }
1855 }
1856}
1857
1858impl<O: IsA<Settings>> SettingsExt for O {}