Now Playing on Flynn's Arcade Radio: Random - Spontaneous Devotion

Armagetron Servers

Turbo Teamplay: No players online
Brakes: No players online
Flynn's Arcade Network:
1 players online
How to Reuse a Growl Notification E-mail
Written by C10ud   
Thursday, 19 June 2008

Ok, so Growl is an absolutely AMAZING notification system for Mac OS X users. It pops up these sweet notification windows in a corner of your screen and many OS X apps will send notifications (such as Firefox telling you that your downloads are done). If you don't have Growl on your Mac already, I highly recommend getting it (http://growl.info/ ).

That said, I am currently developing an application that makes good use of these notifications. The default behavior if you don't know how to do it differently is to pop up a new notification every time you send a call to the GrowlApplicationBridge (which is what your Cocoa apps use to communicate with Growl). This is great if that is the behavior you want, but I wanted behavior like GrowlTunes. I suppose I could have torn apart the code for GrowlTunes, but I didn't feel like it after I saw that it used both the Cocoa AND Carbon frameworks, so I just... well, yeah I was lazy. Either way, I figured that I, like any good developer, would check out the documentation first. Sounds like a plan, I poked around the Growl site a bit and finally found all 2 pages of Growl documentation that pertained to Cocoa apps. Sorry guys, I'm going to try to say this as nicely as possible... Your documentation is somewhat lacking. There isn't really any example code, and there isn't even an API reference!

Anyways, going back in time a bit, I did get Growl's development Framework installed and had my application displaying messages. Back to our problem though, how to keep reusing a notification? Well, there is one method documented on the main Growl developer docs page, but unfortunately, it is only for Carbon and the table cell above it says "There is not currently such a procedure for Cocoa." Not sounding very promising so far. Well, to make a long story short, what I ended up doing was digging around the header file and I found that there are several overloads for the notification method. Here is its interface, followed by an example of how to use it in a program.

+ (void) notifyWithTitle:(NSString *)title
    description:(NSString *)description
    notificationName:(NSString *)notifyName
    iconData:(NSData *)iconData
    priority:(signed int)priority
    isSticky:(BOOL)isSticky
    clickContext:(id)clickContext
    identifier:(NSString *)identifier;

[GrowlApplicationBridge
     notifyWithTitle: @"Title"   
     description: @"Message"
     notificationName: @"flashCard"
     iconData: [NSData data]
     priority: 0
     isSticky: YES
     clickContext: title
     identifier: @"flashcard"];

I hope this is useful to somebody out there. It took me quite a bit of looking and Google turned up nothing :( By the way, if anyone from the Growl dev team reads this, I'm not trying to criticize you guys, I just think it would help those developing software that works with your notification system to have more comprehensive API docs. If you want, I would be happy to help out. I might e-mail you guys some stuff if I get a chance (VERY busy summer coding like 15+ hrs a day)


Quote this article on your site | Print

Be first to comment this article

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Personal verbal attacks will be deleted.
  • Please don't use comments to plug your web site. Such material will be removed.
  • Just ensure to *Refresh* your browser for a new security code to be displayed prior to clicking on the 'Send' button.
  • Keep in mind that the above process only applies if you simply entered the wrong security code.
Name:
E-mail
Homepage
BBCode:Web AddressEmail AddressBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
Comment:



Code:* Code
I wish to be contacted by email regarding additional comments

Powered by AkoComment Tweaked Special Edition v.1.4.6
AkoComment © Copyright 2004 by Arthur Konze - www.mamboportal.com
All right reserved

Last Updated ( Sunday, 13 July 2008 )
 

Radio Top 20 Tracks

1. Anamanaguchi - Video Challenge

2. Aurasil - Yie ar kung fu

3. Bit Shifter - Hexadecimal Genome

4. Bit Shifter - The Information Chase

5. DJ Mitch - Noisy Pillars (Ibiza Sunset Mix - Remastered)

6. FFmusicDJ - HiddenPalaceFuture

7. Final Fantasy 7 A World of Piano OC ReMix

8. Final Fantasy 8 EyesOnMe(NotFayWong) OC ReMix

9. Hadyn - PartyInTheEmeraldHills

10. Lagerfeldt - Angel (Merry X-Max)

11. Lagerfeldt - Sweet (My Sun Shines On)

12. Random - Spontaneous Devotion

13. Rayza - Sonic the Hedgehog Green Hill Zone (Euroclub '95 Mix) OC ReMix

14. Saberpulse - Hey Kate

15. She - Nebula

16. She - Pioneer

17. Sonic 3D Blast Snow OC ReMix

18. Trance-Canada - Sonic the Hedgehog 3 Ice Attack OC ReMix

19. USK - Little Sound Disko04

20. USK - Little Sound Disko05

FreeBSD Logo
up 24 days
(C) 2007 - 2010 Flynn's Arcade
Joomla! is Free Software released under the GNU/GPL License.