Trait gio::prelude::SettingsExtManual
source · pub trait SettingsExtManual {
// Required methods
fn get<U: FromVariant>(&self, key: &str) -> U;
fn set(&self, key: &str, value: impl Into<Variant>) -> Result<(), BoolError>;
fn strv(&self, key: &str) -> StrV;
fn set_strv(&self, key: &str, value: impl IntoStrV) -> Result<(), BoolError>;
fn bind<'a, P: IsA<Object>>(
&'a self,
key: &'a str,
object: &'a P,
property: &'a str
) -> BindingBuilder<'a>;
}
Required Methods§
fn get<U: FromVariant>(&self, key: &str) -> U
fn set(&self, key: &str, value: impl Into<Variant>) -> Result<(), BoolError>
sourcefn strv(&self, key: &str) -> StrV
fn strv(&self, key: &str) -> StrV
A convenience variant of g_settings_get()
for string arrays.
It is a programmer error to give a key
that isn’t specified as
having an array of strings type in the schema for self
.
key
the key to get the value for
Returns
a
newly-allocated, None
-terminated array of strings, the value that
is stored at key
in self
.
sourcefn set_strv(&self, key: &str, value: impl IntoStrV) -> Result<(), BoolError>
fn set_strv(&self, key: &str, value: impl IntoStrV) -> Result<(), BoolError>
Sets key
in self
to value
.
A convenience variant of g_settings_set()
for string arrays. If
value
is None
, then key
is set to be the empty array.
It is a programmer error to give a key
that isn’t specified as
having an array of strings type in the schema for self
.
key
the name of the key to set
value
the value to set it to, or None
Returns
true
if setting the key succeeded,
false
if the key was not writable
sourcefn bind<'a, P: IsA<Object>>(
&'a self,
key: &'a str,
object: &'a P,
property: &'a str
) -> BindingBuilder<'a>
fn bind<'a, P: IsA<Object>>( &'a self, key: &'a str, object: &'a P, property: &'a str ) -> BindingBuilder<'a>
Create a binding between the key
in the self
object
and the property property
of object
.
The binding uses the default GIO mapping functions to map
between the settings and property values. These functions
handle booleans, numeric types and string types in a
straightforward way. Use [bind_with_mapping()
][Self::bind_with_mapping()] if
you need a custom mapping, or map between types that are not
supported by the default mapping functions.
Unless the flags
include SettingsBindFlags::NO_SENSITIVITY
, this
function also establishes a binding between the writability of
key
and the “sensitive” property of object
(if object
has
a boolean property by that name). See SettingsExt::bind_writable()
for more details about writable bindings.
Note that the lifecycle of the binding is tied to object
,
and that you can have only one binding per object property.
If you bind the same property twice on the same object, the second
binding overrides the first one.
key
the key to bind
object
property
the name of the property to bind
flags
flags for the binding