GSOC with gnome-clocks – Final Report

Well people, the summer is sadly long gone, at least for me, and my summer of coding is approaching its end as well. I must say, that I am very thankful to Google for this opportunity to work in concert with my preferred desktop environment, which is still GNOME. I am glad, that I have seized this frame to finally move myself toward the first contribution to the GNOME project. I really enjoy this time and it’s a great pleasure for me, may be due my awesome mentor Paolo Borelli, I luckily have chosen for me. Thank you. 🙂 Moreover, during this period I have improved my knowledge in different areas and gained a lot of experience.

About the project results: as were reported many times geolocation support has managed to land in last minute to the 3.10 release, which is for sure great!
Moreover, there is even a not yet documented option for our users to toggle the geolocation service:

$ echo "Turn off geolocation support"
$ gsettings set org.gnome.clocks geolocation 'false'
$ echo "Turn on again"
$ gsettings set org.gnome.clocks geolocation 'true'

There is an experimental city images support in gnome-clocks available in the wip/cityimages branch try it out.
Screenshot from 2013-09-21 18:53:33 A youtube video is also available: city images – preview. The video illustrates the functionality of the implemented image providers: flickr image provider requests the corresponding images from the gnome-clocks flickr group, and downloads them for you, so the next time you launch the application they appear instantaneously. The capabilities of the local image provider are also demonstrated: It means, that you always have a possibility to overwrite the suggested image by the flickr provider with your own, you would like to see in gnome-clocks. Therefore you just need to put the corresponding image file into the folder:


Be aware of the following name convention for the image files. They should be named like: “berlin-germany-day.jpg” At the moment you can have two images for each location; one for a day and one for a night, the latter having the suffix “…-night.jpg” in its file name.

More information about gnome-clocks enhancements are available on the project page. Take care 🙂

Aaaah, and one more thank you for my sponsored travel to the GUADEC this year, it was just amazing 🙂


Maintenance of the Project’s Page

After a few reminders I have finally managed to update during the last week my Summer of code page for the so lovely Clocks project. Now, it contains a lot of more contents instead of many promising “todo” statements. Since then I try to keep it up to date by including exemplary new code snippets or by informing you about ongoing activities. So I hope that, besides me, you can also find it useful for you. 🙂

Vala support for the Libgweather

The recent version of libgweather library from git master comes with the Vala bindings support. At least the Clocks App (gnome-clocks) will heavily rely on this bindings support and therefore we are very thankful to Giovanni Campagna for his fruitful cooperation and good and friendly support.

Please note additionally, that the new version of libgweather will deprecate some function calls. To obtain a new instance of the Location object the function “gweather_location_get_world” should be used instead of “gweather_location_new_world”. “gweather_location_new_world” is deprecated and should be omitted in the newly written code. There are many more, so for more details please refer to the official documentation.

In favour of this good announcement I would like to share with you a small sample code written in Vala, in which some capabilities of the libgweather library are briefly demonstrated: This example reveals how to obtain a timezone name for almost all corresponding major cities.
Sample app:

public class LocationInfo {
    private Gtk.Window window;
    private Gtk.Box box;
    private GWeather.LocationEntry location_entry;
    private Gtk.Label city_label;
    private Gtk.Label timezone_label;

    public LocationInfo () {
        Gtk.Builder builder = new Gtk.Builder ();

        try {
            builder.add_from_file ("window.ui");
        } catch (Error e) {}

        this.window = builder.get_object ("window") as Gtk.Window;

        this.window.title = "libgweather testing";
        this.window.border_width = 10;
        this.window.window_position = Gtk.WindowPosition.CENTER;
        this.window.destroy.connect (Gtk.main_quit); = builder.get_object ("box") as Gtk.Box;
        this.location_entry =
          new GWeather.LocationEntry (GWeather.Location.get_world ());
        this.location_entry.set_activates_default (true);
        this.location_entry.changed.connect (this.location_defined); (location_entry);

        this.city_label = builder.get_object ("city") as Gtk.Label;
        this.timezone_label = builder.get_object ("time_zone") as Gtk.Label;

    public void show () {
        this.window.show_all ();

    private void location_defined () {
        GWeather.Location? l = null;
        GWeather.Timezone? t = null;

        if (this.location_entry.get_text () != "") {
            l = this.location_entry.get_location ();

		if (l != null) {
			t = l.get_timezone ();

			this.city_label.set_text (l.get_city_name ());

			if (t != null)
				this.timezone_label.set_text (t.get_tzid ());
				this.timezone_label.set_text ("Unknown");
		else {
			this.city_label.set_text ("");
			this.timezone_label.set_text ("");

    public static void main (string[] args)	{
        Gtk.init (ref args);

        var location_info = new LocationInfo (); ();
		Gtk.main ();

The code can be compiled with the following Makefile:

	valac --pkg gtk+-3.0 --target-glib=2.38 gweather-sample.vala \
		--pkg gweather-3.0 -X -DGWEATHER_I_KNOW_THIS_IS_UNSTABLE

The source code can be found here: libgweather-vala.tar.gz.