Those icon paths are standardized by the Icon Theme Specification. The reasoning is that all applications can install their default icons into the hicolor
theme (which is the default theme, meaning that if an icon is missing from another theme, the version from hicolor
will be used.)
Also, a program can request an icon size that is different from the ones provided, say 37x37, and the system will select the most appropriate available size (like 32x32
) and scale it to the requested size.
If someone wants to override the application's icon, for example to make a high-contrast black-and-white version for users with poor eyesight, then all they have to do is to make an icon with the same name and put it in the high-contrast black-and-white theme, and it will override the hicolor
icon.
The functions you ask about also exist. In GTK there are functions that take a const gchar *icon_name
parameter, such as gtk_image_new_from_icon_name()
. These will load the icon with the name you supply from the current theme, and if it doesn't exist in the current theme, then from the hicolor
theme.