From: Adam Gardner Date: 2009-02-24T10:00:20+09:00 Subject: Re: RubyCocoa and Mac System Icons Tom Medhurst wrote: > Hi Adam, > Thanks for looking into this for me! > kComputer is defined in the IconsCore.h header file in > CoreServices.framework/LaunchServices.framework. (tried referencing it > as > KComputer, but that didn't work) > > I tried your example and it just returned the generic "unknown > file-type" > icon. :( > > I am trying to load the system icon for the computer... it's really easy > in > Ubuntu to load stock (system) icons, so I am really frustrated when I > can't > seem to figure this out on my lovely mac :'( > > Any ideas..? > Thanks > Tom On my machine, the constant is kComputerIcon, not kComputer, and yes, it evaluates to Root. RubyCocoa isn't going to recognize the Ruby constant KComptuerIcon or anything like it, though, because at least on my machine all that stuff is pure C stuff (not Objective-C) which isn't accounted for yet by custom bridge-support files. You can try fooling around with bridge-support, but I'd just skip kComputerIcon entirely and use what it evaluates to, the string 'root'. That out of the way, according this source: [1], the correct line in Objective-C would be SImage* macIcon = [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode(kComputerIcon)]; To me, that translates as: OSX::NSWorkspace.sharedWorkspace.iconForFileType(OSX::NSFileTypeForHFSTypeCode('root')) so, try that out. [1] http://zathras.de/angelweb/blog-get-standard-system-icons.htm -- Posted via http://www.ruby-forum.com/.