Show AppDelegate.m syntax highlighted
#import "AppDelegate.h"
#include <Carbon/Carbon.h>
#import "HandledURLWindow.h"
#define kAppName "\pSampleProtocolHandler"
#define kHelperKey "\pHelper\245x-sample"
#define kAppSignature 'SpPH'
@implementation AppDelegate
- (void)applicationWillFinishLaunching:(NSNotification*)notification_ {
ICInstance instance = nil;
OSStatus err = noErr;
// Start IC.
err = ICStart( &instance, kAppSignature );
if( !err ) {
ICAppSpec appSpec;
appSpec.fCreator = kAppSignature;
BlockMoveData( kAppName, appSpec.name, sizeof( kAppName ) );
err = ICSetPref( instance, kHelperKey, kICAttrNoChange, &appSpec, sizeof( appSpec ) );
}
// Stop IC.
if( instance ) {
OSStatus err2 = ICStop( instance );
instance = nil;
if( !err )
err = err2;
}
if( err )
[NSException raise:@"OSStatus" format:@"an error was returned while writing the helper IC entry: %ld", err];
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self
andSelector:@selector(handleGetURLAppleEvent:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
}
- (void) handleGetURLAppleEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent {
NSString *url = [[event descriptorForKeyword:keyDirectObject] stringValue];
[[HandledURLWindow alloc] initWithHandledURL:url];
}
@end
See more files for this project here
Code for Mac+WebObjects.
Project homepage:
http://sourceforge.net/projects/redshed
Programming language(s): C,Java,Objective C
License: other
English.lproj/
HandledURLWindow.nib/
classes.nib
info.nib
keyedobjects.nib
MainMenu.nib/
classes.nib
info.nib
keyedobjects.nib
InfoPlist.strings
SampleProtocolHandler.app/
Contents/
MacOS/
SampleProtocolHandler
Resources/
English.lproj/
HandledURLWindow.nib/
classes.nib
info.nib
keyedobjects.nib
MainMenu.nib/
classes.nib
info.nib
keyedobjects.nib
InfoPlist.strings
Info.plist
PkgInfo
SampleProtocolHandler.xcodeproj/
project.pbxproj
wolf.mode1
wolf.pbxuser
AppDelegate.h
AppDelegate.m
HandledURLWindow.h
HandledURLWindow.m
Info.plist
SampleProtocolHandler_Prefix.pch
main.m