Skip to content

Instantly share code, notes, and snippets.

@orlaqp
Created November 4, 2011 03:49
Show Gist options
  • Save orlaqp/1338623 to your computer and use it in GitHub Desktop.
Save orlaqp/1338623 to your computer and use it in GitHub Desktop.
- (void)authenticationResult:(BOOL)aResult
{
console.log("result received: " + aResult);
[_loginController closeModal];
if (aResult == YES)
{
// Prepare the Application Toolbar
_appToolbar = [[CPToolbar alloc] initWithIdentifier:@"mainToolbar"];
[_appToolbar setDelegate:self];
[_appToolbar setVisible:YES];
[_theWindow setToolbar:_appToolbar];
}
}
// --> Toolbar Delegates
- (CPArray)toolbarDefaultItemIdentifiers:(CPToolbar)toolbar
{
console.log('default items');
return
[
AirplaneTicketsTII,
VisasTII,
PassportsTII,
PackagesTII,
MoneyTII,
InvitationsTII,
RentsTII
];
}
- (CPArray)toolbarAllowedItemIdentifiers:(CPToolbar)toolbar
{
console.log('allowed items');
return
[
AirplaneTicketsTII,
VisasTII,
PassportsTII,
PackagesTII,
MoneyTII,
InvitationsTII,
RentsTII
];
}
- (CPToolbarItem)toolbar:(CPToolbar)toolbar itemForItemIdentifier:(CPString)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
{
console.log('item for identifier');
var mainBundle = [CPBundle mainBundle];
if (itemIdentifier == PassportsTII)
{
var image = [[CPImage alloc] initWithContentsOfFile:[mainBundle pathForResource:@"passport.png"] size:CPSizeMake(30, 25)];
var highlighted = [[CPImage alloc] initWithContentsOfFile:[mainBundle pathForResource:@"passport.png"] size:CPSizeMake(30, 25)];
[toolbarItem setAction:@selector(remove:)];
[toolbarItem setLabel:"Remove Photo List"];
}
[toolbarItem setImage:image];
[toolbarItem setAlternateImage:highlighted];
[toolbarItem setTarget:self];
[toolbarItem setMinSize:CGSizeMake(32, 32)];
[toolbarItem setMaxSize:CGSizeMake(32, 32)];
return toolbarItem;
}
// <-- Toolbar Delegates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment