Icon cache doesn't update

openSUSE 11.3 with GNOME

Whenever I install a new application, that application’s icon is broken (shows the generic “application” icon) until I run gtk-update-icon-cache on /usr/share/icons/hicolor. The package manager must not be updating it correctly, but for what reason I’m not sure.

Any ideas?

It’s a long debate. GNOME needs that gtk-update-icon-cache, but KDE doesn’t needs anything since it’s able to detect automatically new icons. Since gtk-update-icon-cache supposes some overhead (more because RPM lacks a feature) and openSUSE is mostly a KDE distro (more KDE users and packagers) historically the position that GNOME is the thing that needs to be fixed won.
Ideally RPM will be improved… but we have been waiting for that a long time already.

So… yes, you need to run gtk-update-icon-cache manually (or install from YaST, that run SuSEconfig after installs).

But I am using yast, and it’s an issue I’ve only noticed relatvely recently. I’m assuming something’s missing from suseconfig, but I have no idea why or what.

/sbin/conf.d/SuSEconfig.gtk2 is the file that contains the code. You should see a “Executing /sbin/conf.d/SuSEconfig.gtk2…” line if you execute SuSEconfig from the console.

Well, that explains the problem, since /sbin/conf.d/SuSEconfig.gtk2 doesn’t exist. Is there a way to restore it?

It is contained in the “gtk2” package. In the worst case, reinstall it.

It looks like the gtk2 package was uninstalled when I upgraded to GNOME 2.32, and it isn’t available in the repository (Index of /repositories/GNOME:/STABLE:/2.32/openSUSE_11.3). Re-installing it would require a bunch of downgrades to the openSUSE 11.3 main repository, so I’m not sure how to get it.

$ rpm -qp --changelog 'http://download.opensuse.org/repositories/GNOME:/STABLE:/2.32/openSUSE_11.3/x86_64/gtk2-devel-2.22.1-1.3.x86_64.rpm' | grep -A2 'Remove.*SuSEconfig.gtk2'
- Remove the remaining part of SuSEconfig.gtk2: the icon theme
  cache updating mechanism is now handled directly by all
  appropriate packages.

The last part is IMHO plain wrong. This has never been agreed in the packaging mailing list (even if there was an attempt). And since EVERY package with icons, not just the GTK/GNOME related ones, has to be modified Gnome people alone have no control about it.

So, ask in the opensuse-gnome ML or open a bug report (openSUSE:Submitting bug reports - openSUSE).

Gnome looks for icons in $XDG_DATA_DIRS/icons/<theme>/… If the application doesn’t installl an icon in the theme you’re using for Gnome, this application won’t have an icon under Gnome. Gnome also looks for icons in /usr/share/pixmaps and /usr/local/share/pixmaps. I usually symlink missing icons in that directory. I’ve seen that Gnome applications normally run gtk-update-icon-cache during installation while building Gnome and other apps from source under differents BSD OS. I removed that line from many packages installation scripts to save time, never had problem with icons as I knew where to look for them … Not to mention that you can write an absolute path in the .desktop files which start the applications, although this is not the most elegant solution. Not sure it was the answer you were expecting.

So far, I’ve always been able to fix broken icons by running gtk-update-icon-cache, but I didn’t always have to and it’s a little bit of a nuisance. The packages correctly install the icon, but they’re not displayed until the cache is updated, which neither YaST nor the packages themselves seem to do at this point. This has been a problem with Anjuta and Liferea, and probably a couple more that I can’t remember right now.

On a bright note, it looks like the Asunder package maintainers have added the necessary code to correctly update the icon cache. Unfortunately, until all major packages get an update that does the same, it looks like this might be a problem for a while.