jongsmamm

Thoughts and updates on open-source programming, C++, and GNOME

Sunday, October 15, 2006

Icon theme cache issues

So I spent a good deal of saturday chasing down a bug in Agave that was reported by somebody trying to make a Debian package of it. Some time ago, when the second "GNOME Goal" was introduced for Installing theme-friendly icons, I decided I'd do that to Agave as well. (By the way, those little goals were kind of a nice way for new contributors to feel useful, are there plans for any more?). Everything worked fine until a couple days ago when I had a report of a crash when installing the application to /usr due to an icon not being found in /usr/local/share/icons/hicolor/...

Why was it looking in /usr/local/...??? I scoured my source code for hard-coded references to /usr/local, and not finding any, I sat scratching my head for a good long while. Now, somebody more familiar with gtk icon theme issues may have recognized the problem immediately, but it took me quite a while to figure it out, so I thought I'd post the solution in case anybody else runs in to the same issue. The problem only shows up if you've first installed the application to /usr/local (the default) and then uninstalled it and installed it to /usr.

The GNOME Goal page mentioned above suggests an install-data-hook rule which updates the gtk icon cache after the program's icons are installed. So the icon cache in /usr/local gets updated when you first install the program to /usr/local. Unfortunately, after uninstalling the application, the icon cache is not updated, so gtk still thinks there are application icons located under /usr/local.

Since /usr/local/ is in the icon theme search path before /usr, when the application is installed to /usr, it will find the stale icon cache in /usr/local and think it found the icon you've requested. Unfortunately the icon that it 'found' has already been deleted, so it will try to load an icon from /usr/local that doesn't exist, and the program crashes. The solution is to simply add an uninstall-hook that also updates the gtk icon cache so that you don't have a stale icon cache after you run `make uninstall`. Something like the following:


gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook: update-icon-cache
uninstall-hook: update-icon-cache
update-icon-cache:
        @-if test -z "$(DESTDIR)"; then
                 echo "Updating Gtk icon cache.";
                 $(gtk_update_icon_cache);
         else
                 echo "*** Icon cache not updated.  After install, run this:";
                 echo "***   $(gtk_update_icon_cache)";
         fi

Friday, October 13, 2006

First Snow has Fallen

I've recently added a simple breakpoint list widget to nemiver, and a few other minor things. Dodji's added a few cool new things lately as well, including showing the value of a variable in a tooltip when you hover over it. There's still no release yet, so you'll have to pull from svn for now if you want to try it out.

nemiver-breakpoints

This weekend Joanne joins me at the ripe old age of 29, so we have a big party planned. Happy birthday Joanne.

Also, I've finally gotten around to gimping up a disembodied head for myself. So if the powers-that-be would like to install the following image as my spokes-head on planet GNOME, feel free.

hackergotchi

Thursday, October 05, 2006

First Sighting

We had a doctor's appointment this morning, which involved our first ultrasound. We've been trying to avoid as much of the medical birth industry as we can, and do things as naturally as possible (see the Bradley Method), but we decided to do an ultrasound anyway, and I must admit that it was pretty fascinating to see it moving around in there. It looks like it's probably going to be a girl. yay!

I also stumbled upon a ticket for today's playoff game between Minnesota and Oakland. My boss had a couple tickets but his friend got sick so he had an extra, which meant a half day off of work for a baseball game. Unfortunately, the Twins lost the game, but I still got my first taste of live playoff baseball, which was a blast (though the sheer volume of the noise in the dome left me with a bit headache).

Good days. I love 'em.