From 985444593c78b21a097795e7bfb7ba111025275e Mon Sep 17 00:00:00 2001 From: Joseph Spiros Date: Mon, 2 Mar 2009 02:31:57 -0500 Subject: [PATCH] Fixed a bug whereby notifications without a description would not appear, as well as a bug with the regular expression used to trim trailing whitespace. --- GrowlITTSWController.h | 2 +- GrowlITTSWController.m | 10 ++++++---- GrowlITTSWDisplay.m | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/GrowlITTSWController.h b/GrowlITTSWController.h index 0d6b6b1..345af9b 100644 --- a/GrowlITTSWController.h +++ b/GrowlITTSWController.h @@ -18,6 +18,6 @@ int _wrapColumns; } -- (void)showWindowWithTitle:(NSString *)title text:(NSString *)text image:(NSImage *)image; +- (void)showWindowWithTitle:(NSString *)title desc:(NSString *)desc image:(NSImage *)image; @end diff --git a/GrowlITTSWController.m b/GrowlITTSWController.m index 1cd4265..5503ee8 100644 --- a/GrowlITTSWController.m +++ b/GrowlITTSWController.m @@ -112,9 +112,11 @@ } } -- (void)showWindowWithTitle:(NSString *)title text:(NSString *)text image:(NSImage *)image { - if (text && ![text isEqualToString:@""] && ![text isEqualToString:@"\n"]) { - text = [title stringByAppendingFormat:@"\n%@", text]; +- (void)showWindowWithTitle:(NSString *)title desc:(NSString *)desc image:(NSImage *)image { + NSString *text = title; + + if (desc && ![desc isEqualToString:@""] && ![desc isEqualToString:@"\n"]) { + text = [text stringByAppendingFormat:@"\n%@", desc]; } NSSize newSize; @@ -136,7 +138,7 @@ } //trim trailing whitespace - text = [text stringByReplacingOccurrencesOfRegex:@"[\\s\\r\\n]+$" withString:@""]; + text = [text stringByReplacingOccurrencesOfRegex:@"\\s+$" withString:@""]; NSArray *gothicChars = [NSArray arrayWithObjects:[NSString stringWithUTF8String:"☆"], [NSString stringWithUTF8String:"★"], nil]; NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:text]; diff --git a/GrowlITTSWDisplay.m b/GrowlITTSWDisplay.m index ac9a647..d43a5b5 100644 --- a/GrowlITTSWDisplay.m +++ b/GrowlITTSWDisplay.m @@ -31,7 +31,7 @@ NSString *title = [dict objectForKey:GROWL_NOTIFICATION_TITLE]; NSString *desc = [dict objectForKey:GROWL_NOTIFICATION_DESCRIPTION]; NSImage *image = [dict objectForKey:GROWL_NOTIFICATION_ICON]; - [[GrowlITTSWController sharedController] showWindowWithTitle:title text:desc image:image]; + [[GrowlITTSWController sharedController] showWindowWithTitle:title desc:desc image:image]; } @end -- 2.20.1