• 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: DiskArbitration & Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DiskArbitration & Finder


  • Subject: Re: DiskArbitration & Finder
  • From: "Finlay Dobbie" <email@hidden>
  • Date: Sun, 3 Dec 2006 02:40:57 +0000

AFAIK you shouldn't be waiting for the disk to appear. Wouldn't you
want to register an approval session, register an approval callback
and return a dissenter from your callback?

-- Finlay

On 02/12/06, Stephan Burlot <email@hidden> wrote:
Hi,

I'm playing with DiskArbitration and I am trying to block the
insertion of CD, DVD (and other types of volumes, but it's not
relevant to my question)

I'm sucessful at intercepting the insertion of a CD/DVD and ejecting
it as soon as it is inserted, but, if I leave the CD/DVD prefpane
settings to, let's say, open iTunes when a music CD is inserted,
itunes is launched even if my app ejects the CD. Same thing happens
if I insert a blank CD: the finder asks me what I want to do with it,
while my app is ejecting the CD in the background.

How is it possible to intercept these insertion events, without
changing the CD/DVD prefpane?

my code is as follow:

/* Init */
        mySession = DASessionCreate(kCFAllocatorDefault);
        DASessionScheduleWithRunLoop(mySession, CFRunLoopGetCurrent(),
kCFRunLoopDefaultMode);
        DARegisterDiskAppearedCallback(mySession,
kDADiskDescriptionMatchMediaWhole, diskAppearedCallback, NULL);
        DARegisterDiskDisappearedCallback(mySession,
kDADiskDescriptionMatchMediaWhole, diskDisappearedCallback, NULL);

And the diskAppearedCallback is:

static void diskAppearedCallback(DADiskRef disk, void * userInfo)
{
        NSLog(@"diskAppearedCallback");
        DADiskEject(disk, kDADiskEjectOptionDefault, ejectCallback, userInfo);
}

Thanks for any help,
Stephan Burlot


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: DiskArbitration & Finder
      • From: Stephan Burlot <email@hidden>
References: 
 >DiskArbitration & Finder (From: Stephan Burlot <email@hidden>)

  • Prev by Date: Re: NSWindowController subclass initialization
  • Next by Date: Trouble with draggable cells in NSMatrixView
  • Previous by thread: DiskArbitration & Finder
  • Next by thread: Re: DiskArbitration & Finder
  • Index(es):
    • Date
    • Thread