Commits

Anonymous committed 9ad0a71

- merged changes
- support for default app icon notifications and custom icons for each notification
- Beep is now fully functional, except for modifying notifications
- image bug fixed

Comments (0)

Files changed (2)

 - (IBAction)addNotification:(id)sender {
 	//get Sheet fields and add to the known notifications
 	NSNumber *defaultValue = [NSNumber numberWithBool:[_newNotificationDefault state] == NSOnState];
+	NSData *image = nil;
+	if ( [_newNotificationImage image] ) {
+		image = [[_newNotificationImage image] TIFFRepresentation];
+	}
+	
 	NSDictionary *aNuDict = [NSDictionary dictionaryWithObjectsAndKeys:			[_newNotificationTitle stringValue], GROWL_NOTIFICATION_TITLE,
 																				[_newNotificationDescription stringValue], GROWL_NOTIFICATION_DESCRIPTION,
-																				[[_newNotificationImage image] TIFFRepresentation], GROWL_NOTIFICATION_ICON ,
+																				@"Beep", GROWL_APP_NAME,
 																				defaultValue, GROWL_NOTIFICATION_DEFAULT,
+																				image, GROWL_NOTIFICATION_ICON,
 																				nil];
+
 	[_notifications addObject:aNuDict];
 	//NSLog( @"%@ added to %@", aNuDict, _notifications);
 	[_notificationsTable reloadData];
 	//send a notification for the selected table cell
 	id note = [_notifications objectAtIndex:[_notificationsTable selectedRow]];
 	
+	//NSLog( @"note - %@", note );
 	[[NSDistributedNotificationCenter defaultCenter] postNotificationName:[note objectForKey:GROWL_NOTIFICATION_TITLE] object:nil userInfo:note deliverImmediately:YES];
+	//NSLog( @"sent it" );
 }
 
 - (IBAction) endPanel:(id)sender {

GrowlController.m

 #pragma mark -
 
 - (void) dispatchNotification:(NSNotification *) note {
-	//insert code here
-    NSLog( @"%@", note );
-    [_displayController displayNotificationWithInfo:[note userInfo]];
+	NSLog( @"%@", note );
+	
+	NSMutableDictionary *aDict = [NSMutableDictionary dictionaryWithDictionary:[note userInfo]];
+	
+	if ( ![aDict objectForKey:GROWL_NOTIFICATION_ICON] ) {
+		[aDict setObject:[[_tickets objectForKey:[aDict objectForKey:GROWL_APP_NAME]] icon] 
+				  forKey:GROWL_NOTIFICATION_ICON];
+	} else {
+		[aDict setObject:[[[NSImage alloc] initWithData:[aDict objectForKey:GROWL_NOTIFICATION_ICON]] autorelease] 
+				  forKey:GROWL_NOTIFICATION_ICON];
+	}
+	
+	//NSLog( @"%@", [aDict objectForKey:GROWL_NOTIFICATION_ICON] );
+	[_displayController displayNotificationWithInfo:aDict];
 }
 
 @end
 	}
 	
 }
-
-#pragma mark -
-
-- (void) dispatchNotification:(NSNotification *) note {
-    NSImage *image;
-    
-	NSLog( @"%@", note );
-	
-	NSMutableDictionary *aDict = [NSMutableDictionary dictionaryWithDictionary:[note userInfo]];
-        if([aDict objectForKey:GROWL_NOTIFICATION_ICON]){
-            image = [[NSImage alloc] initWithData:[aDict objectForKey:GROWL_NOTIFICATION_ICON]];
-            [aDict removeObjectForKey:GROWL_NOTIFICATION_ICON];
-            [image autorelease];
-        }else{
-            image = [[_tickets objectForKey:[aDict objectForKey:GROWL_APP_NAME]] icon];
-        }
-        
-        if(image != nil){
-            [aDict setObject:image forKey:GROWL_NOTIFICATION_ICON];
-        }
-	NSLog( @"%@", [aDict objectForKey:GROWL_NOTIFICATION_ICON] );
-	[_displayController displayNotificationWithInfo:aDict];
-}
-
 @end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.