Fixed issues with 10.4-10.5 not having IORegistryEntryGetRegistryEntryID and issue where the name of the notes file was .txt instead of rtf. Updated version to 0.2.1
This commit is contained in:
parent
2d15716b4a
commit
e8d4bced4e
@ -19,6 +19,8 @@ extern NSString * const MGMNIcon;
|
||||
extern NSString * const MGMNSound;
|
||||
extern NSString * const MGMNTask;
|
||||
|
||||
@protocol NSWindowDelegate;
|
||||
|
||||
@interface MGMController : NSObject <NSWindowDelegate> {
|
||||
NSWindow *instructions;
|
||||
|
||||
|
@ -43,7 +43,7 @@ NSString * const MGMVersion = @"MGMVersion";
|
||||
NSString * const MGMLaunchCount = @"MGMLaunchCount";
|
||||
|
||||
NSString * const MGMApplicationSupportPath = @"~/Library/Application Support/MrGeckosMedia/SoundNote/";
|
||||
NSString * const MGMNotesName = @"notes.txt";
|
||||
NSString * const MGMNotesName = @"notes.rtf";
|
||||
NSString * const MGMGrowlName = @"growl.plist";
|
||||
NSString * const MGMDisabledName = @"disabled.plist";
|
||||
NSString * const MGMSoundEndedNotification = @"MGMSoundEndedNotification";
|
||||
@ -103,15 +103,15 @@ static MGMController *MGMSharedController;
|
||||
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
if ([defaults objectForKey:MGMVersion]==nil) {
|
||||
if ([defaults objectForKey:MGMVersion]==nil || [[defaults objectForKey:MGMVersion] isEqual:@"0.2"]) {
|
||||
if ([manager fileExistsAtPath:[MGMApplicationSupportPath stringByExpandingTildeInPath]]) {
|
||||
[manager copyItemAtPath:[[NSBundle mainBundle] pathForResource:[MGMNotesName stringByDeletingPathExtension] ofType:[MGMNotesName pathExtension]] toPath:[[MGMApplicationSupportPath stringByExpandingTildeInPath] stringByAppendingPathComponent:MGMNotesName]];
|
||||
[manager copyItemAtPath:[[NSBundle mainBundle] pathForResource:[MGMGrowlName stringByDeletingPathExtension] ofType:[MGMGrowlName pathExtension]] toPath:[[MGMApplicationSupportPath stringByExpandingTildeInPath] stringByAppendingPathComponent:MGMGrowlName]];
|
||||
[manager copyItemAtPath:[[NSBundle mainBundle] pathForResource:[MGMDisabledName stringByDeletingPathExtension] ofType:[MGMDisabledName pathExtension]] toPath:[[MGMApplicationSupportPath stringByExpandingTildeInPath] stringByAppendingPathComponent:MGMDisabledName]];
|
||||
[manager removeItemAtPath:[[MGMApplicationSupportPath stringByExpandingTildeInPath] stringByAppendingPathComponent:@"note.txt"]];
|
||||
[self showInstructions];
|
||||
[defaults setObject:[[MGMSystemInfo info] applicationVersion] forKey:MGMVersion];
|
||||
}
|
||||
[defaults setObject:[[MGMSystemInfo info] applicationVersion] forKey:MGMVersion];
|
||||
}
|
||||
[self registerDefaults];
|
||||
if (![manager fileExistsAtPath:[MGMApplicationSupportPath stringByExpandingTildeInPath]]) {
|
||||
|
@ -19,6 +19,8 @@
|
||||
- (void)soundDidFinishPlaying:(MGMSound *)theSound;
|
||||
@end
|
||||
|
||||
@protocol NSSoundDelegate;
|
||||
|
||||
@interface MGMSound : NSObject
|
||||
#if TARGET_OS_IPHONE
|
||||
<AVAudioPlayerDelegate>
|
||||
|
@ -88,8 +88,8 @@ static void receivedNotification(AXObserverRef observer, AXUIElementRef element,
|
||||
[self observe:kAXMenuOpenedNotification element:element observer:observer application:theApplication];
|
||||
[self observe:kAXMenuClosedNotification element:element observer:observer application:theApplication];
|
||||
[self observe:kAXMenuItemSelectedNotification element:element observer:observer application:theApplication];
|
||||
[self observe:kAXRowExpandedNotification element:element observer:observer application:theApplication];
|
||||
[self observe:kAXRowCollapsedNotification element:element observer:observer application:theApplication];
|
||||
[self observe:CFSTR("AXRowExpanded") element:element observer:observer application:theApplication];
|
||||
[self observe:CFSTR("AXRowCollapsed") element:element observer:observer application:theApplication];
|
||||
[self observe:kAXSelectedRowsChangedNotification element:element observer:observer application:theApplication];
|
||||
if (![[MGMSystemInfo info] isAfterSnowLeopard]) {
|
||||
[self observe:kAXApplicationHiddenNotification element:element observer:observer application:theApplication];
|
||||
@ -145,9 +145,9 @@ static void receivedNotification(AXObserverRef observer, AXUIElementRef element,
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"menuitemselected", MGMNName, @"Menu Item Selected", MGMNTitle, [NSString stringWithFormat:@"%@ in %@", (NSString *)title, [information objectForKey:(NSString *)kCFBundleNameKey]], MGMNDescription, [[NSWorkspace sharedWorkspace] iconForFile:[information objectForKey:MGMBundlePath]], MGMNIcon, nil]];
|
||||
if (title!=NULL)
|
||||
CFRelease(title);
|
||||
} else if ([theName isEqual:(NSString *)kAXRowExpandedNotification]) {
|
||||
} else if ([theName isEqual:@"AXRowExpanded"]) {
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"rowexpanded", MGMNName, @"Row Expanded", MGMNTitle, [information objectForKey:(NSString *)kCFBundleNameKey], MGMNDescription, [[NSWorkspace sharedWorkspace] iconForFile:[information objectForKey:MGMBundlePath]], MGMNIcon, nil]];
|
||||
} else if ([theName isEqual:(NSString *)kAXRowCollapsedNotification]) {
|
||||
} else if ([theName isEqual:@"AXRowCollapsed"]) {
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"rowcollapsed", MGMNName, @"Row Collapsed", MGMNTitle, [information objectForKey:(NSString *)kCFBundleNameKey], MGMNDescription, [[NSWorkspace sharedWorkspace] iconForFile:[information objectForKey:MGMBundlePath]], MGMNIcon, nil]];
|
||||
} else if ([theName isEqual:(NSString *)kAXSelectedRowsChangedNotification]) {
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"selectedrowschanged", MGMNName, @"Selected Rows Changed", MGMNTitle, [information objectForKey:(NSString *)kCFBundleNameKey], MGMNDescription, [[NSWorkspace sharedWorkspace] iconForFile:[information objectForKey:MGMBundlePath]], MGMNIcon, nil]];
|
||||
|
@ -27,6 +27,8 @@ OSStatus frontAppChanged(EventHandlerCallRef nextHandler, EventRef theEvent, voi
|
||||
return (CallNextEventHandler(nextHandler, theEvent));
|
||||
}
|
||||
|
||||
@class NSRunningApplication;
|
||||
|
||||
@implementation MGMApplicationWatcher
|
||||
- (id)init {
|
||||
if ((self = [super init])) {
|
||||
|
@ -49,17 +49,6 @@ static NSString *nameForIOFW(io_object_t object) {
|
||||
|
||||
return @"Unnamed Device";
|
||||
}
|
||||
static NSString *idForIOFW(io_object_t object) {
|
||||
uint64_t ioDeviceID;
|
||||
NSString *deviceID = nil;
|
||||
kern_return_t result = IORegistryEntryGetRegistryEntryID(object, &ioDeviceID);
|
||||
if (result==noErr)
|
||||
deviceID = [NSString stringWithFormat:@"%11x", ioDeviceID];
|
||||
if (deviceID!=nil)
|
||||
return deviceID;
|
||||
|
||||
return @"Unknown ID";
|
||||
}
|
||||
|
||||
@implementation MGMFireWireWatcher
|
||||
- (id)init {
|
||||
@ -77,9 +66,9 @@ static NSString *idForIOFW(io_object_t object) {
|
||||
NSLog(@"Unable to register for firewire add %d", result);
|
||||
io_object_t object;
|
||||
while ((object = IOIteratorNext(found))) {
|
||||
NSString *deviceID = idForIOFW(object);
|
||||
if (![firewireDevices containsObject:deviceID])
|
||||
[firewireDevices addObject:deviceID];
|
||||
NSString *deviceName = nameForIOFW(object);
|
||||
if (![firewireDevices containsObject:deviceName])
|
||||
[firewireDevices addObject:deviceName];
|
||||
IOObjectRelease(object);
|
||||
}
|
||||
|
||||
@ -89,9 +78,9 @@ static NSString *idForIOFW(io_object_t object) {
|
||||
NSLog(@"Unable to register for firewire remove %d", result);
|
||||
else {
|
||||
while ((object = IOIteratorNext(found))) {
|
||||
NSString *deviceID = idForIOFW(object);
|
||||
if ([firewireDevices containsObject:deviceID])
|
||||
[firewireDevices removeObject:deviceID];
|
||||
NSString *deviceName = nameForIOFW(object);
|
||||
if ([firewireDevices containsObject:deviceName])
|
||||
[firewireDevices removeObject:deviceName];
|
||||
IOObjectRelease(object);
|
||||
}
|
||||
}
|
||||
@ -108,17 +97,17 @@ static NSString *idForIOFW(io_object_t object) {
|
||||
}
|
||||
|
||||
- (void)firewireDeviceConnected:(io_object_t)theDevice {
|
||||
NSString *deviceID = idForIOFW(theDevice);
|
||||
if (![firewireDevices containsObject:deviceID]) {
|
||||
[firewireDevices addObject:deviceID];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"firewireconnected", MGMNName, @"FireWire Connected", MGMNTitle, nameForIOFW(theDevice), MGMNDescription, [NSImage imageNamed:@"FireWire"], MGMNIcon, nil]];
|
||||
NSString *deviceName = nameForIOFW(theDevice);
|
||||
if (![firewireDevices containsObject:deviceName]) {
|
||||
[firewireDevices addObject:deviceName];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"firewireconnected", MGMNName, @"FireWire Connected", MGMNTitle, deviceName, MGMNDescription, [NSImage imageNamed:@"FireWire"], MGMNIcon, nil]];
|
||||
}
|
||||
}
|
||||
- (void)firewireDeviceDisconnected:(io_object_t)theDevice {
|
||||
NSString *deviceID = idForIOFW(theDevice);
|
||||
if ([firewireDevices containsObject:deviceID]) {
|
||||
[firewireDevices removeObject:deviceID];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"firewiredisconnected", MGMNName, @"FireWire Disconnected", MGMNTitle, nameForIOFW(theDevice), MGMNDescription, [NSImage imageNamed:@"FireWire"], MGMNIcon, nil]];
|
||||
NSString *deviceName = nameForIOFW(theDevice);
|
||||
if ([firewireDevices containsObject:deviceName]) {
|
||||
[firewireDevices removeObject:deviceName];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"firewiredisconnected", MGMNName, @"FireWire Disconnected", MGMNTitle, deviceName, MGMNDescription, [NSImage imageNamed:@"FireWire"], MGMNIcon, nil]];
|
||||
}
|
||||
}
|
||||
@end
|
@ -38,17 +38,6 @@ static NSString *nameForIOUSB(io_object_t object) {
|
||||
|
||||
return @"Unnamed Device";
|
||||
}
|
||||
static NSString *idForIOUSB(io_object_t object) {
|
||||
uint64_t ioDeviceID;
|
||||
NSString *deviceID = nil;
|
||||
kern_return_t result = IORegistryEntryGetRegistryEntryID(object, &ioDeviceID);
|
||||
if (result==noErr)
|
||||
deviceID = [NSString stringWithFormat:@"%11x", ioDeviceID];
|
||||
if (deviceID!=nil)
|
||||
return deviceID;
|
||||
|
||||
return @"Unknown ID";
|
||||
}
|
||||
|
||||
@implementation MGMUSBWatcher
|
||||
- (id)init {
|
||||
@ -66,9 +55,9 @@ static NSString *idForIOUSB(io_object_t object) {
|
||||
NSLog(@"Unable to register for usb add %d", result);
|
||||
io_object_t object;
|
||||
while ((object = IOIteratorNext(found))) {
|
||||
NSString *deviceID = idForIOUSB(object);
|
||||
if (![USBDevices containsObject:deviceID])
|
||||
[USBDevices addObject:deviceID];
|
||||
NSString *deviceName = nameForIOUSB(object);
|
||||
if (![USBDevices containsObject:deviceName])
|
||||
[USBDevices addObject:deviceName];
|
||||
IOObjectRelease(object);
|
||||
}
|
||||
|
||||
@ -78,9 +67,9 @@ static NSString *idForIOUSB(io_object_t object) {
|
||||
NSLog(@"Unable to register for usb remove %d", result);
|
||||
else {
|
||||
while ((object = IOIteratorNext(found))) {
|
||||
NSString *deviceID = idForIOUSB(object);
|
||||
if ([USBDevices containsObject:deviceID])
|
||||
[USBDevices removeObject:deviceID];
|
||||
NSString *deviceName = nameForIOUSB(object);
|
||||
if ([USBDevices containsObject:deviceName])
|
||||
[USBDevices removeObject:deviceName];
|
||||
IOObjectRelease(object);
|
||||
}
|
||||
}
|
||||
@ -97,17 +86,17 @@ static NSString *idForIOUSB(io_object_t object) {
|
||||
}
|
||||
|
||||
- (void)usbDeviceConnected:(io_object_t)theDevice {
|
||||
NSString *deviceID = idForIOUSB(theDevice);
|
||||
if (![USBDevices containsObject:deviceID]) {
|
||||
[USBDevices addObject:deviceID];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"usbconnected", MGMNName, @"USB Connected", MGMNTitle, nameForIOUSB(theDevice), MGMNDescription, [NSImage imageNamed:@"USB"], MGMNIcon, nil]];
|
||||
NSString *deviceName = nameForIOUSB(theDevice);
|
||||
if (![USBDevices containsObject:deviceName]) {
|
||||
[USBDevices addObject:deviceName];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"usbconnected", MGMNName, @"USB Connected", MGMNTitle, deviceName, MGMNDescription, [NSImage imageNamed:@"USB"], MGMNIcon, nil]];
|
||||
}
|
||||
}
|
||||
- (void)usbDeviceDisconnected:(io_object_t)theDevice {
|
||||
NSString *deviceID = idForIOUSB(theDevice);
|
||||
if ([USBDevices containsObject:deviceID]) {
|
||||
[USBDevices removeObject:deviceID];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"usbdisconnected", MGMNName, @"USB Disconnected", MGMNTitle, nameForIOUSB(theDevice), MGMNDescription, [NSImage imageNamed:@"USB"], MGMNIcon, nil]];
|
||||
NSString *deviceName = nameForIOUSB(theDevice);
|
||||
if ([USBDevices containsObject:deviceName]) {
|
||||
[USBDevices removeObject:deviceName];
|
||||
[[MGMController sharedController] startNotificationWithInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"usbdisconnected", MGMNName, @"USB Disconnected", MGMNTitle, deviceName, MGMNDescription, [NSImage imageNamed:@"USB"], MGMNIcon, nil]];
|
||||
}
|
||||
}
|
||||
@end
|
@ -19,13 +19,15 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.2</string>
|
||||
<string>0.2.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array/>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.2</string>
|
||||
<string>0.2.1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>LSUIElement</key>
|
||||
@ -60,8 +62,6 @@
|
||||
<string>dsa_pub.pem</string>
|
||||
<key>SUScheduledCheckInterval</key>
|
||||
<integer>86400</integer>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array/>
|
||||
<key>UTImportedTypeDeclarations</key>
|
||||
|
@ -179,8 +179,8 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||
2A34E62611E237380032F02E /* IOKit.framework in Frameworks */,
|
||||
2A34E68911E241CA0032F02E /* SystemConfiguration.framework in Frameworks */,
|
||||
2A34E62611E237380032F02E /* IOKit.framework in Frameworks */,
|
||||
2A34E7DC11E276C80032F02E /* IOBluetooth.framework in Frameworks */,
|
||||
2A34E89E11E286500032F02E /* GeckoReporter.framework in Frameworks */,
|
||||
2A34E89F11E286500032F02E /* Sparkle.framework in Frameworks */,
|
||||
@ -514,6 +514,7 @@
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
"MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5;
|
||||
PRODUCT_NAME = SoundNote;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -533,6 +534,7 @@
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
"MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5;
|
||||
PRODUCT_NAME = SoundNote;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user