The Engine Driver

Here we are again with the Dictionary hacking; I left my development trunk with barely enough time to close crashers and brown paper bags patchs, and now I’m finally able to return working on it.

Here’s an interesting bug, about the poor discoverability of the look up process. First of all: discoverability? Is that even a word? Who the hell filed that bug? Opened by Emmanue… ehr… looks uncomfortably away.

Anyway, linguistic issues aside, the issue is interesting: some complained that the old Dictionary had a BFB and the new Dictionary has, well, nothing – the word is searched by activating the entry. This makes sense if you are typing the word, but it breaks down if you are pasting a word into the entry as you have to reach out for the keyboard and press enter. The idea was adding a “Go” button, removable by turning off a knob inside GConf. Then I realised that the label bound to the entry could be removed in favour of a button with no relief; it would keep the current appearance of the Dictionary while adding the “mouse-only” interaction requested (and by having a mnemonic, you can also activate the entry using the button’s mnemonic tag). It’s an experiment: the bug I linked has a full patch for the button+GConf knob (courtesy of Stephen Cook, kudos to him), so if people are going to throw themselves out of the window, I’ll gladly forget my solution and apply the patch.

Another couple of squashed bugs: you cannot edit a dictionary source and even if you could, the advanced settings do not work anyway. Both these bugs are really missing implementations of existing features: the source editing was mostly in place before the code freeze of GNOME 2.16, while the advanced settings required two widgets (the database chooser and the strategy chooser) that weren’t ready in time for the UI freeze of last January. Now that I have written both widgets and that I have time to finish what I started, the source dialog has been overhauled, and it allows choosing the database and the matching strategy for the chosen source, both when adding and when editing it.

strategy chooser

Speaking of the strategy chooser, I’ve added it to the sidebar, and like the database chooser allows you to set a matching strategy for the session, so you can use the default strategy (the same set for the source) or whatever strategies the source supports; I’ll add a “reset and use the default” button, which is also currently missing from the database chooser.

Here’s the real tricky bug: adding the speller widget to the dictionary applet. I thought about it, and how integrating the speller inside the applet, now that we have that widget. While inside the application having a sidebar makes sense, the same doesn’t not hold for the applet, as it would make it really big. For this reason, I added the speller widget (and every other page inside the sidebar) as pages of a notebook; you can switch between each of them using a drop-down menu – effectively making the whole applet work like the application’s sidebar.

As for the new features: four months ago I began hacking on a parser for the DICT file format, which is used to store a database (a single “dictionary” in a dictionary source) for dictd to use. It took a bit to get ahold of the actual format, but once found I wrote a small parser object, modelled on the GKeyFile object used to parse the desktop entry files. You can use it to load the dictionary and the index from data, or from file; you can just preload the index or load everything; you can even begin with an empty object, fill stuff and write it down. Unfortunately, it doesn’t support compressed files – but it should be enough for closing this bug, and work as a base for the StarDict dictionary parser (this I’ll have to write really from scratch, as the C++ parser code sucks horribly).

dictionary with syntax highlighting

Finally, from the old-dictionary-feature-ported-to-the-new-dictionary department, the syntax highlighting has come back! Well, not entirely: just the links and the phonetics have been reinstated, and links still don’t work. Links are colored using the gtk-link-color style property, which is also used by link buttons and the like (if your application renders hyperlinks or something like them, please use that style property!). The reason why I disabled the syntax highlighting was that there’s no formal definition for the dictionary syntax: it really can break at any given time – as you’ll see when using it; also, the highlighting code was really messy, so I had to rewrite it and that took time.

All of this is going to hit HEAD this week or so.

There are plenty of other bugs lying around in Bugzilla, though; I hope to have more time during December to look at them and squash some more; but you know the drill: if you have your own pet bug scratch an itch and provide a patch. ;-)

See You When You’re Fourty

Well, it seems I’m not a 0xteenager anymore.

For the hexadecimal-impaired, today I’m 26 years old. Four more years to go before submitting an entry to the GNOME Ol’ Farts Club.

Twist The Knife

Dear LazyWeb:

I’m trying to clean up the python bindings for the next release of a GObject-based library, so I’m using pygtk and its codegen magic; unfortunately, being codegen.py an incredibly bad program, I can’t see why or how it’s failing to read the .defs and .override files, and why it doesn’t generate anything. Is there a way to have some sort of error message or information except for the quite useless statistics recap? I’m using the same build system used by pygtk, so this must work if you apply enough bad mojo somewhere. I don’t want to dwelve into the 1707 lines of dense python – I’d rather spend my time binding a library.

Thanks.

Three hours, and many curses, later: it seems that I have mistakenly deleted a '%%' between a ‘ignore-blob’ declaration and the body of the override file. This, for posterity, is logically equivalent to “ignore whatever exists after this space”. which is, all in all, logically coherent, and I’m more than willing to beat my head against the wall for my stupidity. But if codegen.py had a “verbose” mode (instead of me sprinkling the code with “print” statements) I would have found this way sooner than the three hours it took me. A simple line redirected to stderr telling me “hey, I’m ignoring this and that” would have been sufficient.

Song for Sunshine

I just made two releases for gnome-utils: the first is 2.16.2, another release in the stable branch, which fixes a couple of bugs in Baobab and Screenshot that were also fixed in HEAD and deemed important enough to be backported.

The second release is – finally – 2.17.0, the first release of the new unstable release cycle which will lead to gnome-utils 2.18.0.

The major change in this release is in Baobab, which acquired the new, spiffy, cairo-based ringchart view, thanks to the hard work of Fabio, Paolo, Alejandro and Miguel. Baobab also dropped the search option, which mostly replicated the Search Tool already included in gnome-utils. Baobab user interface was cleaned up, its memory consumption was reduced and many bugs were fixed.

The other modules in gnome-utils got some love, but not much; my development tree still doesn’t build well and it’s not ready for inclusion in HEAD, but I plan to work on it before the next release.

As usual, download, test and file bugs.

Little Earthquakes

After two weeks without working on it, this evening I finally returned to GtkUnique and finished the bacon-like backend. Now, beside using D-Bus and Xlibs, you can use Un*x sockets as an IPC method to send a command to a running instance of an application which is using GtkUnique.

Next items in the TODO are:

  • Add more documentation on the protocol used in the three backends;
  • Fix the Perl bindings;
  • Finish and publish the Python bindings;

In the meantime, you can grab GtkUnique 0.5.0 here or pull it from the bazaar repository.