Buzzer Beater

I have been rather quiet on the code frontier lately. It’s not a result of anything more than working on my own personal projects and spending entirely too much time away from my computer. (That and getting everything in order for UDS.) So I decided I’d share a teensy, tiny bit of what I’ve been working on, since I’m excited about it…

Some time ago on the Nautilus mailing list, the discussion came up about so called “Miller Columns“; Apple calls this “NSBrowser”, and it has a ton of history as far as tree visualizations go, dating back to the Smalltalk guys in the 70s. I managed to bang together a little demonstration that took only a few hundred lines of C (I had some weird problem with Vala that it didn’t want to work back then). It looked like this.

I coded that up, and promptly forgot about it. I thought that actually implementing it correctly over GtkTreeViews and GtkTreeViewColumns was going to be an absolute nightmare, and I thought nothing more of it.

Until my pet project needed a way to visualize a tree of items. Sigh.

The basics of the beast work fine, but there are still a ton of details to work out before it’s up to snuff for my project (and who knows, maybe Nautilus next?) The TreeView itself is an HBox, which has a new TreeView packed in every time the selection changes and any views further down the widget are destroyed. Each TreeView has a model that is set from a filter model of the previous model, so that we’re only seeing the section of the tree we want in each cascaded tree.

The columns were actually the biggest problem I hit, as you can’t add a GtkTreeViewColumn into multiple GtkTreeViews; instead, I created a class that has almost the same interface as GtkTreeViewColumn (with some details needingly removed, and some details left to be reimplemented under the new class), but creates a new column every time a new GtkTreeView is packed into the parent TreeView. All of the new columns properties are linked to the central column, such that when someone changes the TreeViewColumn in any way, all of the created TreeViewColumns are also automatically updated with the same details.

It’s still very much a work in progress, and it needs a good cleanup before I go any further on it. But it was interesting enough for me to want to share it. If you’re interested in any more details, you can email me about it or find me on IRC. For now it’s shelved so that I can go back to work on hating GooCanvas’s silly canvas API and my pet project (and yes, I’ll announce more details when it’s actually more than fairy dust and graphite on sheets of tree).

Published by

awalton

Just a GNOME hacker living in Kentucky.

Leave a Reply

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