Re: Displaying ICON for Device in Finder
Re: Displaying ICON for Device in Finder
- Subject: Re: Displaying ICON for Device in Finder
- From: Gore <email@hidden>
- Date: Fri, 18 Jan 2002 12:32:35 +0200
a little warning, I havn't compiled this oor tested it, but this should
just work fine =)
// NSWorkspaceDidMountNotification is the notification name you shall
register first of all...do it like this:
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
selector: @selector( mountDeviceNotification: )
name: NSWorkspaceDidMountNotification
object: nil];
// notice the [NSWorkspace sharedWorkspace] ,not [NSNotificationCenter
defaultCenter] !
- (void)mountDeviceNotification:(NSNotification *)notifi
{
NSString *devicePath = [[notifi userInfo] objectForKey:
@"NSDevicePath"];
NSString *linkPath = [@"~/Desktop/MyDevice"
stringByExpandingTildeInPath];
/* create a new link to the mounted device */
[[NSFileManager defaultManager] createSymbolicLinkAtPath: linkPath
pathContent: devicePath];
/* set the icon-image */
[[[NSFileWrapper alloc] initWithPath: linkPath] setIcon: [NSImage
imageNamed: @"myIconImage"]];
}
This code will put a link to the device when it is mounted.
On Friday, January 18, 2002, at 10:35 , Sandeep Waghmode wrote:
Hello Everybody,
I wanted to display a ICON representing a device dynamically.(For
FireWire device)
(Like when you insert the CD then the Finder will display CD Icon ).
What are the possible ways of implementing this?
I am thinking of using Finder plug-ins. But I have no information
about how to write
plug-ins for Finder. (Whether it is possible? If possible where I can
get more information
regarding writing plug-ins for Finder?)
Also whether Finder uses Component Manager. Such that I can write a
Component & Finder will use that Component to display device when it is
present.
Or some other way such that when my application detects the device,
then it shall
inform the Finder such that Finder will display ICON?
Thanks in Advance.
Sandeep
_______________________________________________
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.