[Gtk-sharp-list] Gtk.IconTheme.Default.LoadIcon doesn't appear to work on the Mac

Mijael mikael at lucis.co.nz
Fri Aug 19 02:32:36 EDT 2011

There are two parts to the solution.

The first is to call NSApplication.Init() straight after Application.Init().

The second part looks like this

string fileType = MonoMac.AppKit.NSFileTypeForHFSTypeCode.FinderIcon;
MonoMac.AppKit.NSWorkspace workspace =
MonoMac.AppKit.NSImage folderNSImage = workspace.IconForFileType( fileType
MonoMac.CoreGraphics.CGImage folderCGImage = folderNSImage.AsCGImage(
System.Drawing.RectangleF.Empty, null, null );
MonoMac.AppKit.NSBitmapImageRep folderImageRep = new
MonoMac.AppKit.NSBitmapImageRep(folderCGImage );
MonoMac.Foundation.NSData folderData = folderImageRep.TiffRepresentation;
Gdk.PixbufLoader loader = new Gdk.PixbufLoader( folderData.AsStream() );
pixbuf = loader.Pixbuf;

In case you were wondering.

View this message in context: http://mono.1490590.n4.nabble.com/Gtk-IconTheme-Default-LoadIcon-doesn-t-appear-to-work-on-the-Mac-tp3753799p3754433.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list