Re: CSS # selectors and UI IDs
- Date: Fri, 8 Apr 2016 23:53:33 +0100
- From: Tristan van Berkom <tristan@xxxxxxxxxxxxxxxx>
- Subject: Re: CSS # selectors and UI IDs
Unfortunately no, the id in the gtkbuilder xml is only useful in apis such as gtk_builder_get_object(), one must actually set the "name" property of the widget before addressing it as #name in the css.
This is at least partly because css parsing does not strictly enforce a policy that every widget have a unique #name.
> On Apr 8, 2016, at 9:11 PM, Chris Larsen <clarsenipod@xxxxxxxxx> wrote:
> Hello Everyone,
> Forgive the cross-posting. I originally asked this in the language-bindings mailing list, but I don't think anyone actually uses that one.
> Working on the Ruby bindings for GTK, and a question came up regarding the relationship between CSS selectors and UI elements. On the Gnome developer page for GtkCssProvider, it says:
> Selectors work very similar to the way they do in CSS, with widget class names taking the role of element names, and widget names taking the role of IDs. When used in a selector, widget names must be prefixed with a '#' character. The '*' character represents the so-called universal selector, which matches any widget.
> I take that to mean that when the GtkBuilder object parses the UI file, the name property of the created widget object should be identical to the ID in the UI file. Can someone please confirm if this is the case?
> gtk-list mailing list
gtk-list mailing list