Calling Object() inside a constructor


After looking at some OOP examples of GTK Vala applications I have noticed they are calling Object() inside a class constructor. What is the purpose of this?

namespace MyApp {
	public class Window : Gtk.ApplicationWindow {

		public Window (Application app) {
			Object (
				application: app

		construct {
			title = "This is my new GTK app";
			window_position = Gtk.WindowPosition.CENTER;
			set_default_size(350, 80);



Looking at the Valadocs for the ApplicationWindow creation methods it requires an instance of an application.
public ApplicationWindow (Application application)

So what is the call to Object doing here in the class constructor?


This is GObject-style construction, see e.g. in contrast to the “Vala” style construction:

1 Like

Thank you this was extremely useful.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.