GtkSettings provide 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. In the absence of
an Xsettings manager, GTK+ reads default values for settings from
settings.ini files in
/etc/gtk-3.0, $XDG_CONFIG_DIRS/gtk-3.0
and $XDG_CONFIG_HOME/gtk-3.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 gobject.object.ObjectWrap.set. This should be restricted
to special cases though; GtkSettings are not meant as an application
configuration facility. When doing so, you need to be aware that settings
that are specific to individual widgets may not be available before the
widget type has been realized at least once. The following example
demonstrates a way to do this:
gtk_init (&argc, &argv);
// make sure the type is realized
g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM));
g_object_set (gtk_settings_get_default (), "gtk-enable-animations", FALSE, NULL);
GtkSettings provide 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. In the absence of an Xsettings manager, GTK+ reads default values for settings from settings.ini files in /etc/gtk-3.0, $XDG_CONFIG_DIRS/gtk-3.0 and $XDG_CONFIG_HOME/gtk-3.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 gobject.object.ObjectWrap.set. This should be restricted to special cases though; GtkSettings are not meant as an application configuration facility. When doing so, you need to be aware that settings that are specific to individual widgets may not be available before the widget type has been realized at least once. The following example demonstrates a way to do this:
There is one GtkSettings instance per screen. It can be obtained with gtk.settings.Settings.getForScreen, but in many cases, it is more convenient to use gtk.widget.Widget.getSettings. gtk.settings.Settings.getDefault returns the GtkSettings instance for the default screen.