Skip to content

Commit 03dc781

Browse files
committed
Disable Commit button when there are no staged files.
1 parent 1c4601d commit 03dc781

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

PBGitCommitController.h

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
IBOutlet NSTextView *commitMessageView;
2020
IBOutlet NSArrayController *unstagedFilesController;
2121
IBOutlet NSArrayController *cachedFilesController;
22+
IBOutlet NSButton *commitButton;
2223

2324
IBOutlet PBGitIndexController *indexController;
2425
IBOutlet PBWebChangesController *webController;

PBGitCommitController.m

+6
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ - (void)indexChanged:(NSNotification *)notification
177177
{
178178
[cachedFilesController rearrangeObjects];
179179
[unstagedFilesController rearrangeObjects];
180+
if ([[cachedFilesController arrangedObjects] count]) {
181+
[commitButton setEnabled:YES];
182+
} else {
183+
[commitButton setEnabled:NO];
184+
}
185+
180186
}
181187

182188
- (void)indexOperationFailed:(NSNotification *)notification

PBGitCommitView.xib

+11-1
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,14 @@
12021202
</object>
12031203
<int key="connectionID">283</int>
12041204
</object>
1205+
<object class="IBConnectionRecord">
1206+
<object class="IBOutletConnection" key="connection">
1207+
<string key="label">commitButton</string>
1208+
<reference key="source" ref="1001"/>
1209+
<reference key="destination" ref="792511503"/>
1210+
</object>
1211+
<int key="connectionID">307</int>
1212+
</object>
12051213
</object>
12061214
<object class="IBMutableOrderedSet" key="objectRecords">
12071215
<object class="NSArray" key="orderedObjects">
@@ -1663,7 +1671,7 @@
16631671
</object>
16641672
</object>
16651673
<nil key="sourceID"/>
1666-
<int key="maxID">283</int>
1674+
<int key="maxID">307</int>
16671675
</object>
16681676
<object class="IBClassDescriber" key="IBDocument.Classes">
16691677
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1707,6 +1715,7 @@
17071715
<object class="NSMutableArray" key="dict.sortedKeys">
17081716
<bool key="EncodedWithXMLCoder">YES</bool>
17091717
<string>cachedFilesController</string>
1718+
<string>commitButton</string>
17101719
<string>commitMessageView</string>
17111720
<string>indexController</string>
17121721
<string>unstagedFilesController</string>
@@ -1715,6 +1724,7 @@
17151724
<object class="NSMutableArray" key="dict.values">
17161725
<bool key="EncodedWithXMLCoder">YES</bool>
17171726
<string>NSArrayController</string>
1727+
<string>NSButton</string>
17181728
<string>NSTextView</string>
17191729
<string>PBGitIndexController</string>
17201730
<string>NSArrayController</string>

0 commit comments

Comments
 (0)