GSoC/GCI Archive
Google Code-in 2011 Haiku

Update Layout Building Code in FileTypes Preflet

completed by: Hannah

mentors: Alex Wilson


During early development of the Haiku Layout API, helper classes were developed to make it easier to code your layout, these classes are:

  • BGridLayoutBuilder
  • BGroupLayoutBuilder
  • BSplitLayoutBuilder

As time progressed, so did the Layout API, and a new approach was developed. The classes above have been replaced with similarly-named inner classes of BLayoutBuilder. These classes are documented on, with an overview of the classes here. As the layout API progresses towards being made public, the older layout builder classes must go. (This is where you come in!!) Luckily, the two approaches end up looking very similar in code, so it isn't too tricky to transition to the new classes.

For this task, you need to replace the usage of the old builder classes with the new ones in the FileTypes preflet GUI, that is:

  • src/preferences/filetypes/

There are many places in the preflet you'll need to work on, but don't worry, once you get the hang of it, you will be able to make these changes very quickly. (Feel free to carry that momentum on to the other tasks of this type Haiku has provided :) ).

Tip: Make use of tools such as grep, or the code search app here: for better productivity.

One issue to keep in mind is that many apps/preflets use code like this:

SetLayout(new BGroupLayout(...));

Which should be translated to this:

BGroupLayout* layout = new BGroupLayout();


good luck, and god speed. Please remember to test your changes before adding the patch here :)