Skip to content

Instantly share code, notes, and snippets.

@jamesbrink
Created March 18, 2011 12:39
Show Gist options
  • Save jamesbrink/875996 to your computer and use it in GitHub Desktop.
Save jamesbrink/875996 to your computer and use it in GitHub Desktop.
@import <Foundation/CPObject.j>
@import "UserSessionController.j"
@implementation AppController : CPObject
{
CPWindow mainWindow; //this "outlet" is connected automatically by the Cib
CPToolbar toolbar;
CPToolbarItem toolItemSearch;
CPToolbarItem toolItemUserName;
CPSearchField searchField;
CPTextField labelUserName;
CPString test;
UserSessionController userSessionController;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
}
- (void)awakeFromCib
{
[mainWindow setFullBridge:YES];
[labelUserName setStringValue:""];
[self checkAuth];
}
//Called to see if we are authenticated or not
-(void)checkAuth
{
var request = [[CPURLRequest alloc] initWithURL:[CPURL URLWithString: @"/user_sessions/authenticated"]];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
test = [[CPString alloc] init];
[CPURLConnection connectionWithRequest:request delegate:self];
[labelUserName setStringValue:@"horse shit"];
}
- (void)connection:(CPURLConnection) connection didReceiveData:(CPString)data
{
console.log([labelUserName stringValue]);
[labelUserName setStringValue:data];
console.log([labelUserName stringValue]);
}
@end
horse shit
false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment