|
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 *)notifName 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) Be first to comment this article | Quote this article on your site | Print |