1

How could I add a button to the Apple Mail's toolbar?

As i understand, I need to "swizzle" some methods of the MessageViewer class (this is the first responder window of the Mail.app). Thanks to several open source Mail plugins, I managed to implement a basic plugin that can display windows, sheets, react on events.. I also managed to get a class dump of the Mail.app that lists all of the classes/methods of the Mail.app.

I've seen several people claimed to have implemented this, also a free Mail Archive plugin adds a button to the toolbar..

Could you point me in the right direction?

Thank you!

1 Answers1

0

I'm not sure what your problem is.

BetterDictionary is a Dictionary.app plugin I wrote a while back. Check out -(void) initToolbarItems method to see how I've done it (how the app gets there? +(void)load --> -(id)init --> -(void)initToolbarItems).

Pooria Azimi
  • 8,585
  • 5
  • 30
  • 41
  • Hi Pooria! Thanks for the response, it gave me a hint where to move. Your approach doesn't seem to work well on Lion (Mail 5.2) - adding new toolbar buttons with the same identifier as original ones, after Mail restart, make appear several buttons with the same icon.. I guess a NSToolbar delegate has to be "swizzled", in order to make it work right. – user1406340 May 20 '12 at 23:12