Gtk has a set of predefined events that you can use in your application.
Declare HelloWorld as a new class.
class HelloWorld {
constructor is called when a new instance is created. Create a GtkApplication, then connect activate to the existing Gtk event _onActivate and startup to _onStartup:
constructor() { this.application = new Gtk.Application(); this.application.connect('activate', this._onActivate.bind(this)); this.application.connect('startup', this._onStartup.bind(this)); }
Show the window upon application activation:
_onActivate() { this._window.show_all(); }
Got a comment? Spotted an error? Found the instructions unclear? Send feedback about this page.