Commits

Anonymous committed 8642326

Test App added,
- merely registers now
- has support for arbitrary Notifications
- I need to connect the Sheet/Panel for arbitrary Notification addition

Comments (0)

Files changed (4)

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>Beep</string>
+	<key>CFBundleGetInfoString</key>
+	<string></string>
+	<key>CFBundleIconFile</key>
+	<string></string>
+	<key>CFBundleIdentifier</key>
+	<string>com.Growl.Beep</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string></string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1.0.0d1</string>
+	<key>NSMainNibFile</key>
+	<string>Beep</string>
+	<key>NSPrincipalClass</key>
+	<string>NSApplication</string>
+</dict>
+</plist>
+/* BeepController */
+
+#import <Cocoa/Cocoa.h>
+
+@interface BeepController : NSObject {
+	//add notification sheet fields
+	IBOutlet NSPanel		*_newNotificationPanel;				// The Add Panel
+    IBOutlet NSButton		*_newNotificationDefault;			// Whether this note is on by default
+    IBOutlet NSTextField	*_newNotificationDescription;		// The long description
+    IBOutlet NSImageView	*_newNotificationImage;				// The associated image
+    IBOutlet NSTextField	*_newNotificationTitle;				// The name of this note
+	
+	//main window
+    IBOutlet NSTableView	*_notificationsTable;				// The table of notifications
+    IBOutlet NSButton		*_registered;						// The magic button the registers/unregisters
+    IBOutlet NSButton		*_removeNotification;				// The remove button (TBR)
+	
+	//data
+	NSMutableArray			*_notifications;					// The Array of notifications
+}
+
+- (IBAction)addNotification:(id)sender;
+- (IBAction)registerBeep:(id)sender;
+- (IBAction)sendNotification:(id)sender;
+@end
+#import "BeepController.h"
+
+@implementation BeepController
+
+- (id) init {
+	if ( self = [super init] ) {
+		_notifications = [[_notifications init] alloc];
+	}
+	return self;
+}
+
+- (IBAction)addNotification:(id)sender {
+
+}
+
+- (IBAction)registerBeep:(id)sender {
+	if ( [_registered state] == NSOnState ) {
+		NSLog( @"Button on" );
+		NSDictionary *regDict = [[NSDictionary alloc] initWithObjectsAndKeys:@"Beep", @"ApplicationName", nil];
+		
+		[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"GrowlApplicationRegistrationNotification" 
+																	   object:nil 
+																	 userInfo:regDict];
+	} else {
+		NSLog( @"Button off" );	
+	}
+}
+
+- (IBAction)sendNotification:(id)sender {
+
+}
+
+#pragma mark Table Data Source
+
+- (int)numberOfRowsInTableView:(NSTableView *)aTableView {
+	return [_notifications count];
+}
+
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {
+	return [[_notifications objectAtIndex:rowIndex] objectForKey:@"NotificationName"];
+}
+
+#pragma mark Table Delegate Methods
+
+- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row {
+	return NO;
+}
+
+@end
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char *argv[]) {
+    return NSApplicationMain(argc, argv);
+}