• 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: Updating the Dock Trash icon when trashing a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating the Dock Trash icon when trashing a file


  • Subject: Re: Updating the Dock Trash icon when trashing a file
  • From: Jeremy Dronfield <email@hidden>
  • Date: Tue, 30 Nov 2004 11:00:48 +0000

On 29 Nov 2004, at 9:22 pm, Jeremy Dronfield wrote:

In my application, the user can move files to the trash with a Command-Backspace keystroke. Although the selected files are getting moved to the trash properly, the Dock trash icon doesn't update itself to its "items-in-trash" look. It updates itself once you click on it, but should do it automatically. I've tried sending an -[NSWorkspace noteFileSystemChanged] (both types, with and without the relevant path), but it doesn't do anything. What am I missing?

(By the way, I'm using NSFileManager, not NSWorkspace, to move the files.)

Replying to myself again. Using NSWorkspace instead of NSFileManager did the trick. It has three other benefits beside updating the trash icon: you can pass the files as an array, so don't need to move each one individually; you don't need to set up the path to the user's trash directory; and it handles the renaming of duplicates automatically. In my case, this saves about 20 lines of code.


I've yet to discover whether it has a performance hit when moving large numbers of files.

Regards,
Jeremy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Updating the Dock Trash icon when trashing a file (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: NSImage and 8 bit
  • Next by Date: Re: LSUIElement does not work as documented?
  • Previous by thread: Updating the Dock Trash icon when trashing a file
  • Next by thread: Strange behavior from custom NSFormatter object
  • Index(es):
    • Date
    • Thread