Class Settings
- All Implemented Interfaces:
Proxy
,StyleProvider
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 Settings
.
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(org.gnome.gdk.Display)
, but in many cases, it is more
convenient to use Widget.getSettings()
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Settings.Builder<B extends Settings.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.StyleProvider
StyleProvider.GtkPrivateChangedCallback, StyleProvider.StyleProviderImpl
-
Constructor Summary
ConstructorDescriptionSettings
(MemorySegment address) Create a Settings proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected Settings
asParent()
Returns this instance as if it were its parent type.static Settings.Builder
<? extends Settings.Builder> builder()
ASettings.Builder
object constructs aSettings
with the specified properties.static Settings
Gets theGtkSettings
object for the default display, creating it if necessary.static Settings
getForDisplay
(Display display) Gets theGtkSettings
object fordisplay
, creating it if necessary.static Type
getType()
Get the GType of the Settings classvoid
resetProperty
(String name) Undoes the effect of calling g_object_set() to install an application-specific value for a setting.Methods inherited from class org.gnome.gobject.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, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.StyleProvider
emitGtkPrivateChanged, onGtkPrivateChanged
-
Constructor Details
-
Settings
Create a Settings proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getDefault
Gets theGtkSettings
object for the default display, creating it if necessary.- Returns:
- a
GtkSettings
object. 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.Builder
object constructs aSettings
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withSettings.Builder.build()
.
-