you shouldn't be loading/registering yourself every time you call sendMessage: it should happen only once.
-rudy On Aug 30, 6:25 pm, Javier Arce <[email protected]> wrote: > Hi, > > I'm developing a simple cocoa app with the Growl.framework. Everything > is working fine except for one annoying problem with > growlNotificationWasClicked:(id)clickContext. Whenever there are > several open notifications (sticky or non-sticky) and I click on one > of them, this function is called several times (one for each > notification). > > I understand that this is not the expected behavior, right? Or am I > doing something wrong? > > Here is the problematic piece of code: > > -(void)sendMessage:(NSString *)message title:(NSString *)title { > > NSBundle *myBundle = [NSBundle bundleForClass: > [GrowlExampleAppDelegate class]]; > NSString *growlPath = [[myBundle privateFrameworksPath] > stringByAppendingPathComponent:@"Growl.framework"]; > NSBundle *growlBundle = [NSBundle bundleWithPath:growlPath]; > > if (growlBundle && [growlBundle load]) { > // Register ourselves as a Growl delegate > [GrowlApplicationBridge setGrowlDelegate:self]; > > NSString* myImage = [[NSBundle mainBundle] > pathForResource:@"icon" > ofType:@"png"]; > NSData *icon = [[NSData alloc] > initWithContentsOfFile:myImage]; > > [GrowlApplicationBridge notifyWithTitle:title > description:[NSString > stringWithFormat:@"%@", message] > > notificationName:@"Example" > > iconData:icon > > priority:0 > > isSticky:YES > > clickContext:@"http://www.example.com"]; > > [icon release]; > } > else NSLog(@"ERROR: Could not load Growl.framework"); > > } > > - (void) growlNotificationWasClicked:(id)clickContext { > NSURL *url = [NSURL URLWithString:clickContext]; > [[NSWorkspace sharedWorkspace] openURL:url]; > > } > > Thanks for your help, -- You received this message because you are subscribed to the Google Groups "Growl Discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/growldiscuss?hl=en.
