I’m writing a gjs app in Typescript. At one point I wanted to use gtk_widget_class_get_css_name
, but couldn’t find a way how. Although I’ve found another way to achieve the styling I wanted, I’m still curious about this.
In the gir XML file the function is a method of Gtk.WidgetClass
which is a record. However, it has the attribute glib:is-gtype-struct-for
which seems to mean it shouldn’t be made available to bindings, at least not gjs. ts-for-gjs doesn’t export records with this attribute, and if I try plain Javascript there is no WidgetClass
in imports.gi.Gtk
. There is no widget_class_get_css_name
either. Is there some way I can access the function without writing some sort of shim in C?
I’ve noticed GTK4 has a corresponding instance method, gtk_widget_get_css_name
, so I’d be able to use that, but I want to stick to GTK3 for now, so I can easily do most of the development on my favourite laptop which happens to be a Mac.