summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2018-08-09 08:49:05 +0200
committerDamiano Galassi <[email protected]>2018-08-09 08:49:05 +0200
commit71af3fc5fbdf00a8a57e0f9047da3b333aa441a1 (patch)
tree8c22a343e174cddb53af82fda964d1dde9c609e6 /macosx
parent7203d0488b226d444d473e669328d19835029b62 (diff)
MacGui: fix closing the add catagery window when presented as modal.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBAddCategoryController.m20
1 files changed, 18 insertions, 2 deletions
diff --git a/macosx/HBAddCategoryController.m b/macosx/HBAddCategoryController.m
index dd85ea4d7..598f70460 100644
--- a/macosx/HBAddCategoryController.m
+++ b/macosx/HBAddCategoryController.m
@@ -52,7 +52,15 @@
- (IBAction)dismiss:(id)sender
{
- [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel];
+ if (self.window.isSheet)
+ {
+ [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel];
+ }
+ else
+ {
+ [NSApp stopModalWithCode:NSModalResponseCancel];
+ [self.window orderOut:self];
+ }
}
- (IBAction)create:(id)sender
@@ -60,7 +68,15 @@
self.category = [[HBPreset alloc] initWithCategoryName:self.name.stringValue builtIn:NO];
[self.manager addPreset:self.category];
- [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK];
+ if (self.window.isSheet)
+ {
+ [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK];
+ }
+ else
+ {
+ [NSApp stopModalWithCode:NSModalResponseOK];
+ [self.window orderOut:self];
+ }
}