HistoryView: don't load in commit information in a separate thread anymore
[GitX.git] / PBRefMenuItem.m
blob22aaae5a7e21c273e329a0027f7361c73ce42092
1 //
2 //  PBRefMenuItem.m
3 //  GitX
4 //
5 //  Created by Pieter de Bie on 01-11-08.
6 //  Copyright 2008 Pieter de Bie. All rights reserved.
7 //
9 #import "PBRefMenuItem.h"
12 @implementation PBRefMenuItem
13 @synthesize ref, commit;
15 + (NSArray *)defaultMenuItemsForRef:(PBGitRef *)ref commit:(PBGitCommit *)commit target:(id)target
17         NSMutableArray *array = [NSMutableArray array];
18         NSString *type = [ref type];
19         if ([type isEqualToString:@"remote"])
20                 type = @"remote branch";
21         else if ([type isEqualToString:@"head"])
22                 type = @"branch";
24         [array addObject:[[PBRefMenuItem alloc] initWithTitle:[@"Delete " stringByAppendingString:type]
25                                                                                                    action:@selector(removeRef:)
26                                                                                         keyEquivalent: @""]];
27         if ([type isEqualToString:@"branch"])
28                 [array addObject:[[PBRefMenuItem alloc] initWithTitle:@"Checkout branch"
29                                                                                                            action:@selector(checkoutRef:)
30                                                                                                 keyEquivalent: @""]];
32     if ([type isEqualToString:@"tag"])
33                 [array addObject:[[PBRefMenuItem alloc] initWithTitle:@"View tag info"
34                                                                                                            action:@selector(tagInfo:)
35                                                                                                 keyEquivalent: @""]];    
36         
37         for (PBRefMenuItem *item in array)
38         {
39                 [item setTarget: target];
40                 [item setRef: ref];
41                 [item setCommit:commit];
42         }
44         return array;
46 @end