Skip to main content

SettingsExt

Trait SettingsExt 

Source
pub trait SettingsExt: IsA<Settings> + 'static {
Show 43 methods // Provided methods fn apply(&self) { ... } fn bind_with_mapping_closures( &self, key: &str, object: &impl IsA<Object>, property: &str, flags: SettingsBindFlags, get_mapping: Option<&Closure>, set_mapping: Option<&Closure>, ) { ... } fn bind_writable( &self, key: &str, object: &impl IsA<Object>, property: &str, inverted: bool, ) { ... } fn create_action(&self, key: &str) -> Action { ... } fn delay(&self) { ... } fn boolean(&self, key: &str) -> bool { ... } fn child(&self, name: &str) -> Settings { ... } fn default_value(&self, key: &str) -> Option<Variant> { ... } fn double(&self, key: &str) -> f64 { ... } fn enum_(&self, key: &str) -> i32 { ... } fn flags(&self, key: &str) -> u32 { ... } fn has_unapplied(&self) -> bool { ... } fn int(&self, key: &str) -> i32 { ... } fn int64(&self, key: &str) -> i64 { ... } fn string(&self, key: &str) -> GString { ... } fn uint(&self, key: &str) -> u32 { ... } fn uint64(&self, key: &str) -> u64 { ... } fn user_value(&self, key: &str) -> Option<Variant> { ... } fn value(&self, key: &str) -> Variant { ... } fn is_writable(&self, name: &str) -> bool { ... } fn list_children(&self) -> Vec<GString> { ... } fn reset(&self, key: &str) { ... } fn revert(&self) { ... } fn set_boolean(&self, key: &str, value: bool) -> Result<(), BoolError> { ... } fn set_double(&self, key: &str, value: f64) -> Result<(), BoolError> { ... } fn set_enum(&self, key: &str, value: i32) -> Result<(), BoolError> { ... } fn set_flags(&self, key: &str, value: u32) -> Result<(), BoolError> { ... } fn set_int(&self, key: &str, value: i32) -> Result<(), BoolError> { ... } fn set_int64(&self, key: &str, value: i64) -> Result<(), BoolError> { ... } fn set_string(&self, key: &str, value: &str) -> Result<(), BoolError> { ... } fn set_uint(&self, key: &str, value: u32) -> Result<(), BoolError> { ... } fn set_uint64(&self, key: &str, value: u64) -> Result<(), BoolError> { ... } fn set_value(&self, key: &str, value: &Variant) -> Result<(), BoolError> { ... } fn backend(&self) -> Option<SettingsBackend> { ... } fn is_delay_apply(&self) -> bool { ... } fn path(&self) -> Option<GString> { ... } fn schema_id(&self) -> Option<GString> { ... } fn settings_schema(&self) -> Option<SettingsSchema> { ... } fn connect_changed<F: Fn(&Self, &str) + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { ... } fn connect_writable_change_event<F: Fn(&Self, u32) -> Propagation + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_writable_changed<F: Fn(&Self, &str) + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { ... } fn connect_delay_apply_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_has_unapplied_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Settings methods.

§Implementors

Settings

Provided Methods§

Source

fn apply(&self)

mode](class.Settings.html#delay-apply-mode). In the normal case settings are always applied immediately.

Source

fn bind_with_mapping_closures( &self, key: &str, object: &impl IsA<Object>, property: &str, flags: SettingsBindFlags, get_mapping: Option<&Closure>, set_mapping: Option<&Closure>, )

Available on crate feature v2_82 only.

Version of [SettingsExtManual::bind_with_mapping()][crate::prelude::SettingsExtManual::bind_with_mapping()] using closures instead of callbacks for easier binding in other languages.

§key

the key to bind

§object

the object with property to bind

§property

the name of the property to bind

§flags

flags for the binding

§get_mapping

a function that gets called to convert values from @self to @object, or NULL to use the default GIO mapping

§set_mapping

a function that gets called to convert values from @object to @self, or NULL to use the default GIO mapping

Source

fn bind_writable( &self, key: &str, object: &impl IsA<Object>, property: &str, inverted: bool, )

Create a binding between the writability of @key in the @self object and the property @property of @object.

The property must be boolean; sensitive or visible properties of widgets are the most likely candidates.

Writable bindings are always uni-directional; changes of the writability of the setting will be propagated to the object property, not the other way.

When the @inverted argument is true, the binding inverts the value as it passes from the setting to the object, i.e. @property will be set to true if the key is not writable.

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

the object with property to bind

§property

the name of a boolean property to bind

§inverted

the value

Source

fn create_action(&self, key: &str) -> Action

Creates a Action corresponding to a given Settings key.

The action has the same name as the key.

The value of the key becomes the state of the action and the action is enabled when the key is writable. Changing the state of the action results in the key being written to. Changes to the value or writability of the key cause appropriate change notifications to be emitted for the action.

For boolean-valued keys, action activations take no parameter and result in the toggling of the value. For all other types, activations take the new value for the key (which must have the correct type).

§key

the name of a key in @self

§Returns

a new Action

Source

fn delay(&self)

mode](class.Settings.html#delay-apply-mode).

In this mode, changes to @self are not immediately propagated to the backend, but kept locally until apply() is called.

Source

fn boolean(&self, key: &str) -> bool

t specified as having a b type in the schema for @self (see glib::VariantType).

§key

the key to get the value for

§Returns

a boolean

Source

fn child(&self, name: &str) -> Settings

` element.

The created child settings object will inherit the delay-apply mode from @self.

§name

the name of the child schema

§Returns

settings object

Source

fn default_value(&self, key: &str) -> Option<Variant>

t contained in the schema for @self.

§key

the key to get the default value for

§Returns

the default value

Source

fn double(&self, key: &str) -> f64

t specified as having a d type in the schema for @self (see glib::VariantType).

§key

the key to get the value for

§Returns

a double

Source

fn enum_(&self, key: &str) -> i32

t contained in the schema for @self or is not marked as an enumerated type.

If the value stored in the configuration database is not a valid value for the enumerated type then this function will return the default value.

§key

the key to get the value for

§Returns

the enum value

Source

fn flags(&self, key: &str) -> u32

t contained in the schema for @self or is not marked as a flags type.

If the value stored in the configuration database is not a valid value for the flags type then this function will return the default value.

§key

the key to get the value for

§Returns

the flags value

Source

fn has_unapplied(&self) -> bool

mode](class.Settings.html#delay-apply-mode).

§Returns

true if @self has unapplied changes, false otherwise

Source

fn int(&self, key: &str) -> i32

t specified as having an i type in the schema for @self (see glib::VariantType).

§key

the key to get the value for

§Returns

an integer

Source

fn int64(&self, key: &str) -> i64

t specified as having an x type in the schema for @self (see glib::VariantType).

§key

the key to get the value for

§Returns

a 64-bit integer

Source

fn string(&self, key: &str) -> GString

t specified as having an s type in the schema for @self (see glib::VariantType).

§key

the key to get the value for

§Returns

a newly-allocated string

Source

fn uint(&self, key: &str) -> u32

t specified as having a u type in the schema for @self (see glib::VariantType).

§key

the key to get the value for

§Returns

an unsigned integer

Source

fn uint64(&self, key: &str) -> u64

t specified as having a t type in the schema for @self (see glib::VariantType).

§key

the key to get the value for

§Returns

a 64-bit unsigned integer

Source

fn user_value(&self, key: &str) -> Option<Variant>

t contained in the schema for @self.

§key

the key to get the user value for

§Returns

s value, if set

Source

fn value(&self, key: &str) -> Variant

t contained in the schema for @self.

§key

the key to get the value for

§Returns

a new glib::Variant

Source

fn is_writable(&self, name: &str) -> bool

Finds out if a key can be written.

§name

the name of a key

§Returns

true if the key @name is writable, false otherwise

Source

fn list_children(&self) -> Vec<GString>

code, since you should already know what children are in your schema. This function may still be useful there for introspection reasons, however.

You should free the return value with strfreev() when you are done with it.

§Returns

a list of the children on @self, in no defined order

Source

fn reset(&self, key: &str)

Resets @key to its default value.

This call resets the key, as much as possible, to its default value. That might be the value specified in the schema or the one set by the administrator.

§key

the name of a key

Source

fn revert(&self)

mode](class.Settings.html#delay-apply-mode). In the normal case settings are always applied immediately.

Change notifications will be emitted for affected keys.

Source

fn set_boolean(&self, key: &str, value: bool) -> Result<(), BoolError>

t specified as having a b type in the schema for @self (see glib::VariantType).

§key

the key to set the value for

§value

the value to set it to

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn set_double(&self, key: &str, value: f64) -> Result<(), BoolError>

t specified as having a d type in the schema for @self (see glib::VariantType).

§key

the key to set the value for

§value

the value to set it to

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn set_enum(&self, key: &str, value: i32) -> Result<(), BoolError>

associated with @value.

§key

the key to set the value for

§value

an enumerated value

§Returns

true if the set succeeds, false otherwise

Source

fn set_flags(&self, key: &str, value: u32) -> Result<(), BoolError>

; one for each bit in @value.

§key

the key to set the value for

§value

a flags value

§Returns

true if the set succeeds, false otherwise

Source

fn set_int(&self, key: &str, value: i32) -> Result<(), BoolError>

t specified as having an i type in the schema for @self (see glib::VariantType).

§key

the key to set the value for

§value

the value to set it to

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn set_int64(&self, key: &str, value: i64) -> Result<(), BoolError>

t specified as having an x type in the schema for @self (see glib::VariantType).

§key

the key to set the value for

§value

the value to set it to

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn set_string(&self, key: &str, value: &str) -> Result<(), BoolError>

t specified as having an s type in the schema for @self (see glib::VariantType).

§key

the key to set the value for

§value

the value to set it to

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn set_uint(&self, key: &str, value: u32) -> Result<(), BoolError>

t specified as having a u type in the schema for @self (see glib::VariantType).

§key

the key to set the value for

§value

the value to set it to

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn set_uint64(&self, key: &str, value: u64) -> Result<(), BoolError>

t specified as having a t type in the schema for @self (see glib::VariantType).

§key

the key to set the value for

§value

the value to set it to

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn set_value(&self, key: &str, value: &Variant) -> Result<(), BoolError>

t contained in the schema for @self or for @value to have the incorrect type, per the schema.

If @value is floating then this function consumes the reference.

§key

the key to set the value for

§value

a glib::Variant of the correct type

§Returns

true if setting the key succeeded, false if the key was not writable

Source

fn backend(&self) -> Option<SettingsBackend>

The name of the context that the settings are stored in.

Source

fn is_delay_apply(&self) -> bool

mode](class.Settings.html#delay-apply-mode).

Source

fn path(&self) -> Option<GString>

The path within the backend where the settings are stored.

Source

fn schema_id(&self) -> Option<GString>

The name of the schema that describes the types of keys for this Settings object.

Source

fn settings_schema(&self) -> Option<SettingsSchema>

The SettingsSchema describing the types of keys for this Settings object.

Ideally, this property would be called schema. SettingsSchema has only existed since version 2.32, however, and before then the schema property was used to refer to the ID of the schema rather than the schema itself. Take care.

Source

fn connect_changed<F: Fn(&Self, &str) + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId

Emitted when a key has potentially changed.

You should call one of the Gio::Settings::get() calls to check the new value.

This signal supports detailed connections. You can connect to the detailed signal changed::x in order to only receive callbacks when key x changes.

Note that @settings only emits this signal if you have read @key at least once while a signal handler was already connected for @key.

§key

the name of the key that changed

Source

fn connect_writable_change_event<F: Fn(&Self, u32) -> Propagation + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted once per writability change event that affects this settings object.

You should connect to this signal if you are interested in viewing groups of changes before they are split out into multiple emissions of the writable-changed signal. For most use cases it is more appropriate to use the writable-changed signal.

In the event that the writability change applies only to a single key, @key will be set to the alias::GLib.Quark for that key. In the event that the writability change affects the entire settings object, @key will be 0.

The default handler for this signal invokes the writable-changed and changed signals for each affected key. This is done because changes in writability might also imply changes in value (if for example, a new mandatory setting is introduced). If any other connected handler returns true then this default functionality will be suppressed.

§key

the quark of the key, or 0

§Returns

true to stop other handlers from being invoked for the event, false to propagate the event further

Source

fn connect_writable_changed<F: Fn(&Self, &str) + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId

Emitted when the writability of a key has potentially changed.

You should call is_writable() in order to determine the new status.

This signal supports detailed connections. You can connect to the detailed signal writable-changed::x in order to only receive callbacks when the writability of x changes.

§key

the key

Source

fn connect_delay_apply_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_has_unapplied_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§