I’m trying to understand how icon names are translated in gtk, and not having much luck. Can anybody point me to an explanation? Tutorial, blog, book whatever? Or even the code itself?
How is the string “icon-name” translated into an actual filename (and then into an object). I understand about /usr/share/icons and the Icon Theme Specification but the filenames under the directory often have additional components such as -symbolic and so don’t match the exact name in the spec. How are they matched up and how is the choice made when there are multiple possibilities?
If you specify icon-name as the name, then the icon will be matched to the current icon theme name, and to the size specified when looking up the icon—using gtk_icon_theme_lookup_icon(). In absence of an explicit size, like gtk_image_set_pixel_size() the size is computed by the style.
The -symbolic bit is a separate GTK extension that hasn’t been codified in the specification; it’s a suffix, so if you select icon-name-symbolic you’ll get the symbolic icon if it exists, and if it doesn’t you’ll get icon-name.