Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from clee/master.

New [EyeTunes quit] method, refactored +isRunning, 64-bit build fixes
  • Loading branch information...
commit 351890e659cc65c6c6511c527b85b6d91b3ccbef 2 parents d47026b + 87c642c
@kgn authored
Showing with 11 additions and 14 deletions.
  1. +3 −3 ETAppleEventObject.m
  2. +3 −0  ETEyeTunes.h
  3. +5 −11 ETEyeTunes.m
View
6 ETAppleEventObject.m
@@ -374,7 +374,7 @@ - (int) getCountOfElementsOfClass:(DescType)descType
return -1;
}
- err = AEGetParamPtr(replyEvent, keyDirectObject, typeInteger, &resultType,
+ err = AEGetParamPtr(replyEvent, keyDirectObject, typeSInt32, &resultType,
&count, sizeof(count), &resultSize);
if (err != noErr) {
ETLog(@"Unable to get parameter of reply: %d", err);
@@ -755,7 +755,7 @@ - (int) getPropertyAsIntegerForDesc:(DescType)descType
}
/* Read Results */
- err = AEGetParamPtr(replyEvent, keyDirectObject, typeInteger, &resultType,
+ err = AEGetParamPtr(replyEvent, keyDirectObject, typeSInt32, &resultType,
&replyValue, sizeof(replyValue), &resultSize);
if (err != noErr) {
ETLog(@"Error extracting parameters from reply: %d", err);
@@ -1135,7 +1135,7 @@ - (NSArray *) getPropertyAsIntegerWithDumpForDesc:(DescType)descType
}
/* Read Results */
- err = AEGetParamPtr(replyEvent, keyDirectObject, typeInteger, &resultType,
+ err = AEGetParamPtr(replyEvent, keyDirectObject, typeSInt32, &resultType,
&replyValue, sizeof(replyValue), &resultSize);
if (err != noErr) {
ETLog(@"Error extracting parameters from reply: %d", err);
View
3  ETEyeTunes.h
@@ -50,6 +50,9 @@
//Launch the iTunes app, if iTunes it already running the window will take focus
+ (void)launch;
+//Quit the iTunes app, if it's running
++ (void)quit;
+
//Check if the iTunes app is running
+ (BOOL)isRunning;
View
16 ETEyeTunes.m
@@ -62,18 +62,12 @@ + (void)launch{
[[NSWorkspace sharedWorkspace] launchApplication:@"iTunes"];
}
++ (void)quit{
+ [[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.iTunes"] makeObjectsPerformSelector:@selector(terminate)];
+}
+
+ (BOOL)isRunning{
- //TODO: It is strongly suggested that you use the NSWorkspace runningApplications method and the NSRunningApplication class to retrieve this information in applications targeted for Mac OS X v10.6 and later.
- NSInteger i;
- NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications];
- for(i=0; i<[apps count]; ++i){
- NSDictionary *app = [apps objectAtIndex:i];
- NSString *bundleIdentifier = [app objectForKey:@"NSApplicationBundleIdentifier"];
- if([bundleIdentifier isEqualToString:@"com.apple.iTunes"]){
- return YES;
- }
- }
- return NO;
+ return ([[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.iTunes"] count] > 0);
}
#pragma mark -
Please sign in to comment.
Something went wrong with that request. Please try again.