Open
Description
Problem: I've defined a widget MyBin
but using it inside a UI file brings up an error.
JS code
import GObject from "gi://GObject";
import Gtk from "gi://Gtk?version=4.0";
import Adw from "gi://Adw";
Gtk.init();
const MyBin = GObject.registerClass(
{
GTypeName: "MyBin",
},
class MyBin extends Adw.Bin {},
);
const MyBox = GObject.registerClass(
{
GTypeName: "MyBox",
Template: workbench.template,
},
class MyBox extends Gtk.Box {},
);
const b = new MyBox();
workbench.preview(b);
blueprint (but the problem seems to be present even with normal XML. You can translate between the two...).
using Gtk 4.0;
template MyBox : Gtk.Box {
.MyBin {}
}
Error:
(re.sonny.Workbench:4): re.sonny.Workbench-WARNING **: 22:51:26.278: Requiring My, version none: Typelib file for namespace 'My' (any version) not found
Notes:
console.log(MyBin.$gtype.name)
outputs MyBin1
, MyBin2
, ..., MyBin${i}
, incrementing every time I click run. The name of the type seems to be changing. Even knowing that, setting in the UI file the type MyBin3
and trying to hit run until MyBin.$gtype.name == 'MyBin3'
doesn't fix anything.