Initial commit of GrowlITTSW. Currently, all settings are hardcoded.
[GrowlITTSW.git] / GrowlITTSWDisplay.m
1 #import "GrowlITTSWDisplay.h"
2 #import "GrowlITTSWController.h"
3 #import "GrowlITTSWPrefs.h"
4 #import "GrowlDefines.h"
5 #import "GrowlDefinesInternal.h"
6 #import "GrowlApplicationNotification.h"
7
8 @implementation GrowlITTSWDisplay
9
10 - (void) dealloc {
11         [preferencePane release];
12         [super dealloc];
13 }
14
15 /* - (NSPreferencePane *) preferencePane {
16         if (!preferencePane)
17                 preferencePane = [[GrowlITTSWPrefs alloc] initWithBundle:[NSBundle bundleWithIdentifier:@"com.ithinksw.growl.ittsw"]];
18         return preferencePane;
19 }*/
20
21 //we implement requiresPositioning entirely because it was added as a requirement for doing 1.1 plugins, however
22 //we don't really care if positioning is required or not, because we are only ever in the menubar.
23 - (BOOL)requiresPositioning {
24         return NO;
25 }
26
27 #pragma mark -
28 - (void) displayNotification:(GrowlApplicationNotification *)notification {
29         NSDictionary *dict = [notification dictionaryRepresentation];
30         NSString *title = [dict objectForKey:GROWL_NOTIFICATION_TITLE];
31         NSString *desc = [dict objectForKey:GROWL_NOTIFICATION_DESCRIPTION];
32         NSImage *image = [dict objectForKey:GROWL_NOTIFICATION_ICON];
33         NSString *text;
34         if (desc) {
35                 text = [title stringByAppendingFormat:@"\n%@", desc];
36         } else {
37                 text = title;
38         }
39         [[GrowlITTSWController sharedController] showWindowWithText:text image:image];
40 }
41
42 @end