Package: gtk

Class gtk-css-provider

Superclasses

gtk-style-provider, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

None

Details

The gtk-css-provider object is an object implementing the gtk-style-provider interface. It is able to parse CSS-like input in order to style widgets.

An application can make GTK parse a specific CSS style sheet by calling the gtk-css-provider-load-from-file or gtk-css-provider-load-from-resource functions and adding the provider with the gtk-style-context-add-provider or gtk-style-context-add-provider-for-screen functions.

In addition, certain files will be read when GTK is initialized. First, the file $XDG_CONFIG_HOME/gtk-3.0/gtk.css is loaded if it exists. Then, GTK loads the first existing file among XDG_DATA_HOME/themes/THEME/gtk-VERSION/gtk.css, $HOME/.themes/THEME/gtk-VERSION/gtk.css, $XDG_DATA_DIRS/themes/THEME/gtk-VERSION/gtk.css and DATADIR/share/themes/THEME/gtk-VERSION/gtk.css, where THEME is the name of the current theme, see the gtk-theme-name setting, DATADIR is the prefix configured when GTK was compiled (unless overridden by the GTK_DATA_PREFIX environment variable), and VERSION is the GTK version number. If no file is found for the current version, GTK tries older versions all the way back to 3.0.

In the same way, GTK tries to load a gtk-keys.css file for the current key theme, as defined by the gtk-key-theme-name setting.

Signal Details

The "parsing-error" signal
 lambda (provider section error)    :run-last      
Signals that a parsing error occured. The path, line and position of the gtk-css-section instance describe the actual location of the error as accurately as possible.

Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal.

Note that this signal may be emitted at any time as the CSS provider may opt to defer parsing parts or all of the input to a later time than when a loading function was called.
provider
The gtk-css-provider object that had a parsing error.
section
The gtk-css-section instance the error happened in.
error
The parsing error of type GError.
 

Inherited Slot Access Functions

See also

*2021-11-18