- (NSMenu *)eqMenu;
- (void)setKeyEquivalentForCode:(short)code andModifiers:(long)modifiers
onItem:(id <NSMenuItem>)item;
-//- (BOOL)iPodAtPathAutomaticallyUpdates:(NSString *)name;
+- (BOOL)iPodAtPathAutomaticallyUpdates:(NSString *)name;
@end
@implementation MenuController
return upcomingSongsMenu;
}
-- (NSMenu *)playlistsMenu
+/*- (NSMenu *)playlistsMenu
{
NSMenu *playlistsMenu = [[NSMenu alloc] initWithTitle:@""];
NSArray *playlists;
}
ITDebugLog(@"Done Building \"Playlists\" menu");
return playlistsMenu;
-}
+}*/
-/*- (NSMenu *)playlistsMenu
+- (NSMenu *)playlistsMenu
{
NSMenu *playlistsMenu = [[NSMenu alloc] initWithTitle:@""];
NSArray *playlists;
- NSMenuItem *tempItem;
+ id <NSMenuItem> tempItem;
ITMTRemotePlayerSource source = [[[MainController sharedController] currentRemote] currentSource];
int i, j;
NS_DURING
[tempItem setTarget:self];
}
}
-
if ( (source == ITMTRemoteRadioSource) || ([playlists count] - 2 > 0) ) {
[playlistsMenu addItem:[NSMenuItem separatorItem]];
}
}
ITDebugLog(@"Done Building \"Playlists\" menu");
return playlistsMenu;
-}*/
+}
- (NSMenu *)eqMenu
{
ITDebugLog(@"Done setting key equivalent on menu item: %@", [item title]);
}
-/*- (BOOL)iPodAtPathAutomaticallyUpdates:(NSString *)name
+- (BOOL)iPodAtPathAutomaticallyUpdates:(NSString *)name
{
NSArray *volumes = [[NSWorkspace sharedWorkspace] mountedLocalVolumePaths];
NSEnumerator *volEnum = [volumes objectEnumerator];
}
}
}
-}*/
+ return NO;
+}
@end
\ No newline at end of file
- (BOOL)showPrimaryInterface
{
ITDebugLog(@"Showing player primary interface.");
- //If not minimized
- if ([[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"'----':obj { form:'prop', want:type('prop'), seld:type('pMin'), from:obj { form:'indx', want:type('cBrW'), seld:1, from:'null'() } }" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] == 0) {
+ //If not minimized and visible
+ if ( ([[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"'----':obj { form:'prop', want:type('prop'), seld:type('pMin'), from:obj { form:'indx', want:type('cBrW'), seld:1, from:'null'() } }" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] == 0) &&
+ ([[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"'----':obj { form:'prop', want:type('prop'), seld:type('pvis'), from:obj { form:'indx', want:type('cBrW'), seld:1, from:'null'() } }" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] != 0) &&
+ [[[[NSWorkspace sharedWorkspace] activeApplication] objectForKey:@"NSApplicationName"] isEqualToString:@"iTunes"] ) {
//set minimized of browser window 1 to true
[[ITAppleEventCenter sharedCenter] sendAEWithSendString:@"data:long(1), '----':obj { form:'prop', want:type('prop'), seld:type('pMin'), from:obj { form:'indx', want:type('cBrW'), seld:1, from:'null'() } }" eventClass:@"core" eventID:@"setd" appPSN:savedPSN];
} else {
return ITMTRemotePlayerStopped;
}
-- (NSArray *)playlists
+/*- (NSArray *)playlists
{
long i = 0;
const signed long numPlaylists = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"kocl:type('cPly'), '----':()" eventClass:@"core" eventID:@"cnte" appPSN:savedPSN];
[playlists addObject:theObj];
}
return [playlists autorelease];
-}
+}*/
//Full source awareness
-/*- (NSArray *)playlists
+- (NSArray *)playlists
{ unsigned long i,k;
const signed long numSources = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"kocl:type('cSrc'), '----':()" eventClass:@"core" eventID:@"cnte" appPSN:savedPSN];
NSMutableArray *allSources = [[NSMutableArray alloc] init];
NSNumber *sourceClass;
NSMutableArray *aSource = [[NSMutableArray alloc] init];
[aSource addObject:sourceName];
-
switch (fourcc) {
case 'kTun':
sourceClass = [NSNumber numberWithInt:ITMTRemoteRadioSource];
sourceClass = [NSNumber numberWithInt:ITMTRemoteLibrarySource];
break;
}
-
+ ITDebugLog(@"Adding source %@ of type %i", sourceName, [sourceClass intValue]);
[aSource addObject:sourceClass];
for (i = 1; i <= numPlaylists; i++) {
NSString *sendStr = [NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pnam'), from:obj { form:'indx', want:type('cPly'), seld:long(%u), from:obj { form:'indx', want:type('cSrc'), seld:long(%u), from:() } } }",i,k];
NSString *theObj = [[ITAppleEventCenter sharedCenter] sendAEWithSendString:sendStr eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+ ITDebugLog(@" - Adding playlist %@", theObj);
[aSource addObject:theObj];
}
[allSources addObject:aSource];
[aSource release];
}
ITDebugLog(@"Finished getting playlists.");
- return [NSArray arrayWithArray:[allSources autorelease]];
-}*/
+ return [allSources autorelease];
+}
- (int)numberOfSongsInPlaylistAtIndex:(int)index
{