Ekaterina Gerasimova
kittykat3756@gmail.com 2013
Gordon Hill
caseyweederman@gmail.com 2013

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

As a special exception, the copyright holders give you permission to copy, modify, and distribute the example code contained in this document under the terms of your choosing, without restriction.

Bind functions to events using Lang.

# Actions and signals

# Get started with GNOME

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(); }