Skip to content

Smarter GType name computation

Marco Trevisan requested to merge 3v1n0/gjs:smarter-gtype-name into master

Try to generate GType names taking in account the basename of the file where GObject.registerClass is called.

Unfortunately, this has to be a bit hacky, because of the JS nature, where there's no clear information about the source files (while might be probably done from the c++ side, but not sure it's important enough).

So, figure the file path using the error stack, and use the basename (+ one dir, if available) to generate the gtype in the form Gjs_${dir}_${basename}_className.

This will make the definition of new classes easier, without having to think too much to the underlying GType.

Merge request reports