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
73mod sealed {
74    pub trait Sealed {}
75    impl<T: super::IsA<super::SettingsBackend>> Sealed for T {}
76}
77
78/// Trait containing all [`struct@SettingsBackend`] methods.
79///
80/// # Implementors
81///
82/// [`SettingsBackend`][struct@crate::SettingsBackend]
83pub trait SettingsBackendExt: IsA<SettingsBackend> + sealed::Sealed + 'static {
84    //#[doc(alias = "g_settings_backend_changed")]
85    //fn changed(&self, key: &str, origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
86    //    unsafe { TODO: call ffi:g_settings_backend_changed() }
87    //}
88
89    //#[doc(alias = "g_settings_backend_changed_tree")]
90    //fn changed_tree(&self, tree: /*Ignored*/&glib::Tree, origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
91    //    unsafe { TODO: call ffi:g_settings_backend_changed_tree() }
92    //}
93
94    //#[doc(alias = "g_settings_backend_keys_changed")]
95    //fn keys_changed(&self, path: &str, items: &[&str], origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
96    //    unsafe { TODO: call ffi:g_settings_backend_keys_changed() }
97    //}
98
99    //#[doc(alias = "g_settings_backend_path_changed")]
100    //fn path_changed(&self, path: &str, origin_tag: /*Unimplemented*/Option<Basic: Pointer>) {
101    //    unsafe { TODO: call ffi:g_settings_backend_path_changed() }
102    //}
103
104    /// Signals that the writability of all keys below a given path may have
105    /// changed.
106    ///
107    /// Since GSettings performs no locking operations for itself, this call
108    /// will always be made in response to external events.
109    /// ## `path`
110    /// the name of the path
111    #[doc(alias = "g_settings_backend_path_writable_changed")]
112    fn path_writable_changed(&self, path: &str) {
113        unsafe {
114            ffi::g_settings_backend_path_writable_changed(
115                self.as_ref().to_glib_none().0,
116                path.to_glib_none().0,
117            );
118        }
119    }
120
121    /// Signals that the writability of a single key has possibly changed.
122    ///
123    /// Since GSettings performs no locking operations for itself, this call
124    /// will always be made in response to external events.
125    /// ## `key`
126    /// the name of the key
127    #[doc(alias = "g_settings_backend_writable_changed")]
128    fn writable_changed(&self, key: &str) {
129        unsafe {
130            ffi::g_settings_backend_writable_changed(
131                self.as_ref().to_glib_none().0,
132                key.to_glib_none().0,
133            );
134        }
135    }
136}
137
138impl<O: IsA<SettingsBackend>> SettingsBackendExt for O {}