static string InternalGetStockIdFromResource (RuntimeAddin addin, string id, Gtk.IconSize size)
{
if (!id.StartsWith ("res:", StringComparison.Ordinal))
return id;
id = id.Substring (4);
int addinId = GetAddinId (addin);
Dictionary<string, string> hash = addinIcons[addinId];
string stockId = "__asm" + addinId + "__" + id + "__" + size;
if (!hash.ContainsKey (stockId)) {
System.IO.Stream stream = addin.GetResource (id);
if (stream != null) {
Gdk.Pixbuf pix1, pix2 = null;
using (stream) {
pix1 = new Gdk.Pixbuf (stream);
}
stream = addin.GetResource2x (id);
if (stream != null) {
using (stream) {
pix2 = new Gdk.Pixbuf (stream);
}
}
AddToIconFactory (stockId, pix1, pix2, size);
}
hash[stockId] = stockId;
}
return stockId;
}