Window

The simplest Gtk.Application

Use Application Window if you need GMenu support.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* This is the application. */
public class Application : Gtk.Application {

	/* Constructor */
	public Application () {
		Object (application_id: "org.example.window");
	}

	/* Override the 'activate' signal of GLib.Application,
	 * which is inherited by Gtk.Application. */
	public override void activate () {

		var window = new Gtk.Window ();
		window.title = "Welcome to GNOME";

		/* The following 3 lines are included here to introduce
		 * you to ways you can adjust the toplevel window to suit
		 * your needs.  Uncomment them to see what they do.
		 */

		//window.border_width = 10;
		//window.set_default_size (350, 70);
		//window.window_position = Gtk.WindowPosition.CENTER;

		/* Add the window to this application. */
		this.add_window (window);

		/* Show the window. */
		window.show ();
	}
}

/* The main function creates the application and runs it.*/
int main (string[] args) {
	var app = new Application ();
	return app.run (args);
}

In this sample we used the following: