Class Settings
- All Implemented Interfaces:
StyleProvider, Proxy
Provides a mechanism to share global settings between applications.
GTK relies on the platform-specific API for getting desktop-wide settings.
On Wayland, the settings are obtained via a settings portal that is part of the Linux desktop APIs for application.
On the X window system, this sharing is realized by an XSettings manager.
On macOS, the settings are obtained from NSUserDefaults.
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
getForDisplay(Display), but in many cases, it is more
convenient to use Widget.getSettings().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSettings.Builder<B extends Settings.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface StyleProvider
StyleProvider.GtkPrivateChangedCallback, StyleProvider.StyleProvider$Impl -
Constructor Summary
ConstructorsConstructorDescriptionSettings()Create a new Settings.Settings(MemorySegment address) Create a Settings instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SettingsasParent()Return this instance as if it were its parent type.static Settings.Builder<? extends Settings.Builder> builder()ASettings.Builderobject constructs aSettingswith the specified properties.static @Nullable SettingsGets theGtkSettingsobject for the default display, creating it if necessary.static SettingsgetForDisplay(Display display) Gets theGtkSettingsobject fordisplay,creating it if necessary.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Settings class.voidresetProperty(String name) Undoes the effect of calling g_object_set() to install an application-specific value for a setting.Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCodeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StyleProvider
emitGtkPrivateChanged, onGtkPrivateChanged
-
Constructor Details
-
Settings
Create a Settings instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Settings
public Settings()Create a new Settings.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
getDefault
Gets the
GtkSettingsobject for the default display, creating it if necessary.- Returns:
- a
GtkSettingsobject. If there is no default display, then returnsnull.
-
getForDisplay
-
resetProperty
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.
- Parameters:
name- the name of the setting to reset
-
builder
ASettings.Builderobject constructs aSettingswith the specified properties. Use the variousset...()methods to set properties, and finish construction withSettings.Builder.build().- Returns:
- the builder object
-