Sorting Icons Theme Mess

In my long-running series on why themes are evil, I bring you the newest installment.

Consider the gtk stock icon GTK_STOCK_SORT_ASCENDING which is supposed to represent sorting elements to make them increasing according to some order, typically numerically or alphabetically. The icon for such an action is supposed to somehow convey what happens when it is pressed, all in, say, 24×24 pixels.

Take a look at different themes and how they implement the icon:

eog `find /usr/share/icons/ -print | grep sort-ascending`

This command will show you the icon images with some duplication due to multiple sizes.

Observations:

  • Some show an up-arrow, others show a down-arrow. Yet others show a diagonal arrow which isn’t as bad as it sounds because such arrows are annotated.
  • Some arrows have no annotations, some are annotated by “1..9”, and yet others are annotated to “a..z”.

Officially this is a mess[tm]. When annotations are present they hint at either numerical or alphabetical ordering which may or may not match what the application does. That’s minor. But when no annotations are present, the situation is far worse: my sort-ascending button looks like someone else’s sort-descending simply because of theme differences!

I don’t know how this mess came about, but it ought to be resolved. I suggest that when the icons look like vertical arrows, sort-ascending should point down because the elements of a list will then be increasing in the direction of the arrow.

Hunting Leaks in GTK+ Applications

Hunting leaks in GTK+ application used to be fairly simple: you would run your application under Purify (or, later, Valgrind) and the leak reports would pretty much tell you where to go plug.

That was a long time ago. In the meantime, GTK+ has gotten more complex over its iterations with more caches, more inter-object links, and deliberately-unfreed objects. On top of that, Valgrind and Purify are not particular well suited for finding the cause of leaks: by design they will tell you the backtrace of the call that allocated memory which was never leaked. In a ref-counted world that information is often quite insufficient: the leaked widget was allocated by the gui builder — oh goodie! What you really want to know is who holds the extra ref.

Enter the gobject debugger first introduced by Danielle here. After some major internal work, it has become mature.

I used this for Gnumeric, which was already one of the strictest leak-policed applications in GTK+ land. We leaked a number of GtkTreeModel/GtkListStore objects, for example. Easily fixed. Also, when touching print code or file choosers we leaked massively: one object per printer and/or two objects per file in the current directory. A sequence of bug reports (646815, 646462, 646446, 646461, 646460, 646458, 646457, and 645483) later, GTK+ is now behaving much better. All but the last of these have been fixed. With this, we are down to leaking about 20 Gtk-related objects: the recent-documents manager, im-module objects, the default icon factory, and theme engines. Basically stuff that GTK+ does not want to release.

Please try this on your applications, especially if they are long-running. I still have to kill gnome-terminal, banshee, metacity, and gvfsd from time to time when they grow to absurd sizes. That doesn’t have to be caused by GObject leaks, but it might very well. (I know some of these samples are obsolete; I am not naive enough to believe their replacements would fare any better.)

This might be a good time to remind people that g_object_get and gtk_tree_model_get will give you a reference when you use them to retrieve GObjects. You need to unref when done. The problem is that it is not immediately clear from the g_object_get/gtk_tree_model_get call whether existing code is getting objects, so a certain knowledge of the code is needed.

OpenSUSE 11.2

I decided to give a new OpenSUSE 11.2 a spin. In hindsight, that was probably a mistake.

The new version installs a desktop-optimized kernel. The idea sounds good, but for me it does not work: named consistently causes an Oops or a kernel panic. (I haven’t otherwise had a kernel panic for many, many years!) I reverted to the so-called “default” kernel and the system seems to suffer only a loss of my confidence.

Somewhat more worrisome is that the system seems to have no bladder^Wfan control. The fan remains off until the temperature reaches crazy levels. Then the fan turns on full-blast and remains on until shutdown. In the same department, the backlight controls do not work. The tricks that worked in 11.1 no longer do. I am going to try a bios upgrade and see if things improve.

Ideas, anyone? This is a Toshiba Satellite L305-S5944. Drop me a line at mwelinder at gmail.

Update: I really don’t think 11.2 likes me:

  • Emacs’ menus are partially broken. For example, in Dired the menus for Mark/Regexp/Immediate/Subdir are all empty.
  • Valgrind is broken. I get incomplete stack traces for places with full debug info. I get complaints about unrecognized syscalls.
  • The source repository doesn’t seem to be set up right.

But, hey!, it comes with wobbly windows. What more can anyone want?

Goodbye F-Spot, Hello Picasa

I am giving up on F-Spot.

It was a really promising application, but it has never been able follow up on that great start. The worst thing is that it is sluggish. Operations that should be instant — like displaying the next image — are not, but take half a second. (Getting a new camera did not help there!) I used to think it was just my old laptop, but with a new laptop that excuse does not fly anymore.

I have now tried Picasa. It is crazy-fast! For now, I am going to use that. The biggest problem was migrating the F-Spot tags. That problem was solved with the help from a Robert Brown on Google’s help forums.

Basically, you need this script to create album files and then blow away Picasa’s database to force a regeneration.

Interwoven Alignment Preambles

Thomas, that is a fine rant, but I look in vain for the answer to the question of whether you could get work done after spending 15 minutes learning git instead of cursing it for not having the same command line arguments as cvs. I am sure that with counseling you could get over typing “–help” instead of “-h”.

One of my favourite error messages in from TeX. Stuff this into TeX and look in the log:

\halign{#\global\futurelet\foo\relax\cr\cr}
\halign{#\cr\foo}

It will tell you that “Interwoven alignment preambles are not allowed”. A bit cryptic, you might say, but TeX comes with a manual, i.e., The TeXbook which helpfully explains

If you have been so devious as to get this message, you will understand it, and you deserve no sympathy.

The Gtk+ File Chooser Dialog

Whenever I update my OpenSuSE installation, the Gtk+ File Chooser Dialog get worse. This is how it looks for me on OpenSuSE 11.1 when used from Gnumeric. It looks more or less the same from Gedit and Mozilla.

Gtk+ File Chooser Dialog
Gtk+ File Chooser Dialog

I hope I am not breaking new ground when I claim that the purpose of the file chooser is to help the user choose a file. How is that going to happen when the area used for files is less than the size of one button?

I really hope other people are seeing something sane, but this is with a vanilla install, I think. (Note: I mention OpenSuSE 11.1 for reference, not as an assignment of blame.)

OpenSuSE 11.1 First Impressions

I have been running OpenSuSE 11.1 for about a week now. My first impression is that it feels nicer, but that there are severe setbacks that slipped through QA.

  • It seems to boot faster than 11.0. I was never really bothered by the boot time, so I do not have concrete measurements.
  • The 30000-wakeups-per-second bug is gone! Yeah!
  • It’s still Beagle-infested, so everything is dog slow out of the box. I am having a hard time thinking anyone with a laptop really likes to have Beagle on it. Oh well, I simply use rpm to erase anything related to beagle and install Gnu’s locate.
  • Printing on my hplj-3330 works, but I had to force it to use a non-default driver. That’s not a big deal for me, but it fails the Grandma-test.
  • I plug in my camera. I am asked if I want to import photos to f-spot. I do. f-spot then starts but tells me “Could not lock device”. A bit of poking around reveals that gvfsd-gphoto2 needs to be killed for f-spot to work.
  • The Cairo shipped, 1.8.0, is old and has a badly-broken pdf backend. This evidently is known in Cairo land. I wouldn’t expect anything that prints using gtk+ to work right. Also, since Gnumeric’s tests fail, I need to work around that before I can do releases again.

Licensed to Drive

Right now I seem to be licensed to drive. So much so, in fact, that I have six driver’s licenses:

  • my expiring license
  • an interim license I got when I renewed
  • a new license with a mistake in the address
  • a new interim license
  • a new and correct license
  • my trusty old Danish license, good for another three decades

Time to send most of those through the shredder…

Nationalization

It is a wild ride on Wall Street these days.  In case you missed it, the United States have taken over control of certain large financial institutions: Bear Stearns and Co., Freddie Mac, Fannie Mae, and now AIG.  These institutions have been nationalized.

Now go look at news for the word “nationalized”. You will find it for AFP [France] and The Globe and Mail [Canada], for example. You will not find it for Barrons [USA] or Reuters [USA].

It is clearly a hard word for USA based media to use when discussing things that happen the United States. The same media would use that same word in a jiffy if they were describing events in, say, France. (If you go a little further down the list of Google hits, you will find the word, of course. Seeking Alpha has it, for example, although it seems more like a provocation of its readership.)

The take-home message is that US news is heavily censored — not Government censored, but self-censored. Another notable subject that gets this treatment is news from the Middle East.

Suggestion: make sure you do not get all your news from US sources.