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