Bookmark Spec

I’ve sent a draft for a desktop bookmark spec on fd.o, and it got reviewed – mostly by the KDE people, that got already a standard way of storing bookmarks across the desktop.

If it reaches the common approval, I’ll apply for a CVS account on freedesktop.org’s server.

Meanwhile, I’m working on the implementation of the spec on the Gnome side: I already have a model/viewer approach set, and now I’m writing a generic XBEL object using GLib. It’s quite fun, I must admit. Well, it’s fun since I’ve found an implementation of an XBEL parser using libxml2 inside Galeon.

I hope to have a Gnome platform library for the bookmarks spec ready before GUADEC arrives…

Gnome Desktop Bookmarks

On Gnome Live there’s an ongoing discussion about recent files and bookmarks in Gnome.

In the last two weeks I’ve been designing and writing a platform library for Gnome which addresses the points made on the Wiki, on Bugzilla and on the mailing lists (as I said here).

It’s called libgnome-bookmark and implements the concept of a generic “bookmark”; a bookmark is everything pointed by a URI, plus some meta-data. The library comes with two objects: GnomeBookmarkItem – which is the representation of the bookmark – and GnomeBookmarkModel – the monitor of the bookmarks storage.

You just add and get items to and from the model, similarly to the current recent-files stuff. Plus, the model has the ability to support custom filter and sort functions, in order to get what you want, the way you want it. Bookmarks also might be registered by more than one application (so that you have the ability to create per-application bookmarks) and might belong to various groups (so that you can have classes of applications using the same bookmarks).

Recent files and desktop bookmarks are handled simply by defining two groups in the specification.

In my opinion, this solves the bookmarks problem, and the recent files issues in a single move.

DBus Perl Bindings/3

It seems that my work on a D-Bus perl binding was duplicating the (excellent) work of Daniel P. Berrange.

Not that I’m complaining: I badly needed to understand how D-Bus worked, and creating a binding was the fastest way to understand the inner workings of D-Bus.

Well, all in all I learned much, and now I volunteered for giving a hand to Daniel if he needs it. This is the beauty of F/OSS.

Guadec 2005

All set and done.

After a bit of struggle between PayPal and my credit card, I filled the registration for this year’s GUADEC, that will be held in Stuttgart, Germany.

GUADEC Registration

Stuttgart, here we come…

DBus Perl Bindings/2

After four hours straight of hacking, double-checking references, learning D-Bus and the intricacies of Perl XS programming, I have a preliminary draft of perl bindings for D-Bus.

At the moment, they do nothing, since there isn’t much more than the DBus::Connection object, but they are loading correctely, and the approach is right.

The API should resemble the C one, with a perlish twist. A simple service lister program should be:

  use DBus;
  # we could use this class method...
  my $bus = DBus->get_session_bus;
  # or just the DBus::Bus class...
  #my $bus = DBus::Bus->get('session');
  # the result is the same: $bus will contain a reference to the session bus.
  # but it is also a perl hash reference, so it could hold something, such a string:
  $bus->{service} = 'org.freedesktop.DBus';
  # then we could use them in order to get a service
  my $service = $bus->get_service($bus->{service});
  # $service is also a perl hashref, so we could use it to store some more strings:
  $service->{path} = '/org/freedesktop/DBus';
  $service->{interface} = 'org.freedesktop.DBus';
  # and the get the object:
  my $object = $service->get_object($service->{path}, $service->{interface});
  # here's the remote method call:
  print "Service: $_\n" foreach ($object->ListServices);
  0;
dbus-perl screenshot
Obligatory screenshot of the bindings

I plan to make the low-level bindings work as soon as this weekend.

Future plans: creating a DBus::Object::Subclass pragmatic module, similar to Glib’s Glib::Object::Subclass, that permits the creation of D-Bus aware objects. This could be tricky, but I’m really optimistic.

Glib::KeyFile/2

After being in Florence with Marta for just about two days, I’ve received the “go ahead” from the gtk2-perl team, and committed my patch for the GKeyFile bindings (closing bug #301171). Now you can parse the .desktop files directly in Perl. Hurray for me.

Gtk2::Recent and recent-files

Gtk2::Recent status: Finally, the libegg/recent-files bindings for Perl hit the gtk2-perl CVS server (well, at least the authenticated CVS server; anonymous CVS should be updated in 24 hours).

recent-files status: On a related note, I mailed James Willcox (the recent-files maintainer), asking him if this library is still actively maintained, and stepping up for help (triaging bugs, reviewing patches, applying them, and possibly development).

I’ve some ideas, like the creation of a Gnome library based on the actual recent-files code, depending on libgnomevfs and some other stuff, which monitors the recent files file and their state (if local, with the option for remote file checking, maybe using a GConf preference). It will have a RecentMenu widget, composed of RecentMenuItems, for visualization – thus simplifying the code:

  RecentModel *model = gnome_recent_model_new (RECENT_MODEL_ORDER_MRU);
  GtkWidget *menu = gnome_recent_menu_new (model);
  GtkWidget *menuitem = gtk_image_menu_item_new (GTK_STOCK_CLEAR);

  g_signal_connect (G_OBEJCT (menu), "activate", G_CALLBACK (on_recent_activate), NULL);
  g_signal_connect (G_OBJECT (menuitem), "activate", G_CALLBACK (on_clear_activate), model);

  gnome_recent_menu_set_show_trailing_separator (GNOME_RECENT_MENU (menu), TRUE);
  gnome_recent_menu_append_item (GNOME_RECENT_MENU (menu), menuitem);

  gtk_widget_show (menuitem);
  gtk_widget_show (menu);

Then, you could simply attach this menu as a GtkMenuItem submenu.

Future plans: See here for some neat ideas (not from me) about the recent stuff handling.

Glib::KeyFile

I began working on a perl binding for the key file parser inside Glib. I have an implementation almost ready, albeit not usable right now.

I’d like to translate a key file structure to the more perlish equivalent of an associative array; that is, I want to translate this:

  [Section]
  # comment
  stringkey=astring
  intkey=42
  boolkey=false

Into this:

  print $keyfile->{Section}->{comment}; # prints "comment"
  print $keyfile->{Section}->{intkey}; # prints "42"
  ...

While skimming through the gkeyfile.[ch] files, I’ve also noticed that you can’t create a key file in code, even though the infrastructure is in place (you can create an empty object, and you can remove groups and keys from a filled object). Thus I’ve created a bug inside Gnome’s bugzilla with a proper patch to expose the addition of groups and keys (here). I’ll notify the gtk-devel mailing list, and see if someone wants to review (and apply) my patch.

On the language binding friendlyness side, I’ve also made a patch that transforms the GKeyFile structure in a reference counted object, but I won’t submit it, since it seems that no structs inside Glib core are refcounted. Pity, but I learned something new.

gtk2-perl lives!

I’ve put up a stub page for the gtk2-perl bindings on the Gnome Live! wiki.

I’ll soon fill it up with pointers to developer resources, programs and tutorial. I’d like that every gtk2-perl developer use it for public coordination and planning, instead of relying on private email and the mailing list.