Commits

Anonymous committed fbb45ca

Now we actually send and receive notifications as we were supposed to. We also NSLog() a <i>tad</i> more.
- NSImage have been disabled until a clean way(DO) is found to do them since NSDNS only allows the plist classes across.

Comments (0)

Files changed (2)

 	NSNumber *defaultValue = [NSNumber numberWithBool:[_newNotificationDefault state] == NSOnState];
 	NSDictionary *aNuDict = [NSDictionary dictionaryWithObjectsAndKeys:			[_newNotificationTitle stringValue], GROWL_NOTIFICATION_TITLE,
 																				[_newNotificationDescription stringValue], GROWL_NOTIFICATION_DESCRIPTION,
-																				[_newNotificationImage image], GROWL_NOTIFICATION_ICON,
+																				/* [_newNotificationImage image], GROWL_NOTIFICATION_ICON ,*/
 																				defaultValue, GROWL_NOTIFICATION_DEFAULT,
 																				nil];
 	[_notifications addObject:aNuDict];
 - (IBAction)registerBeep:(id)sender {
 	if ( [_registered state] == NSOnState ) {
 		NSLog( @"Button on" );
-		NSDictionary *regDict = [[NSDictionary alloc] initWithObjectsAndKeys:@"Beep", GROWL_APP_NAME, nil];
+		NSMutableArray *defNotesArray = [NSMutableArray array];
+		NSMutableArray *allNotesArray = [NSMutableArray array];
+		NSEnumerator *defNotes = [_notifications objectEnumerator];
+		id def;
+		int k = 0;
+		
+		while ( def = [defNotes nextObject] ) {
+			if ( [(NSDictionary *)def objectForKey:GROWL_NOTIFICATION_DEFAULT] ) {
+				[defNotesArray addObject:[def objectForKey:GROWL_NOTIFICATION_TITLE]];
+			}
+		}
+		
+		for ( k=0; k < [_notifications count]; k++ ) {
+			[allNotesArray addObject:[[_notifications objectAtIndex:k] objectForKey:GROWL_NOTIFICATION_TITLE]];
+		}
+		
+		NSDictionary *regDict = [[NSDictionary alloc] initWithObjectsAndKeys:   @"Beep", GROWL_APP_NAME, 
+																				allNotesArray, GROWL_NOTIFICATIONS_ALL, 
+																				defNotesArray, GROWL_NOTIFICATIONS_DEFAULT,
+																				nil];
 		
 		[[NSDistributedNotificationCenter defaultCenter] postNotificationName:GROWL_APP_REGISTRATION 
 																	   object:nil 
 
 - (IBAction)sendNotification:(id)sender {
 	//send a notification for the selected table cell
+	id note = [_notifications objectAtIndex:[_notificationsTable selectedRow]];
+	NSLog( @"%@", note );
+	
+	[[NSDistributedNotificationCenter defaultCenter] postNotificationName:[note objectForKey:GROWL_NOTIFICATION_TITLE] object:nil userInfo:note deliverImmediately:YES];
 }
 
 - (IBAction) endPanel:(id)sender {

GrowlController.m

 
 - (void) _registerApplication:(NSNotification *) note {
 	NSString *appName = [[note userInfo] objectForKey:GROWL_APP_NAME];
-	NSSet *allNotes = [[note userInfo] objectForKey:GROWL_NOTIFICATIONS_ALL];
-	NSSet *defaultNotes = [[note userInfo] objectForKey:GROWL_NOTIFICATIONS_DEFAULT];
+	NSSet *allNotes = [NSSet setWithArray:[[note userInfo] objectForKey:GROWL_NOTIFICATIONS_ALL]];
+	NSSet *defaultNotes = [NSSet setWithArray:[[note userInfo] objectForKey:GROWL_NOTIFICATIONS_DEFAULT]];
 	
 	//add category to NSWorkspace for -iconForApplication later
 	NSImage *appIcon = nil;
 
 - (void) dispatchNotification:(NSNotification *) note {
 	//insert code here
+	NSLog( @"%@", note );
 }
 @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.