Vala Language for Maemo SDK+

1 About Vala Language

Vala is a new programming language that allows modern programming techniques to be used to write applications that run on the GLib and GObject libraries. GObject has long provided a very complete programming environment, with such features as a dynamic type system and assisted memory management. Before Vala, the only ways to program for the platform were with the machine native C API, which exposes a lot of often unwanted detail.

The syntax of Vala is similar to C#, modified to better fit the GObject type system. Vala is compiled statically typed language that supports modern language features like exception handling, assisted memory management, generics, type inference for local variables etc. It is also object-oriented supporting multiple inheritance for interfaces and single inheritance for classes. The signals of GObject type system is an important part of Vala as well as lambda expressions providing implementations for the signal callbacks in an elegant way. To read more about Vala language, please, see the references below.

2 Installing Vala for Maemo

2.1 Installing Vala Language

These instructions assume that you have installed maemo SDK+ already. If you have not, please, install maemo SDK+ first. maemo SDK+ provides a tool to install Vala language into the build tools environment. Just specify the language version you want to install (see below).

  $ sudo maemo-tools get vala-0.6.1
or, to install the development version type:

  $ sudo maemo-tools get vala-0.7.2

Note that the operation takes some time to complete. Please, do not use older versions (older than 0.6.0) of Vala with maemo SDK+ since Osso namespace support was not yet introduced. When you have completed the installation you can try Vala simply by typing:

  $ sb2 valac --version

3 Maemo APIs for Vala

The following table lists the some APIs that can be used from Vala code.

Diablo 4.1.x APIs
PackageC Library Name
Standard Programming APIs
GLibglib
Vala-1.0-
Posixlibc
Ossolibosso
Standard GUI APIs
Gtklibgtk+-2.0
Atklibatk-1.0
Gdklibgdk-2.0
Gdk.Pixbuflibgdk_pixbuf-2.0
Pangolibpango
Cairolibcairo
Hildonhildon-1
Hildon File Managerhildon-fm
Multimedia APIs
Gstlibgstreamer-0.10
Other Service APIs
DBuslibdbus-glib-1
GConflibgconf2
GnomeVFSlibgnomevfs-2.0
Sqlitelibsqlite3
Xmllibxml2
Hallibhal

Note: Fremantle 5.0 has not yet been officially released. This section will be updated soon.

Fremantle 5.0.x APIs
PackageC Library Name
Standard Programming APIs
GLibglib
Vala-1.0-
Posixlibc
Ossolibosso
Standard GUI APIs
Gtklibgtk+-2.0
Atklibatk-1.0
Gdklibgdk-2.0
Gdk.Pixbuflibgdk_pixbuf-2.0
Pangolibpango
Cairolibcairo
Multimedia APIs
Gstlibgstreamer-0.10
Other Service APIs
DBuslibdbus-glib-1
GConflibgconf2
GnomeVFSlibgnomevfs-2.0
Sqlitelibsqlite3
Xmllibxml2
Hallibhal

4 Vala Code Examples for maemo

The following table contains a few Vala example source packages.

NameSource Package
Hello World GUI Applicationhello-app.tar.gzInstructions

4.1 Hello World GUI Application: hello-app.tar.gz

This example code provides a hello world GUI application for maemo platform. It has been tested with diablo 4.1.2 rootstraps but it should work with all maemo 4.x roostraps. In addition to the standard GLib library package, this GUI application uses Gtk, Hildon, and Osso interfaces. It also provides packaging scripts, and it is easy to extend into a full GUI application.

Build instructions:

  $ export SBOX_REDIRECT_FORCE=/usr/bin/perl     # For diablo rootstraps
  $ sb2 dpkg-buildpackage -rfakeroot -d

5 Vala References