• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Icon for prefPane bundle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Icon for prefPane bundle?


  • Subject: Re: Icon for prefPane bundle?
  • From: David Remahl <email@hidden>
  • Date: Wed, 17 Apr 2002 03:04:01 +0200

> On 4/13/02 email@hidden (David Remahl) wrote:
>
>> 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.
>
> The reason I started this thread was to see if I could automate the inclusion
> of
> a custom icon in a preferences pane (by, e.g., adding a build phase to a PB
> project). So, umm, I guess you may consider this a request!
> --
> Jonathan Feinberg email@hidden Inwood, NY, NY
> http://MrFeinberg.com

Ok, I have to admit this took a bit more than the expected half an hour,
because of screwy Carbon stuff, but now it is done. I added two methods:

- (BOOL) setAsCustomIconForDirectory:(NSString*)path;
- (BOOL) setAsCustomIconForDirectory:(NSString*)path
withCompatibility:(BOOL)compat;

to the IconFamily class (homepage.mac.com/troy_stephens/). They set the icon
represented by the IconFamily as the icon of the folder described by path
and tells the finder to refresh its view.

Some code you could put in a build phase would be:

IconFamily *iFam = [IconFamily
iconFamilyWithContentsOfFile:@"/PathToYourIcon/Icon.icns"];

iFam = [IconFamily setAsCustomIconForDirectory:@"/PathToYourFolder/Folder"];

And that should do the trick! The only problem is that IconFamily requires a
link to the window server and use of NSImage et al, so it will have to be a
UI-less AppKit program.

I have submitted the code to Troy Stephens, the maintainer of the class, but
if anyone wants the code for my method before he has time to put it up, feel
free to drop me a note.

/ Sincerely, David Remahl
_______________________________________________
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.

  • Prev by Date: Re: Dynamically loading NIB files into sheets
  • Next by Date: Re: Hello, a book recommendation request, and a question
  • Previous by thread: Re: Icon for prefPane bundle?
  • Next by thread: initWithWindowNibName not loading window?
  • Index(es):
    • Date
    • Thread