Skip to content

Commit 5982a16

Browse files
committed
Modernize PBGitSidebarController
1 parent a6b943e commit 5982a16

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

Classes/Controllers/PBGitSidebarController.h

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,23 @@
1414
@class PBGitHistoryController;
1515
@class PBGitCommitController;
1616

17-
@interface PBGitSidebarController : PBViewController<NSOutlineViewDelegate> {
18-
__weak IBOutlet NSWindow *window;
19-
__weak IBOutlet NSOutlineView *sourceView;
20-
__weak IBOutlet NSView *sourceListControlsView;
21-
__weak IBOutlet NSPopUpButton *actionButton;
22-
__weak IBOutlet NSSegmentedControl *remoteControls;
17+
NS_ASSUME_NONNULL_BEGIN
2318

24-
NSMutableArray *items;
19+
@interface PBGitSidebarController : PBViewController
2520

26-
/* Specific things */
27-
PBSourceViewItem *stage;
21+
- (void)selectStage;
22+
- (void)selectCurrentBranch;
2823

29-
PBSourceViewItem *branches, *remotes, *tags, *others, *submodules, *stashes;
30-
}
24+
- (NSMenu *)menuForRow:(NSInteger)row;
25+
- (void)menuNeedsUpdate:(NSMenu *)menu;
3126

32-
- (void) selectStage;
33-
- (void) selectCurrentBranch;
27+
- (IBAction)fetchPullPushAction:(id)sender;
3428

35-
- (NSMenu *) menuForRow:(NSInteger)row;
36-
- (void) menuNeedsUpdate:(NSMenu *)menu;
37-
38-
- (IBAction) fetchPullPushAction:(id)sender;
39-
40-
@property(readonly) NSMutableArray *items;
41-
@property(readonly) PBSourceViewItem *remotes;
42-
@property(readonly) NSOutlineView *sourceView;
43-
@property(readonly) NSView *sourceListControlsView;
29+
@property (readonly) NSMutableArray *items;
30+
@property (readonly) PBSourceViewItem *remotes;
31+
@property (readonly) NSOutlineView *sourceView;
32+
@property (readonly) NSView *sourceListControlsView;
4433

4534
@end
35+
36+
NS_ASSUME_NONNULL_END

Classes/Controllers/PBGitSidebarController.m

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,20 @@
2222

2323
#define PBSidebarCellIdentifier @"PBSidebarCellIdentifier"
2424

25-
@interface PBGitSidebarController ()
25+
@interface PBGitSidebarController () <NSOutlineViewDelegate> {
26+
__weak IBOutlet NSWindow *window;
27+
__weak IBOutlet NSOutlineView *sourceView;
28+
__weak IBOutlet NSView *sourceListControlsView;
29+
__weak IBOutlet NSPopUpButton *actionButton;
30+
__weak IBOutlet NSSegmentedControl *remoteControls;
31+
32+
NSMutableArray *items;
33+
34+
/* Specific things */
35+
PBSourceViewItem *stage;
36+
37+
PBSourceViewItem *branches, *remotes, *tags, *others, *submodules, *stashes;
38+
}
2639

2740
- (void)populateList;
2841
- (PBSourceViewItem *)addRevSpec:(PBGitRevSpecifier *)revSpec;
@@ -38,9 +51,11 @@ @implementation PBGitSidebarController
3851
@synthesize sourceView;
3952
@synthesize sourceListControlsView;
4053

41-
- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller
54+
- (instancetype)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller
4255
{
4356
self = [super initWithRepository:theRepository superController:controller];
57+
if (!self) return nil;
58+
4459
[sourceView setDelegate:self];
4560
items = [NSMutableArray array];
4661

0 commit comments

Comments
 (0)