deno_gi icon indicating copy to clipboard operation
deno_gi copied to clipboard

Support `GObject.registerClass`

Open vixalien opened this issue 6 months ago • 2 comments

[!WARNING] The current code is incomplete and won't run; it is awaiting merge from other dependency pull requests. I'll push all the code after the required branches have been merged (so I can test against the main branch)

This PR will include code that will allow the use of GObject.registerClass in a fashion similar to what GJS already does.

GObject.registerClass allows the following:

  • Registers the class within the GObject type system so that the class can be used, for example, in GtkBuilder using a name and possibly custom GTypeFlags.
  • Allow registering properties with GParamSpecs
  • Allow registering object signals so that we can use obj.connect("signal_name")

It also allows higher integration with GtkWidget:

  • Automatically use a Template URI for constructing Builder objects.
  • Automatically get children and internal children inside said Builder template.
  • Allow setting a widget's css-name using GtkWidget.set_css_name.

Things to do in the future possibly:

  • [ ] Set internal children as private properties using # syntax. I am not sure if it's typescript-friendly
  • [ ] Consider allowing decorators (supported in Deno) to register properties automatically.

fix #20

vixalien avatar Dec 26 '23 00:12 vixalien