Commits

duesex  committed 895384b

Load up the default plugin, and DISPLAY NOTIFICATIONS.
- also removed logging related to data state and left the ones for transfer.

  • Participants
  • Parent commits 4ddfb33
  • Branches default

Comments (0)

Files changed (3)

File BeepController.m

 																				defaultValue, GROWL_NOTIFICATION_DEFAULT,
 																				nil];
 	[_notifications addObject:aNuDict];
-	NSLog( @"%@ added to %@", aNuDict, _notifications);
+	//NSLog( @"%@ added to %@", aNuDict, _notifications);
 	[_notificationsTable reloadData];
 	
 	[self endPanel:self];
 - (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];
 }

File GrowlController.h

 //
 
 #import <Foundation/Foundation.h>
-
-@protocol GrowlDisplayPlugin 
-- (void)  displayNotificationWithinfo:(NSDictionary *) noteDict;
-@end
+#import "GrowlDefines.h" //this should not be needed
 
 @interface GrowlController : NSObject {
-	NSMutableArray				*_tickets;		//Application tickets
+	NSMutableArray				*_tickets;				//Application tickets
 	id <GrowlDisplayPlugin>		*_displayController;
 }
 

File GrowlController.m

 																name:GROWL_APP_REGISTRATION
 															  object:nil]; 
 		_tickets = [[NSMutableArray alloc] init];
-		//NSBundle *aBundle = [[NSBundle mainBundle] resourcePath]
-		_displayController = nil;
+
+		_displayController = [self loadDisplay];
+		[_displayController loadPlugin];
+		
+		NSLog( @"view loaded: %@\n Author: %@\n Description: %@\n Version: %@", _displayController,
+																				[_displayController author],
+																				[_displayController userDescription],
+																				[_displayController version]
+			   );
 	}
 	
 	return self;
 
 #pragma mark -
 
+- (id <GrowlDisplayPlugin>) loadDisplay {
+	id <GrowlDisplayPlugin> retVal;
+	NSString *viewPath = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"BubblesNotificationView.growlView" ];
+	//NSString *systemBundlesPath = @"/Library/Growl Support/";
+	//NSString *userBundlesPath = @"~/Library/Growl Support/";
+	
+	NSLog( @"default - %@", viewPath );
+	
+	if ( [[NSUserDefaults standardUserDefaults] stringForKey:@"userDisplayPlugin"] ) {
+		viewPath = [[NSUserDefaults standardUserDefaults] stringForKey:@"userDisplayPlugin"];
+	}
+	
+	Class viewClass;
+	NSBundle *viewBundle = [NSBundle bundleWithPath:viewPath];
+	NSLog ( @"bundle loaded - %@", viewBundle );
+	viewClass = [viewBundle principalClass];
+	retVal = [[viewClass alloc] init];
+	NSLog( @"object initialized - %@", retVal );
+	
+	return retVal;
+}
+
+#pragma mark -
+
 - (void) _registerApplication:(NSNotification *) note {
 	NSString *appName = [[note userInfo] objectForKey:GROWL_APP_NAME];
 	NSSet *allNotes = [NSSet setWithArray:[[note userInfo] objectForKey:GROWL_NOTIFICATIONS_ALL]];
 - (void) dispatchNotification:(NSNotification *) note {
 	//insert code here
 	NSLog( @"%@", note );
+	[_displayController displayNotificationWithInfo:[note userInfo]];
 }
+
 @end