mirror of
https://github.com/textmate/textmate.git
synced 2026-01-19 19:58:11 -05:00
Close bundle install sheet on error
Previously incase of error the sheet would keep showing effectively locking up the document window. This is related to issue #85 although the reason why installing bundles fails for some users is still unanswered.
This commit is contained in:
@@ -205,15 +205,22 @@ static bool is_installed (oak::uuid_t const& uuid)
|
||||
{
|
||||
if(bundleUUID == (*bundle)->uuid())
|
||||
{
|
||||
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(checkIfBundleIsInstalled:) userInfo:[grammar objectForKey:@"uuid"] repeats:YES];
|
||||
[[BundlesManager sharedInstance] installBundle:*bundle completionHandler:nil];
|
||||
[installingBundleActivityTextField bind:NSValueBinding toObject:[BundlesManager sharedInstance] withKeyPath:@"activityText" options:nil];
|
||||
[installingBundleProgressIndicator bind:NSValueBinding toObject:[BundlesManager sharedInstance] withKeyPath:@"progress" options:nil];
|
||||
[installingBundleProgressIndicator bind:NSIsIndeterminateBinding toObject:[BundlesManager sharedInstance] withKeyPath:@"determinateProgress" options:@{ NSValueTransformerNameBindingOption: @"NSNegateBoolean" }];
|
||||
[installingBundleProgressIndicator startAnimation:self];
|
||||
OakShowSheetForWindow(installingBundleWindow, aWindow, ^(NSInteger returnCode){
|
||||
aCompletionHandler(self.fileType);
|
||||
});
|
||||
|
||||
OakShowSheetForWindow(installingBundleWindow, aWindow, ^(NSInteger returnCode){ });
|
||||
|
||||
[[BundlesManager sharedInstance] installBundle:*bundle completionHandler:^(BOOL success){
|
||||
[installingBundleProgressIndicator stopAnimation:self];
|
||||
[installingBundleProgressIndicator unbind:NSValueBinding];
|
||||
[installingBundleActivityTextField unbind:NSValueBinding];
|
||||
[NSApp endSheet:installingBundleWindow];
|
||||
[installingBundleWindow orderOut:self];
|
||||
|
||||
aCompletionHandler(is_installed(uuid) ? self.fileType : @"text.plain");
|
||||
}];
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -222,21 +229,6 @@ static bool is_installed (oak::uuid_t const& uuid)
|
||||
});
|
||||
}
|
||||
|
||||
- (void)checkIfBundleIsInstalled:(NSTimer*)aTimer
|
||||
{
|
||||
NSString* uuid = [aTimer userInfo];
|
||||
if(is_installed(to_s(uuid)))
|
||||
{
|
||||
[aTimer invalidate];
|
||||
|
||||
[installingBundleProgressIndicator stopAnimation:self];
|
||||
[installingBundleProgressIndicator unbind:NSValueBinding];
|
||||
[installingBundleActivityTextField unbind:NSValueBinding];
|
||||
[NSApp endSheet:installingBundleWindow];
|
||||
[installingBundleWindow orderOut:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)performOpenDocument:(id)sender
|
||||
{
|
||||
[self.window orderOut:self];
|
||||
|
||||
Reference in New Issue
Block a user