Gtk.Application
. Gtk.Application
is a class that handles many important aspects of a Gtk app like uniqueness and the ID you need to identify your app to the notifications server. If you want some more details about Gtk.Application
, check out Valadoc. For now, type the following in "Application.vala".MyApp ()
we set a couple of properties for our Gtk.Application
object, namely our app's ID and flags. The naming scheme we used for our app's ID is called Reverse Domain Name Notation and will ensure that your app has a unique identifier. The first line inside the activate
method creates a new Gtk.ApplicationWindow
called main_window
. The fourth line sets the window title that you see at the top of the window. We also must give our window a default size so that it does not appear too small for the user to interact with it. Then in our main ()
method we create a new instance of our Gtk.Application
and run it.activate ()
function:main_window.show_all ()
:Gtk.Button
with the label "Click me!"Gtk.ApplicationWindow
and declare that we want to show all of the window's contents.git
to track revisions in this foldergit
to push your code to GitHub."yourusername"
with your GitHub username and "yourrepositoryname"
with the name of the new repository you createdGtk.Window
and Gtk.Button
valac
command and the argument --pkg gtk+-3.0
? What we did there was make use of a "library". If you're not familiar with the idea of libraries, a library is a collection of methods that your program can use. So this argument tells valac
to include the GTK+ library (version 3.0) when compiling our app.Gtk
"Namespace" to declare that we want to use methods from GTK (specifically, Gtk.Window
and Gtk.Button.with_label
). Notice that there is a hierarchy at play. If you want to explore that hierarchy in more detail, you can check out Valadoc.