Ir para o conteúdo
ou

Software livre Brasil

 Voltar a Eu, Fujii
Tela cheia

My GTK3 porting story

20 de Fevereiro de 2011, 0:00 , por Software Livre Brasil - 0sem comentários ainda | Ninguém está seguindo este artigo ainda.
Visualizado 345 vezes

It is now possible to run Cheese using GTK+ 3 getting it from Cheese’s branch gtk3.

Cheese has a gtk3 branch for a while, but until very recently it only had one patch changing mostly versions in configure.ac. Then Bastien Nocera made 3 more patches changing code of CheeseWidget, CheeseFlash and um-crop-area. I wanted to use the changes, and silly me, I thought the branch was going to compile when I first tried to run it. It turns out that I spent days on it until it finally compiled and then a little more time before I was able to run it.

Most of the changes were on build system and Cheese’s vala code. I have never programmed in vala before, so this was a learning opportunity with some challenges in the way.

Funny story

Cheese was still using libunique-1.0, but in order to work with gtk3 I would have to switch to libunique-3.0. There was no vala binding for libunique 3, but I also hadn’t found one for clutter-gtk-1.0 and I was using the GObject Instrospection one instead and it seemed to work at the time.

Using gir files didn’t work so well with libunique. Vala was loading the right gir file, but it said the namespace “Unique” did not exist. So, I asked for help on the #vala channel. The first piece of advice was to switch to GApplication instead of using libunique, but I didn’t know how hard that would be and I wanted to understand why I was unable to use libunique-3.0 first. With some more help from someone else in the #vala channel I found out that the Unique-3.0.gir file had the wrong package name on it. As I didn’t know how to fix that and I didn’t even know if it was a problem in libunique or a GObject Introspection parsing problem I asked for help in #introspection.

In the #introspection channel, Emmanuele Bassi (ebassi) was the one that helped me, libunique’s maintainer. Isn’t it nice when that happens? I mean, you’re just asking for anyone less clueless than you to help, but you can actually talk with people that work on what you’re using. Anyway, continuing with the long story, ebassi told me the problem was in libunique, that he wouldn’t work on it soon, but he encouraged me to file a bug for it and I did. It turned out that the bug was easy to fix (for him at least) and something like 15 mins later he had fixed it and pushed it to master already. That was a nice surprise!

But my problems didn’t end there. After I fixed some GObject Introspection annotation in libunique for my code to work, valac started to crash with a segfault. I reported it, but I still don’t know what the exact problem was. The only way I found to fix it was to switch to GtkApplication and stop using libunique. If only I had listened to that first advice! Using clutter-gtk with GObject Introspection did not work in the end either, but turns out I was just missing the recently released vala binding for it.

I learned many things on this quest. I had never looked at gir files or vapi files before and I learned a little trying to debug and fix problems. The non-technical lessons were: it’s really painful to use stuff that is new and not widely used (yet?), you will find problems. But it’s also very nice to be able to fix the problems and work with helpful people.

By the way, to share my love for GNOME I’m organizing a GNOME 3.0 Release party in my town – Belo Horizonte, Brazil. So, if you’re in the area, save April 9th and get in touch if you want to help with organization.

Update: Patricia Santana Cruz had already made a patch to port Cheese to Gtk.Application (which is also way better than mine), so if I was any smarter I wouldn’t have half of the work I did. And now I know she is also one of the responsibles for we having the clutter-gtk-1.0 binding for vala too and she is working on some more bugs in vala and going after the warnings that affects Cheese. In short, she is awesome!


Fonte: http://blog.fujii.eti.br/?p=83

0sem comentários ainda

Enviar um comentário

Os campos são obrigatórios.

Se você é um usuário registrado, pode se identificar e ser reconhecido automaticamente.