Re: Icon for prefPane bundle?
Re: Icon for prefPane bundle?
- Subject: Re: Icon for prefPane bundle?
- From: David Remahl <email@hidden>
- Date: Sat, 13 Apr 2002 10:18:41 +0200
>
I'm coming onto this thread a bit late -- I'm planning my wedding, so
>
I'm too busy to keep up with the list right now. However, I found it
>
searching the archives just today:
You're getting married!? Congratulations, Ben!
>
>> Has anyone attempted to figure out exactly what happens when you paste
>
>> an icon
>
>> into an info window? Perhaps we could automate the process into a
>
>> shell
>
>> script, and add a build phase.
>
>
>
> What happens is the following:
>
>
>
> 1. A file named 'Icon\r' is created inside the folder.
>
> 2. The file is assigned a resource fork containing icns resource -16455
>
> with
>
> the icon. If the original file icon had legacy icon resources, they were
>
> copied as well.
>
> 3. The Has Custom Icon flag of the containing folder (the target) is
>
> set.
>
> 4. Finder is notified of the change and reloads the icon.
>
>
>
> I believe the possibility of making a shell script for automating the
>
> process was discussed on this list or macosx-dev about a year ago (when
>
> Docklings were top fashion). It turned out to be rather difficult.
>
> Making a
>
> simple cli using carbon to do it would probably be easier, even...
>
>
Does anybody have any sample code to do this? Specifically, I'm
>
looking to make an app of mine that saves images be able to save a
>
"preview" icon for each image as well (by user request). Making the
>
preview image is easy enough, but how might one set that image to be the
>
icon for a file? I looked in NSWorkspace and NSFileManager, no joy...
Take a look at IconFamily, a class that I co-authored (although Troy did the
bulk of it!)
http://homepage.mac.com/troy_stephens/. That class would make
the process as simple as:
IconFamily* iFamily = [IconFamily iconWithTumbnailsOfImage:yourImage];
[if setAsCustomIconForFile:yourPath];
And that would be it! If your document format is a _bundle_, that would
require some extra work. Drop me a note if you'd want me to put that
capability into IconFamily. It'd only take half an hour or so, as I'm
getting quite familiar with Icon Services after having worked with Can
Combine Icons.
/ Sincerely, David Remahl
>
Ben Haller
>
Stick Software
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.