Extending the CSS parser

In GtkStyle-based engines, GtkRCStyle provided ways to extend the gtkrc parser with engine-specific extensions. This has been replaced by gtk_theming_engine_register_property(), which lets a theme engine register new properties with an arbitrary type. While there is built-in support for most basic types, it is possible to use a custom parser for the property.

The installed properties depend on the "name" property, so they should be added in the constructed() vfunc. For example, if an engine with the name "Clearlooks" installs a "focus-color" property with the type GdkRGBA, the property -Clearlooks-focus-color will be registered and accepted in CSS like this:

1
2
3
GtkEntry {
  -Clearlooks-focus-color: rgba(255, 0, 0, 1.0);
}

Widget style properties also follow a similar syntax, with the widget type name used as a prefix. For example, the "focus-line-width" style property can be modified in CSS as -GtkWidget-focus-line-width.