RSS Feed

Haskell, GTK, Glade on Fedora 15

0

June 27, 2011 by Garrett Mitchener

I ran into a problem this week with Glade and GTK and GTK2HS.  The problem is that most of Fedora 15, including Glade 3.10, is built on GTK version 3, but the Haskell package GTK2HS (packaged as ghc-gtk-0.12.0-4.fc15.rpm) requires GTK version 2.  Specifically, Glade produces an XML file representing a GUI that can be read by a GTK Builder object, but the files produced by Glade 3.10 won’t work with GTK version 2:  In GTK v2, horizontal and vertical boxes are represented by HBox and VBox objects, and  plain old Box is an abstract base class.  In GTK v3, there are no HBox and VBox.  Instead, the Box class is concrete, and you make it a horizontal or vertical box by setting a flag in a Box object.  Glade 3.10 builder files use the GTK v3 convention for boxes, even when you set a preference that the file should target an earlier version of GTK, so when I tried to load one using a Haskell program and GTK2HS, it complained about trying to instantiate the abstract Box class, then crashed.

You can get an older version of Glade 3.6 from Fedora 14, but I was a bit concerned about potentially unfixed bugs in that version.  The solution I came up with was to build and install Glade 3.8, which unfortunately was never packaged for Fedora.  This slightly older version of Glade uses only GTK v2 stuff, and so far it’s producing files that work with GTK2HS.

If you’d like to use it, here are my RPMS built by updating a glade3-3.7 package from Fedora’s Koji system:

glade3-3.8.0 source RPM

glade3-3.8.0 i686 RPM and the also-necessary glade3-libgladeui i686 RPM

You’ll also need to add a line like this to /etc/yum.conf so that yum won’t try to upgrade to version 3.10 all the time:

exclude=glade3*

 

Another option would be to post-process Glade’s files using an XML tool perhaps.


0 comments »

Leave a Reply

Your email address will not be published. Required fields are marked *

Skip to toolbar