mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Properly handle deselection in file lists.
This commit is contained in:
committed by
Pieter de Bie
parent
5d4a8c7a66
commit
47fa714714
@@ -38,15 +38,20 @@
|
||||
change:(NSDictionary *)change
|
||||
context:(void *)context
|
||||
{
|
||||
NSArrayController *otherController;
|
||||
otherController = object == unstagedFilesController ? cachedFilesController : unstagedFilesController;
|
||||
int count = [[object selectedObjects] count];
|
||||
if (count == 0)
|
||||
if (count == 0) {
|
||||
if([[otherController selectedObjects] count] == 0) {
|
||||
selectedFile = nil;
|
||||
selectedFileIsCached = NO;
|
||||
[self refresh];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Move this to commitcontroller
|
||||
if (object == unstagedFilesController)
|
||||
[cachedFilesController setSelectionIndexes:[NSIndexSet indexSet]];
|
||||
else
|
||||
[unstagedFilesController setSelectionIndexes:[NSIndexSet indexSet]];
|
||||
[otherController setSelectionIndexes:[NSIndexSet indexSet]];
|
||||
|
||||
if (count > 1) {
|
||||
[self showMultiple: [object selectedObjects]];
|
||||
@@ -66,12 +71,13 @@
|
||||
|
||||
- (void) refresh
|
||||
{
|
||||
if (!finishedLoading || !selectedFile)
|
||||
if (!finishedLoading)
|
||||
return;
|
||||
|
||||
id script = [view windowScriptObject];
|
||||
[script callWebScriptMethod:@"showFileChanges"
|
||||
withArguments:[NSArray arrayWithObjects:selectedFile, [NSNumber numberWithBool:selectedFileIsCached], nil]];
|
||||
withArguments:[NSArray arrayWithObjects:selectedFile ?: (id)[NSNull null],
|
||||
[NSNumber numberWithBool:selectedFileIsCached], nil]];
|
||||
}
|
||||
|
||||
- (void) stageHunk:(NSString *)hunk reverse:(BOOL)reverse
|
||||
|
||||
@@ -23,8 +23,12 @@ var setState = function(state) {
|
||||
}
|
||||
|
||||
var showFileChanges = function(file, cached) {
|
||||
if (!file)
|
||||
if (!file) {
|
||||
$("title").innerHTML = "No file selected";
|
||||
hideNotification();
|
||||
setState("No file selected");
|
||||
return;
|
||||
}
|
||||
|
||||
hideNotification();
|
||||
hideState();
|
||||
|
||||
Reference in New Issue
Block a user