About GObject Introspection
A few days ago Adrian Perez wrote about GObject Introspection (abbreviated GI), explaining why it is gaining so much momentum. While you're really encouraged to visit his blog entry to see the work he did on Lua's GI bindings, I'll take some of his words:
In short, it (GObject Introspection) works like this:
- Library developers add annotations to the documentation comments of functions.
- The GI support tools generate XML and compiled API metadata.
- You have a library to use that metadata at runtime.
The last thing is very interesting, especially the runtime usage of metadata... because it enables dynamic language bindings. This means that developers no longer have to build e.g. the Python bindings for themselves but just annotating the source code!
GObject Introspection in Grilo
As Grilo's primary focus is to allow application developers concentrate on making good user interfaces, without having to deal with the low level stuff done at the framework level, we consider very important providing them with the ability to use their language of choice. At the same time, we'd like to avoid devoting time to write manual bindings, and that's the reason we put so much effort on GObject Introspection support: right now, if not all, most of the API is accessible via GI, and we're working to fix the less binding-friendly parts.
Building Grilo with GObject Introspection enabled
The best way to try Grilo from GI is, in my opinion, using jhbuild. Clone it with
git clone git://git.gnome.org/jhbuild
build and install it, and copy the configuration file provided sample.jhbuildrc to ~/.jhbuilrc. The project page explains everything in detail, from installation details to tweaking the configuration file, but if you don't want to do it, that's fine. You'll probably need to install the build prerequisites, by invoking
To see the dependencies needed to get grilo and grilo plugins installed you can type
$jhbuild list grilo grilo-plugins
But to get the most from Grilo, you'd go for:
$jhbuild build gtk+ pygobject grilo grilo-plugins
That will install grilo core and plugins, pygobject (which includes Python's glue to use GObject Introspection, and has gobject-introspection as a dependency) and Gtk+, needed to run the grilo-test-ui sample done with GI. After a rather long build, you should have an environment with Grilo installed with GI support.
From there, type
to enter the jhbuild environment and go to your Grilo's checkout directory. If everything has worked fine, you should be able to do:
$ python Python 2.5.2 (r252:60911, Aug 6 2010, 16:46:34) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from gi.repository import Grl >>> Grl.init() >>>
Under tools/python/ there's a grilo-test-ui.py program, which showcases all the combined potential of GI and Grilo: run it with
and enjoy (And then, start doing you own apps :D)
- Query results are freed once they're no longer needed
- The service quits when the user closes the client
- There's a proper About window (taken from Joaquim Rocha's SeriesFinale)
- Maemo packages (Maevies, butaca-server) in extras-devel work fine (previous version for butaca-server lacked the butaca-service file, even if the autobuilder log said it was OK)
The nice news is that Maevies already had users! I haven't promoted this app neither in talk.maemo.org nor in Identica's Maemo group, but several Maemo-related blogs and forums were listing it. It's funny because, as butaca-server's previous version didn't work, those users were happy just with python-webkit pointing to Google Movies :). I hope they enjoy the new features they'll find.
A Python clone of the grilo-test-ui is provided, and should give you an idea of what can be done with these new bindings: basically enjoy all the power in Grilo without needing to touch C code, and without us having to maintain manually created bindings.
Another quick one: if you want to watch/follow a product in (GNOME's) bugzilla, it is explained here.
To watch an entire product, lookup the product in this page. This will show the default assignee (often email@example.com). Then add it your your watched users list.
An easy one, but as it took me a while to find it, I put it here as a reference.
Aunque se haya acabado ya la 7ª Guadec-Hispana, para mí siempre será el principio: la primera vez que aporté algo (por humilde que haya sido) a una conferencia de Software Libre. Fue una experiencia muy agradable, a pesar de que hablar delante de tanto hacker produzca cierta intimidación ;). Afortunadamente, la (estupenda) cena del día anterior me sirvió para ir conociendo un poco a la gente, y ver que no mordían: es gente muy maja. Desde luego, es algo totalmente recomendado, tanto si tenéis la oportunidad de presentar algo como si acudís de oyentes.
Todas las charlas quedaron grabadas en vídeo, y la organización se encargó también de recoger las presentaciones, así que no creo que se tarde mucho en publicarlas en la página del evento: son todas muy recomendables. Y, para ir haciendo boca, aquí están las mías: en ellas se habla de Jamp, la aplicación desarrollada en el módulo de Desktop & Mobile del máster. ¡Que las disfrutéis!
Maybe it's still a bit longer than it should, but hey!
So, if you want to know those issues we faced with JaMp (GObject signals, D-Bus -from both C and Python sides-, and some notes about the Maemo port) come visit us to the Computer Science Faculty at A Coruña on 23rd July -next Friday- at 13:00. Grab the program here.
Some quick notes (the list of things which would deserve a full blog entry for themselves just keeps growing...)
- My manager (I don't like how "boss" sounds) retired last week. Although he visited us a couple of days more to spend some time with us, things will be, at least, different. We'll surely miss him.
- I started working with Grilo at Igalia, as the practicum work for the Free Software Master. I've been assigned a challenging task: improve the bindings infrastructure. Currently I'm getting familiar with the project, reading the doc and playing with the examples: it looks really interesting!
- Yesterday I received permissions to upload to extras-devel, so... maevies & butaca-server are available now! Of course, all said warnings about extras-devel still apply. In my case, it's about memory consumption: the backend doesn't free the objects exposed via DBus, so you have to kill it to get that done. It's a small footprint and all that, but it's not nice and of course not the way I want it: having it uploaded to extras will get me motivated to fix it (Sure, there will be other issues as well, and I'll set up the bugtracker as soon as possible)
- I've started with the slides for the JaMp talk at GUADEC-ES. There's still time left, but with these things, you never know...
Maevies was born twice. The first one, around the end of October, had a limited lifespan. The second one, a couple of months ago, was much more promising. As I've just told, I'm following the same architectural approach we have for Jamp, the Free Software Master's project. I was progressing fairly well, and feeling close to what I'd call a 0.1 release, I wanted to provide Debian packages. I started packaging the backend: another blog entry could be great to explain how I solved the issues I found, but these two commits should be pretty self-explanatory. The first one provides the Debian package infrastructure, so the binary is created. The second one does the necessary magic to get the service file in the appropriate directory. My sources for this were Vagalume project and this DBus tutorial.
However, I didn't know what to do with the Python part. Ship it together? Separately? How? From what I've seen, Python apps often use distutils for distribution and installation: creating a setup.py for the python part of maevies wasn't hard: with a simple file like this one, all the Python code could be distributed. But I still had to put it in a package... so I decided to stop losing time and do the following:
- Maevies' backend and frontend will be separated from now on. That makes building Debian packages really easy, and later, will be better for i18n support.
- Move from Maemo's garage to gitorious. In one of the latests IRC meetings, they talked about shutting down the garage and start providing a migration path. The sooner I do it, the better.
Both the split up and the move to gitorious have an additional benefit: the backend, being perfectly suited for any modern GNU / Linux distro, is now separated and in a more visible site, with the project being called Butaca, and the backend butaca-server. Maevies' UI is what will keep the "Maevies" name, being fully developed in PyGTK, and focusing on Maemo. (A Gnome desktop client should follow soon)
Something really nice about this move is that I'll preserve the git history. Thanks to this Stack Overflow link, nothing will be lost: it explains how to split (or detach as they say) a directory, with its history, from the whole project.
Quick note on Eclipse's CDT indexer: when using it with a C autotools project, it doesn't index headers and symbols with the AM_SILENT_RULES activated.
Commenting out the line let's Eclipse build its index, and then (it looks like) there's no problem setting it back.
UPDATE: In the project properties, under the C/C++ Build page, unclicking Use default build command and settingthe verbose mode for Make,
does the trick, without the need to modify the configure.ac