- if (icon) { /* Icon will be used. */
- e->data.normal.icon = RrImageFetchFromFile(ob_rr_icons, icon);
+ if (config_menu_show_icons &&
+ obt_xml_attr_string(node, "icon", &icon))
+ {
+ RrImage *ic;
+
+ ic = RrImageCacheFindName(ob_rr_icons, icon);
+ if (ic)
+ RrImageRef(ic);
+ else {
+ ic = RrImageNew(ob_rr_icons);
+ if (!RrImageAddPictureName(ic, icon)) {
+ RrImageUnref(ic); /* no need to keep it around */
+ ic = NULL;
+ }
+ }
+ e->data.normal.icon = ic;
+