Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (32 sloc) 0.906 kB
//
// AppleScript.m
// ControlPlane
//
// Created by David Jennes on 24/08/11.
// Copyright 2011. All rights reserved.
//
#import "AppleScript.h"
#import "CPController.h"
@implementation NSApplication (AppleScript)
// current context property
- (NSString *) currentContext {
return [[NSApp delegate] currentContextName];
}
- (void) setCurrentContext: (NSString*) newContext {
CPController *c = (CPController *) [NSApp delegate];
Context *context = [[c contextsDataSource] contextByName: newContext];
if (context)
[c forceSwitch: context];
else
NSLog(@"Context not found: '%@'", newContext);
}
// sticky property
- (NSNumber *) sticky {
return [NSNumber numberWithBool: [[NSApp delegate] stickyContext]];
}
- (void) setSticky: (NSNumber *) sticky {
CPController *c = (CPController *) [NSApp delegate];
if ([c stickyContext] != [sticky boolValue])
[c toggleSticky:nil];
}
@end
Jump to Line
Something went wrong with that request. Please try again.