Web lists-archives.com

Re: Custom CSS in GtkBuilder XML


On 30 July 2016 at 11:54, lukas@xxxxxxxxxxxxxxxxx
<lukas@xxxxxxxxxxxxxxxxx> wrote:

> Using GtkBuilder XML, you can currently only add Styling Information like
> so:
> <object class="Foo">
>     <style>
>         <class name="predefined-class" />
>     </style>
> </object>
> So (please correct me if I'm wrong) CSS cannot be added without actions
> outside of this XML File.


> You always have to create a GtkCssProvider and add
> it to the widget's GtkStyleContext in your programming code.

Only if you have custom CSS, yes.

> Wouldn't it be more consistent to allow something like this:

If by "consistent" you mean "convenient", then possibly.

In reality, though, you may want to determine the additional CSS to be
loaded based on programmatic conditions, like the current user theme,
or the current platform. Adding a bunch of conditions to the XML
instead of code is not going to help much in terms of making Glade
more useful.


[@] ebassi [@gmail.com]
gtk-list mailing list