Monthly Archives: January 2011

Day 1 at Mozilla Messaging: Getting my hands dirty…

So today was my first day working for Mozilla Messaging.

And it was awesome.

Now, I know that I had originally told you that I’d be working on Thunderbird + Unity integration.  That’s still on my TODO list, but today, I put some contributions in with the Firefox team for the upcoming Firefox 4 release.  There are still a few bugs that need to be squashed before Firefox 4 is ready for the prime-time, and we’re all psyched to see it happen, so I lent a hand.

This was the bug I decided to tackle today. Basically, in the new add-ons manager, add-ons are listed alphabetically, regardless of their state (and by state, I mean enabled, disabled, incompatible, blocked, etc).  This leads to kind of a strip-ey look for large numbers of add-ons.

What we’d like instead is to have the add-ons grouped by state, and then sorted alphabetically within that state.  Here’s a mock-up by bug-reporter (and Firefox UX team member) Jennifer Boriss:

Add-ons in list, grouped by status

I got to work around 8:45AM this morning.  Around 10:13AM, I had finished most of my introductions, had my tour, had my accounts set up, found my desk, and started work.

The first thing I did was locate where exactly the code was for listing the add-ons.  Blake pointed out a particularly useful resource called MXR (Mozilla Cross Reference), which lets me search through the source code very quickly.  I had originally been using grep, but this was way better.

My approach to finding the code:  I find a string in the interface that seems unique to the area I’m working in (in this case, it was “Search all add-ons”, which is found in the search text input of the add-ons manager).  I did a search for that string, and it returned the file mozilla-central/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd.

But this only takes us half-way.  Since Firefox is translated, the strings are stored separately from where they’re used.  In extensions.dtd, the string I searched for is given the key “search.placeholder”.

Searching for “search.placeholder” with MXR gives me paydirt:  mozilla-central/toolkit/mozapps/extensions/content/ holds the files extensions.css, extensions.js, extensions.xul and extensions.xml.

So I tool around in extensions.js a bit, reading the developer documentation, and getting to know the code.  The code contains quite a few classes, including something called gViewController.  Digging deeper into it, it looks like gViewController controls (brings up, shuts down) the various “views” available in the add-ons manager.  Cool – so now I just need to find the view that lists the user’s add-ons.

Ah hah!  Found it:  gListView.  gListView grabs all of the installed (or to-be-installed) add-ons, and populates the interface.  So this is where the sorting needs to happen.  I tested to make sure I was in the right place in the code by using dump calls to a terminal.  Bonus:  edits in this portion of the code do not require a full browser restart – instead, I just close and reopen the add-ons manager to see my changes.  Nice!

Initially, my idea was to have 4 “buckets”, one for each of the 4 states (“enabled”, “incompatible”, “disabled”, “blocked”).  I’d divide up the add-ons into those 4 buckets, and then sort each bucket, and then join the 4 buckets for the final result.

Blake came up with a better solution: the Schwartzian Transform (straight out of Space Balls, I know).  The idea is that, instead of having separate buckets like before, we just go through the entire collection of add-ons, and “label” them based on what bucket they belong to.  Then we sort the entire collection, giving the bucket-label a high-order sorting priority.  It sounds complicated, but it actually wasn’t that difficult to code.  It’s a tiny piece of code, its readable, and quite elegant.  So kudos to Blake for that solution.

Anyhow, I wrote my patch.  I just figured out how to run the interface tests for Firefox (they use something called Mochitest).  I set those tests off on one of the fast machines in the office, packed up my gear, and headed home.

It was a solid days work.  Tomorrow, I hope to write some new tests for the Schwartzian transform, and submit my patch to Bugzilla.  Woop!

Starting Work on Mozilla Thunderbird

With the Winter holidays drawing to a close, I’m really looking forward to starting the next chapter of my life – namely, my new job at Mozilla Messaging working on the Thunderbird e-mail client.

In just a little under a week, I’ll be knee-deep in a code-base larger than any I’ve ever worked on before.  And I’ll be working with some of the best software developers in the world.

I’m pretty stoked.

So, what exactly will I be doing for Thunderbird?  What project will I be starting my work with?  I’m so glad you asked…

Thunderbird + Unity = Badass

Ok, that’s not technically the code-name for the project, but I think it more or less conveys my feelings about the whole thing.

So here’s the story in a nutshell:

Ubuntu Linux is one of several operating systems that Thunderbird runs on (the other big ones being Mac OSX and the various flavours of Microsoft Windows).  I use Ubuntu as my primary operating system – I’m comfortable with it, and I like it.

In the coming months, there will be a tectonic shift of sorts in Ubuntu.  The graphical user interface that most Ubuntu users are used to (the GNOME Shell) will no longer be the default.  Instead, Canonical, the makers of Ubuntu, have created their own user interface to run on top of GNOME.  That interface is called Unity, and will be made default in the Natty Narwhal release (due to come out on or around April 28th of this year).

Just to make sure we’re clear on this:  Ubuntu is not dropping GNOME.  The GNOME Shell is the icing on the whole GNOME Stack.  Canonical has just decided to put their own icing on the cake.

So, anyhow, my job is to make Thunderbird work nicely with Unity in time for the April 28th release.

And by “work nicely”, I mean the following:

The Global Menu Bar

If you’ve never used Mac OSX, it’s likely that you don’t know what a global menu bar is.  Here’s the idea:  in Windows and Ubuntu, each window tends to have its own menu bar (File, Edit, etc…).

In Mac OSX, and the upcoming Unity shell, instead of having these individual menu bars, we have a single, overarching menu bar. This menu bar changes itself every time you switch application focus.

Here’s some guy demonstrating the global menu in Ubuntu Linux:

Currently, Thunderbird doesn’t “play nice” with Unity’s global menu bar, and just displays the menu within the Thunderbird window as it always has.

My job is to get Thunderbird to use the global menu bar properly.  Click here to read more about Ubuntu Unity’s global menu bar.

The Messaging Menu

Ubuntu Unity also sports a shiny new messaging menu.  The messaging menu aggregates all sorts of message-related information – and that includes e-mail messages, chat messages, social networking messages, etc.  It tosses all of these into a nice, clean, simple notification interface, like this:

Ubuntu Unity Messaging Menu

It’s up to messaging application developers to leverage this feature in Unity, and that’s where I come in.  I’ll be getting Thunderbird to work nicely with this messaging menu.  Click here to read more about Ubuntu Unity’s messaging menu.

The Task List

Ubuntu Unity also sports a new application launcher.  The launcher is a panel that stretches down the left-hand side of the screen, and allows users to quickly find and execute their applications.  It also lets users know which applications are already open.  In a way, it is very similar to the Mac OSX dock.

Here is a Canonical designer demonstrating the new launcher:

Unity Launcher Introduction from Canonical Design on Vimeo.

Right-clicking on an item in the launcher brings up a context-menu for the selected application.  For Thunderbird, we’ll probably want the context menu to allow users to do some common operations, such as fetching mail, and composing a new message.  We’ll probably also want to display the number of unread messages.  So that’s what I’m going to be looking into there.

I’m looking forward to tackling these problems!  I’ll keep you posted on my progress.