gio/auto/
settings_backend.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
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// The `GSettingsBackend` interface defines a generic interface for
10    /// non-strictly-typed data that is stored in a hierarchy. To implement
11    /// an alternative storage backend for [`Settings`][crate::Settings], you need to
12    /// implement the `GSettingsBackend` interface and then make it implement the
13    /// extension point `G_SETTINGS_BACKEND_EXTENSION_POINT_NAME`.
14    ///
15    /// The interface defines methods for reading and writing values, a
16    /// method for determining if writing of certain values will fail
17    /// (lockdown) and a change notification mechanism.
18    ///
19    /// The semantics of the interface are very precisely defined and
20    /// implementations must carefully adhere to the expectations of
21    /// callers that are documented on each of the interface methods.
22    ///
23    /// Some of the `GSettingsBackend` functions accept or return a
24    /// `GLib::Tree`. These trees always have strings as keys and
25    /// [`glib::Variant`][struct@crate::glib::Variant] as values.
26    ///
27    /// The `GSettingsBackend` API is exported to allow third-party
28    /// implementations, but does not carry the same stability guarantees
29    /// as the public GIO API. For this reason, you have to define the
30    /// C preprocessor symbol `G_SETTINGS_ENABLE_BACKEND` before including
31    /// `gio/gsettingsbackend.h`.
32    ///
33    /// This is an Abstract Base Class, you cannot instantiate it.
34    ///
35    /// # Implements
36    ///
37    /// [`SettingsBackendExt`][trait@crate::prelude::SettingsBackendExt], [`trait@glib::ObjectExt`]
38    #[doc(alias = "GSettingsBackend")]
39    pub struct SettingsBackend(Object<ffi::GSettingsBackend, ffi::GSettingsBackendClass>);
40
41    match fn {
42        type_ => || ffi::g_settings_backend_get_type(),
43    }
44}
45
46impl SettingsBackend {
47    pub const NONE: Option<&'static SettingsBackend> = None;
48
49    //#[doc(alias = "g_settings_backend_flatten_tree")]
50    //pub fn flatten_tree(tree: /*Ignored*/&glib::Tree) -> (glib::GString, Vec<glib::GString>, Vec<glib::Variant>) {
51    //    unsafe { TODO: call ffi:g_settings_backend_flatten_tree() }
52    //}
53
54    /// Returns the default #GSettingsBackend. It is possible to override
55    /// the default by setting the `GSETTINGS_BACKEND` environment variable
56    /// to the name of a settings backend.
57    ///
58    /// The user gets a reference to the backend.
59    ///
60    /// # Returns
61    ///
62    /// the default #GSettingsBackend,
63    ///     which will be a dummy (memory) settings backend if no other settings
64    ///     backend is available.
65    #[doc(alias = "g_settings_backend_get_default")]
66    #[doc(alias = "get_default")]
67    #[allow(clippy::should_implement_trait)]
68    pub fn default() -> SettingsBackend {
69        unsafe { from_glib_full(ffi::g_settings_backend_get_default()) }
70    }
71}
72
73/// Trait containing all [`struct@SettingsBackend`] methods.
74///
75/// # Implementors
76///
77/// [`SettingsBackend`][struct@crate::SettingsBackend]
78pub trait SettingsBackendExt: IsA<SettingsBackend> + 'static {
79    //#[doc(alias = "g_settings_backend_changed")]
80    //fn changed(&self, key: &str, origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
81    //    unsafe { TODO: call ffi:g_settings_backend_changed() }
82    //}
83
84    //#[doc(alias = "g_settings_backend_changed_tree")]
85    //fn changed_tree(&self, tree: /*Ignored*/&glib::Tree, origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
86    //    unsafe { TODO: call ffi:g_settings_backend_changed_tree() }
87    //}
88
89    //#[doc(alias = "g_settings_backend_keys_changed")]
90    //fn keys_changed(&self, path: &str, items: &[&str], origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
91    //    unsafe { TODO: call ffi:g_settings_backend_keys_changed() }
92    //}
93
94    //#[doc(alias = "g_settings_backend_path_changed")]
95    //fn path_changed(&self, path: &str, origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
96    //    unsafe { TODO: call ffi:g_settings_backend_path_changed() }
97    //}
98
99    /// Signals that the writability of all keys below a given path may have
100    /// changed.
101    ///
102    /// Since GSettings performs no locking operations for itself, this call
103    /// will always be made in response to external events.
104    /// ## `path`
105    /// the name of the path
106    #[doc(alias = "g_settings_backend_path_writable_changed")]
107    fn path_writable_changed(&self, path: &str) {
108        unsafe {
109            ffi::g_settings_backend_path_writable_changed(
110                self.as_ref().to_glib_none().0,
111                path.to_glib_none().0,
112            );
113        }
114    }
115
116    /// Signals that the writability of a single key has possibly changed.
117    ///
118    /// Since GSettings performs no locking operations for itself, this call
119    /// will always be made in response to external events.
120    /// ## `key`
121    /// the name of the key
122    #[doc(alias = "g_settings_backend_writable_changed")]
123    fn writable_changed(&self, key: &str) {
124        unsafe {
125            ffi::g_settings_backend_writable_changed(
126                self.as_ref().to_glib_none().0,
127                key.to_glib_none().0,
128            );
129        }
130    }
131}
132
133impl<O: IsA<SettingsBackend>> SettingsBackendExt for O {}