From 40a49b30a8feaf8f0cdd7a084d9843ce7d6da77f Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 11 Apr 2009 15:49:04 +0000 Subject: Implement very basic Growl enable/disable preference. Still need to add more complex notification rules. --- Source/SPGrowlController.h | 1 + Source/SPGrowlController.m | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'Source') diff --git a/Source/SPGrowlController.h b/Source/SPGrowlController.h index 2ad73e8b..7b604e30 100644 --- a/Source/SPGrowlController.h +++ b/Source/SPGrowlController.h @@ -30,5 +30,6 @@ // Post notification - (void)notifyWithTitle:(NSString *)title description:(NSString *)description notificationName:(NSString *)name; +- (void)notifyWithTitle:(NSString *)title description:(NSString *)description notificationName:(NSString *)name iconData:(NSData *)data priority:(int)priority isSticky:(BOOL)sticky clickContext:(id)clickContext; @end diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m index 4583f33e..853619ff 100644 --- a/Source/SPGrowlController.m +++ b/Source/SPGrowlController.m @@ -81,14 +81,13 @@ static SPGrowlController *sharedGrowlController = nil; */ - (void)notifyWithTitle:(NSString *)title description:(NSString *)description notificationName:(NSString *)name { - // Post notification - [GrowlApplicationBridge notifyWithTitle:title - description:description - notificationName:name - iconData:nil - priority:0 - isSticky:NO - clickContext:nil]; + [self notifyWithTitle:title + description:description + notificationName:name + iconData:nil + priority:0 + isSticky:NO + clickContext:nil]; } /* @@ -96,14 +95,16 @@ static SPGrowlController *sharedGrowlController = nil; */ - (void)notifyWithTitle:(NSString *)title description:(NSString *)description notificationName:(NSString *)name iconData:(NSData *)data priority:(int)priority isSticky:(BOOL)sticky clickContext:(id)clickContext { - // Post notification - [GrowlApplicationBridge notifyWithTitle:title - description:description - notificationName:name - iconData:data - priority:priority - isSticky:sticky - clickContext:clickContext]; + // Post notification only if preference is set + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GrowlEnabled"]) { + [GrowlApplicationBridge notifyWithTitle:title + description:description + notificationName:name + iconData:data + priority:priority + isSticky:sticky + clickContext:clickContext]; + } } @end -- cgit v1.2.3