Class

GtkCssProvider

Description [src]

class Gtk.CssProvider : GObject.Object
  implements Gtk.StyleProvider {
  priv: GtkCssProviderPrivate*
}

GtkCssProvider is an object implementing the GtkStyleProvider interface. It is able to parse [CSS-like][css-overview] input in order to style widgets.

An application can make GTK+ parse a specific CSS style sheet by calling gtk_css_provider_load_from_file() or gtk_css_provider_load_from_resource() and adding the provider with gtk_style_context_add_provider() or gtk_style_context_add_provider_for_screen().

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 GtkSettings: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 GtkSettings:gtk-key-theme-name.

Hierarchy

hierarchy this GtkCssProvider implements_0 GtkStyleProvider this--implements_0 ancestor_0 GObject ancestor_0--this

Ancestors

Implements

Constructors

gtk_css_provider_new

Returns a newly created GtkCssProvider.

Functions

gtk_css_provider_get_default

Returns the provider containing the style settings used as a fallback for all widgets.

deprecated: 3.24 

gtk_css_provider_get_named

Loads a theme from the usual theme paths.

Instance methods

gtk_css_provider_load_from_data

Loads data into css_provider, and by doing so clears any previously loaded information.

gtk_css_provider_load_from_file

Loads the data contained in file into css_provider, making it clear any previously loaded information.

gtk_css_provider_load_from_path

Loads the data contained in path into css_provider, making it clear any previously loaded information.

gtk_css_provider_load_from_resource

Loads the data contained in the resource at resource_path into the GtkCssProvider, clearing any previously loaded information.

since: 3.16

gtk_css_provider_to_string

Converts the provider into a string representation in CSS format.

since: 3.2

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from GtkStyleProvider (3)
gtk_style_provider_get_icon_factory

Returns the GtkIconFactory defined to be in use for path, or NULL if none is defined.

deprecated: 3.8 since: 3.0

gtk_style_provider_get_style

Returns the style settings affecting a widget defined by path, or NULL if provider doesn’t contemplate styling path.

deprecated: 3.8 since: 3.0

gtk_style_provider_get_style_property

Looks up a widget style property as defined by provider for the widget represented by path.

since: 3.0

Signals

Gtk.CssProvider::parsing-error

Signals that a parsing error occurred. the path, line and position describe the actual location of the error as accurately as possible.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkCssProviderClass {
  GObjectClass parent_class;
  void (* parsing_error) (
    GtkCssProvider* provider,
    GtkCssSection* section,
    const GError* error
  );
  void (* _gtk_reserved2) (
void
  );
  void (* _gtk_reserved3) (
void
  );
  void (* _gtk_reserved4) (
void
  );
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.

parsing_error: void (* parsing_error) ( GtkCssProvider* provider, GtkCssSection* section, const GError* error )

No description available.

_gtk_reserved2: void (* _gtk_reserved2) ( void )

No description available.

_gtk_reserved3: void (* _gtk_reserved3) ( void )

No description available.

_gtk_reserved4: void (* _gtk_reserved4) ( void )

No description available.

Virtual methods

Gtk.CssProviderClass.parsing_error
No description available.