@pojntfx@mastodon.social avatar pojntfx , to random

New progress on the introspection things I'm working on in . It's super early, but I added preliminary support for generated getters/setters for properties. No more manual value setup & SetProperty calls required, just a simple SetPropertyX call. We're getting closer and closer to more readable code here with this IMHO, GJS on the right for comparison!

This code: vfunc_activate() { this.#window = new SenbaraGtk.MainApplicationWindow({ application: this, }); this.#window.connect("button-test-clicked", () => { console.log("Test button clicked"); this.#window.show_toast("Button was clicked!"); this.#window.test_button_sensitive = false; setTimeout(() => { this.#window.show_toast("Button re-enabled after 3 seconds"); this.#window.test_button_sensitive = true; }, 3000); }); this.#window.present(); }

ALT
@pojntfx@mastodon.social avatar pojntfx , to random

Continued some subclassing support in Go. Turns out I messed up the C memory alignment in for and ended up embedding the parent class as a reference, when GObject expects it to be the actual struct. Funnily enough some callbacks still worked before this, but now even the ones like Snapshot and Activate work. To demonstrate, here is a Go application subclassing AdwApplication and overwriting the activate callback instead of calling ConnectCallback!

ALT
@pojntfx@mastodon.social avatar pojntfx , (edited ) to random

Now that my PRs for subclassing support in Go are up on GitHub and ready for review, I can get started porting over Sessions to GSK instead of Cairo. It was easier to do find examples in JS, so that's what I used, but next up is getting this to work with the freshly implemented snapshot function override!

ALT
@pojntfx@mastodon.social avatar pojntfx , (edited ) to random

May I present: Typed subclassing of classes in Golang! Still a WIP, but this is enough now to create proper custom widgets in without needing to import any purego/CGo code to subclass. Please ignore the Constructed callback call here, it's just there to test if getting a callback (e.g. a constructor works), too. 🥳

ALT
@pojntfx@mastodon.social avatar pojntfx , (edited ) to random

Just got GTK subclassing to work in thanks to some new bindings by https://github.com/jwijenbergh 👀

ALT
@agx@ruhr.social avatar agx , to random German

If you ever wanted to write a or plugin for but didn't fancy C: Here's an example in : https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1727