SettingsProtocol
public protocol SettingsProtocol : ObjectProtocol, StyleProviderProtocol
GtkSettings provides a mechanism to share global settings between
applications.
On the X window system, this sharing is realized by an XSettings manager that is usually part of the desktop environment, along with utilities that let the user change these settings.
On Wayland, the settings are obtained either via a settings portal, or by reading desktop settings from DConf.
In the absence of these sharing mechanisms, GTK reads default values for
settings from settings.ini files in /etc/gtk-4.0, $XDG_CONFIG_DIRS/gtk-4.0
and $XDG_CONFIG_HOME/gtk-4.0. These files must be valid key files (see
GKeyFile), and have a section called Settings. Themes can also provide
default values for settings by installing a settings.ini file
next to their gtk.css file.
Applications can override system-wide settings by setting the property
of the GtkSettings object with g_object_set(). This should be restricted
to special cases though; GtkSettings are not meant as an application
configuration facility.
There is one GtkSettings instance per display. It can be obtained with
[funcGtk.Settings.get_for_display], but in many cases, it is more
convenient to use [methodGtk.Widget.get_settings].
The SettingsProtocol protocol exposes the methods and properties of an underlying GtkSettings instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Settings.
Alternatively, use SettingsRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkSettingsinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
settings_ptrDefault implementationTyped pointer to the underlying
GtkSettingsinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkSettingsinstance.Declaration
Swift
var settings_ptr: UnsafeMutablePointer<GtkSettings>! { get } -
Required Initialiser for types conforming to
SettingsProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
SettingsPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: SettingsPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Settings property
Declaration
Swift
@inlinable func get(property: SettingsPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Settings property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: SettingsPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
resetProperty(name:Extension method) Undoes the effect of calling
g_object_set()to install an application-specific value for a setting.After this call, the setting will again follow the session-wide value for this setting.
Declaration
Swift
@inlinable func resetProperty(name: UnsafePointer<CChar>!)
View on GitHub
Install in Dash
SettingsProtocol Protocol Reference