7 October 2004


Tomorrow is the Australian Federal Election. It is weird how there are some topics that none of the parties seem to have been bringing up during the election. In particular, they don’t seem to be mentioning about how John Howard lied about the children overboard scandal last election (if he didn’t lie, then he intentionally kept himself uninformed which is possibly even worse). This was a case where information was suppressed until just after the election had finished. If the information had been made public, it could have changed the result of the election.

Hopefully by the end of Saturday we won’t have a Prime Minister who isn’t a spamer and telemarketer.

Jamin: from what those articles say, Michael Moore was offering incentives for people to vote — not incentives to vote for a particular candidate. While I agree that the latter is bad, why is encouraging people to vote bad?

In the Australian elections, I’ve received a postal vote application from my current MP. While I think it would be better if the applications were sent out by the AEC, I don’t think there is anything wrong with encouraging people to vote in this way.

Also, even if you don’t consider yourself a Bush supporter, the people who manage the websites you referenced certainly are. If you want to accuse someone of being a propagandist, perhaps you should choose some less obviously biased news sources.

Hub: there is a preference to get Thunderbird to check all IMAP folders for new messages. It just isn’t exposed in the UI. Instructions for turning it on can be found here.

More Icon Theme stuff

In an email, Jonathan pointed out that simply using gtk_icon_theme_load_icon() by itself is not optimal either. If the user changes their icon theme, you should reload the icon in case it has changed in the new theme.

This is quite easy to handle correctly though, using the "changed" signal of GtkIconTheme:

GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
g_signal_connect (icon_theme, "changed", G_CALLBACK (callback), NULL);

Now callback() will be called when the icon theme changes, at which point you can reload the icon.

What would be nice would be a GtkImage constructor that let you pass in an icon name plus desired size, and handled theme changes for you. Maybe I’ll do a patch for this …

4 October 2004

  • Post author:
  • Post category:Uncategorized

Icon Theme APIs (continued)

Of course, after recommending that people use gtk_icon_theme_load_icon() to perform the icon load and scale the icon for you, Ross manages to find a bug in that function.

If the icon is not found in the icon theme, but instead in the legacy $prefix/share/pixmaps directory, then gtk_icon_theme_load_icon() will not scale the image down (it will scale them up if necessary though).


Jhbuild now includes a notification icon when running in the default terminal mode. The code is loosely based on Davyd’s patch, but instead uses Zenity’s notification icon support. If you have the HEAD branch of Zenity installed, it should display without any further configuration. Some of the icons are a little difficult to tell apart at notification icon sizes, so it would be good to update some of them.


The Double the Fist DVD is great. I hope they do another season, and release the second half of the first season on DVD. It is a satire on extreme sports and reality TV shows among other things, and is worth watching. Apparently it was originally shown on ABC digital, so not many people saw it during its original screening (digital television is fairly new in Australia, and equipment is still fairly expensive).

29 September 2004

  • Post author:
  • Post category:Uncategorized


Ubuntu seems to have taken off very quickly since the preview release came out a few weeks ago. In general, people seem to like the small tweaks we’ve made to the default Gnome install. Of course, after the preview came out people found bugs in some of my Gnome patches …

One of the things we added was the trash applet on the panel. I made a fair number of fixes that make the applet fit in with the desktop a bit better and handle error conditions a bit better.

Probably the biggest fix was adding support for multiple trash directories. Originally the applet would move files to ~/.Trash and didn’t monitor any other trash directories, which meant that moving to the trash took longer than necessary on slow volumes and the applet didn’t correctly reflect the trash’s empty state if you used the “move to trash” context menu item in Nautilus.

One of the problems implementing this was that the trash handling in Gnome is pretty much entirely private to Nautilus. I managed to adapt the Nautilus code into a small class (about 500 lines) that could provide an item count for the trash, notification of changes to the item count, and the ability to empty the trash. A lot of the complexity in this code is to handle plugging and and unplugging of removable volumes. It’d be nice if this kind of code was available in gnome-vfs or something though.

Icon Theme APIs

While working on various Ubuntu fixes, I found an error that seems to be quite common in various bits of the desktop. It goes something like this:

  1. Find the image file for an icon at size n using gnome_icon_theme_lookup_icon() or gtk_icon_theme_lookup_icon().
  2. Create a GdkPixbuf from the image file using gdk_pixbuf_new_from_file().
  3. Use the pixbuf as an nxn icon.

The first problem with this is that gtk_icon_theme_lookup_icon() is not guaranteed to return an image at the desired size. This is quite obvious when you consider that you can pass in an arbitrary size to the lookup function, but the icon theme will only contain a finite number of sizes. However, if you ask for a common sized icon and the icon theme contains that size image, it might appear that the function will always return an image file of the requested size. The fix is to check the size of the loaded pixbuf and scale it if it is of the wrong dimensions.

The second problem is to do with SVG image files. They can be rendered at arbitrary sizes, but gdk_pixbuf_new_from_file() doesn’t tell the loader backend what size is actually wanted. This means that the SVG will be rendered at whatever size is listed in the file itself, which could be very large or very small. To avoid having to resize the SVG image after rendering it (which could be slow), you can use the gdk_pixbuf_new_from_file_at_size() routine (new in GTK 2.4) which passes the desired size to the backend so that ones like the SVG backend can render at an appropriate size. This function will return a pixbuf that fits into the bounding height/width you pass to it, and will perform scaling if the backend can’t load the image at the requested size.

If this sounds complicated, there is an easier way. You can just use gtk_icon_theme_load_icon(), which will lookup the image, and load it at the desired size all in one go. I guess there aren’t many people using it because there wasn’t an equivalent in the older GnomeIconTheme API.

Applets vs. Notification Icons

  • Post author:
  • Post category:Uncategorized

It seems that a lot of people get confused by what things on the panel should be applets and what should be notification icons. Originally, the main difference between the two was this:

  • The lifecycle of an applet is managed by the panel, which in turn is tied to the lifecycle of the session. So applets generally live for the length of the session (unless they are added/removed part way through a session).
  • Notification icons are more transient. Their lifecycle is linked to whatever app they were created by. Once the app exits the notification icon goes away too.

There are some other differences though:

  • Applets can be moved around on the panel while notification icons are constrained to the system tray. If you accept that notification icons are transient then it isn’t that big a deal.
  • KDE also implements the system tray spec, so a notification icon can be used on both desktops (plus any other desktop that implements the spec). In contrast, Gnome applets are Bonobo controls which makes them a bit difficult to use on other desktops.
  • The panel can merge menu items into the context menu of applets, and supports middle click drag to move applets.
  • The system tray is supposed to be able to display “message balloons” for the notification icons. This doesn’t seem to work properly though. The reason for getting the system tray to show the balloons is so you don’t get multiple applets popping up such notices on top of each other, and to make it easier for the user to manage such notifications.

Due to these differences there are a number of notification icons such as Novell’s netapplet which more closely follow the lifecycle of an applet but are notification icons for cross desktop compatibility.

While talking with Mark on IRC, it became apparent that a number of the applets included with Gnome aren’t strictly linked to the session’s lifetime. For example, my laptop has a PCMCIA wireless adapter, so I put the wireless applet on my panel to show the signal strength. However, it doesn’t really make sense to display the applet when the card is unplugged.

Similarly, if I share my home directory between a number of computers, it doesn’t make sense to show the volume control applet on systems without a sound card or the battery status applet on systems without a battery. So perhaps these applets shouldn’t really be tied to the panel’s life cycle.

With infrastructure like NetworkManager where there is a user-level daemon used to communicate with the user when necessary, it would make sense for that daemon to provide network status as notification icons. This way the icons would only appear when the associated device was attached. Something similar could be done for the volume control and battery status applets — query HAL to see if they need to be loaded.

However, with such long lasting notification icons you probably want some of the features of applets such as being able to move them round a bit. This indicates that it might not make so much sense to make such a big distinction between applets and notification applets.

I wonder how difficult it would be to extend the system tray/notification icon spec to handle the features applets currently have?. From a quick look, the additional features include:

  1. Some way for icons to cooperate with the panel to handle moving icons around.
  2. Some way to uniquely identify applets so that the panel can place them in the same location next time the icon is created.
  3. Provide some standard context menu items. The standard ones that applets have merged in are “Move”, “Lock” and “Remove from panel”. Only the first two would need additions to handle.
  4. Better size negotiation. An applet can query the width and orientation of a panel when deciding what its size should be. I don’t think a notification icon can do so.
  5. Figure out a good way to start notification icons on session startup.
  6. If notifcation icons can be moved to anywhere on the panel, where should truely transient icons be placed the first time? Currently they are placed in the system tray, which provides a convenient place for the user to expect to see such notifications.

This should also make it easier to provide more full featured panel widgets that work cross desktop. I wonder how feasible it is?