Claudio Saavedra

csaavedra@gnome.org

Go forward in time to November 2009.

Wed 2009/Oct/28
  • Do you see anything harmful in this chunk of code? You can read the GTK+ docs but please don't look at the implementation of the called methods.

    GtkTreePath *path;
    GtkTreeIter filter_iter;
    
    for ( /* an iteration on all iters in a GtkTreeModel */) {
      path = gtk_tree_model_get_path (base_model, &iter);
      gtk_tree_model_filter_convert_child_iter_to_iter (filter,
                                                        &filter_iter, &iter);
      if (gtk_tree_selection_iter_is_selected (selection, &filter_iter)) {
        /* do something with path */
      }
    }

    The code looks harmless, but it's not really. Looking at the implementation of gtk_tree_model_filter_convert_child_iter_to_iter() you'll see that the actual conversion is done by obtaining the GtkTreePath for the base model iterator and calling gtk_tree_model_filter_convert_child_path_to_path(). Similarly, gtk_tree_selection_iter_is_selected() internally calls gtk_tree_selection_path_is_selected(). So, you are calling gtk_tree_model_get_path() three times in total when you only need to do it once. Just use the GtkTreePath equivalents.

    Is this obvious for everyone but me? I mean, without looking at an oprofile callgraph and/or the GTK+ sources. I am not so sure.

Fri 2009/Oct/02
  • One thing that the N900 is missing is a way to scrobble the listening habits to last.fm. Since I am sort of addict to last.fm scrobbling, I couldn't wait for someone else to do it and wrote myself a last.fm scrobbler for mafw, the Media Application Framework used since Fremantle in Maemo.

    After a few weeks smoke testing it and fixing things here and there, I released today mafw-lastfm 0.0.1. This is the initial release and it does the basic stuff quite well: playing-now status and scrobbling. It has several rough edges but it was working good enough for me not bother to work on them. Releasing, I guess, is a good way to push me to do it, when anyone complains.

    The git repository is in gitorious, there's a garage page with some resources for those curious, and I pushed binary packages to Fremantle's extras-devel repository. Happy scrobbling!

  • In August I took a few weeks off from work, and spent a wonderful time in Paris and Fontainebleau, in France. Paris is a wonderful city but it has just too many things to see and do, so you can easily go back home needing holidays from your holidays. To avoid that, we spent several days in the small town of Fontainebleau, around an hour south from Paris. The town is quite small but charming anyway, life is way more relaxed, and it served its purpose of giving us some rest from the crazy Paris experience.

    The crazy Champs-Élysées:

    traffic at les champs-élysées

    One of the lovely fontaine Wallace, decorating many corners of Paris:

    fontaine wallace

    A random restaurant in Fontainebleau:

    restaurant at the corner

    Yesterday, I managed to finish uploading some of the pictures from Paris and Fontainebleau to flickr. The quality of these proves that I still have a lot to learn about reflex cameras.

Go backwards in time to September 2009.

Fri 2009/Oct/02 18:44:56 +0300