Skip to content

Commit 0a13f5a

Browse files
committed
Opening multiple documents will now use the same window size
If frame isn't explicitly set using the autosaveName then the autosaveName is only used for the first two windows. Opening the third and subsequent windows then start using the default window size instead of the autosave frame.
1 parent b09abc2 commit 0a13f5a

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Classes/Controllers/PBGitWindowController.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ - (void)synchronizeWindowTitleWithDocumentName
4646
{
4747
[super synchronizeWindowTitleWithDocumentName];
4848

49-
// Point window proxy icon at project directory, not internal .git dir
50-
[[self window] setRepresentedURL:self.repository.workingDirectoryURL];
49+
if ([self isWindowLoaded]) {
50+
// Point window proxy icon at project directory, not internal .git dir
51+
[[self window] setRepresentedURL:self.repository.workingDirectoryURL];
52+
}
5153
}
5254

5355
- (void)windowWillClose:(NSNotification *)notification
@@ -99,9 +101,14 @@ - (BOOL) validateMenuItem:(NSMenuItem *)menuItem remoteTitle:(NSString *)localis
99101
}
100102

101103

102-
- (void) awakeFromNib
104+
- (void) windowDidLoad
103105
{
104-
[[self window] setDelegate:self];
106+
[super windowDidLoad];
107+
108+
// Explicitly set the frame using the autosave name
109+
// Opening the first and second documents works fine, but the third and subsequent windows aren't positioned correctly
110+
[[self window] setFrameUsingName:@"GitX"];
111+
[[self window] setRepresentedURL:self.repository.workingDirectoryURL];
105112

106113
sidebarController = [[PBGitSidebarController alloc] initWithRepository:repository superController:self];
107114
[[sidebarController view] setFrame:[sourceSplitView bounds]];
@@ -110,8 +117,6 @@ - (void) awakeFromNib
110117

111118
[[statusField cell] setBackgroundStyle:NSBackgroundStyleRaised];
112119
[progressIndicator setUsesThreadedAnimation:YES];
113-
114-
[self showWindow:nil];
115120
}
116121

117122
- (void) removeAllContentSubViews

Resources/English.lproj/RepositoryWindow.xib

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136
<constraint firstAttribute="bottom" secondItem="396" secondAttribute="bottom" id="pIe-nQ-ntf"/>
137137
</constraints>
138138
</view>
139+
<connections>
140+
<outlet property="delegate" destination="-2" id="N8Y-0Q-xZn"/>
141+
</connections>
139142
</window>
140143
</objects>
141144
<resources>

0 commit comments

Comments
 (0)