Banshee + GNOME 3.0

Published on Monday, February 8, 2010

The GNOME logo I spent a little time this weekend doing one of the things I've wanted to do for years - eradicate one of the oldest files in Banshee: banshee-dialogs.glade.

The vast majority of Banshee's UI is custom widgetry that is laid out dynamically at runtime. The main window and the preferences dialog hasn't been restricted by Glade for a couple of years, but all the other dialogs were defined in part in Glade:

  • Open Location
  • Seek To
  • Import Media
  • Smart Playlist Editor
  • Error list dialog (very unlikely anyone has ever seen this)
  • Last.FM Station Editor

These were all fairly simple dialogs in Glade -- mostly consisting of a table, some static labels, and placeholders to pack in custom widgets at runtime (e.g. the import source combo box in the Import Media dialog, or the actual query builder UI packed in the Smart Playlist Editor dialog).

Old Banshee Glade Dialogs
Old Banshee Glade Dialogs

These are now fully defined in code, allowing the dialogs to derive directly from BansheeDialog, which provides extra common functionality for dialogs on top of Gtk.Dialog.

The big take-away here is no longer depending on the deprecated libglade/glade-sharp libraries (well, almost -- later this week Gabriel will port Muinshee -- an alternative Banshee client in the image of Muine, but not a core component). Additionally, I removed our dependency on libgnome/gnome-sharp, which is also deprecated.

This means that Banshee 1.5.4 will be GNOME 3.0 ready. The last thing to do is implement a udev hardware backend. We already have partial DeviceKit support, and GIO support. However, we don't take a hard dependency on HAL. The removal of the last Glade file represents the eradication of any hard obsolete GNOME 2.0 dependencies. Exciting!

As a quick aside: what was really nice about the porting from Glade to C# was the use of C# 3.0 features - specifically type inference and object initializers. This permits interface construction using a more terse syntax than available in C# 2.0, yielding improved readability and organization. For instance:

var table = new Table (2, 2, false) {
RowSpacing = 12,
ColumnSpacing = 6
};

table.Attach (new Label () {
Text = Catalog.GetString ("Station _Type:"),
UseUnderline = true,
Xalign = 0.0f
}, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

Bring it on, GNOME 3.0. We are ready!