mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
42 lines
1.0 KiB
Objective-C
42 lines
1.0 KiB
Objective-C
//
|
|
// PBRefMenuItem.m
|
|
// GitX
|
|
//
|
|
// Created by Pieter de Bie on 01-11-08.
|
|
// Copyright 2008 Pieter de Bie. All rights reserved.
|
|
//
|
|
|
|
#import "PBRefMenuItem.h"
|
|
|
|
|
|
@implementation PBRefMenuItem
|
|
@synthesize ref, commit;
|
|
|
|
+ (NSArray *)defaultMenuItemsForRef:(PBGitRef *)ref commit:(PBGitCommit *)commit target:(id)target
|
|
{
|
|
NSMutableArray *array = [NSMutableArray array];
|
|
NSString *type = [ref type];
|
|
if ([type isEqualToString:@"remote"])
|
|
type = @"remote branch";
|
|
else if ([type isEqualToString:@"head"])
|
|
type = @"branch";
|
|
|
|
[array addObject:[[PBRefMenuItem alloc] initWithTitle:[@"Delete " stringByAppendingString:type]
|
|
action:@selector(removeRef:)
|
|
keyEquivalent: @""]];
|
|
if ([type isEqualToString:@"branch"])
|
|
[array addObject:[[PBRefMenuItem alloc] initWithTitle:@"Checkout branch"
|
|
action:@selector(checkoutRef:)
|
|
keyEquivalent: @""]];
|
|
|
|
for (PBRefMenuItem *item in array)
|
|
{
|
|
[item setTarget: target];
|
|
[item setRef: ref];
|
|
[item setCommit:commit];
|
|
}
|
|
|
|
return array;
|
|
}
|
|
@end
|