aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-08-07 00:44:03 +0000
committerstuconnolly <stuart02@gmail.com>2009-08-07 00:44:03 +0000
commit07d4efb4be320ca4d991af0df8c59baa4055fb98 (patch)
tree8bc19f94b765d54474f784efb609494c69ae05a1
parent33bb8228928829fec53b02876bd262b3cc8160ad (diff)
downloadsequelpro-07d4efb4be320ca4d991af0df8c59baa4055fb98.tar.gz
sequelpro-07d4efb4be320ca4d991af0df8c59baa4055fb98.tar.bz2
sequelpro-07d4efb4be320ca4d991af0df8c59baa4055fb98.zip
Don't run the add relation sheet application modally and thus block the entire main thread until it is dismissed. Note that is not only sheet that is being run using runModalForWindow, which is subsequently causing the same issue. Fixes issue #357.
-rw-r--r--Source/SPTableRelations.m33
1 files changed, 14 insertions, 19 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index 3fcbe184..b3ae6b50 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -71,8 +71,8 @@
*/
- (IBAction)closeRelationSheet:(id)sender
{
- // 0 = success
- [NSApp stopModalWithCode:0];
+ [NSApp endSheet:addRelationPanel returnCode:0];
+ [addRelationPanel orderOut:self];
}
/**
@@ -80,6 +80,8 @@
*/
- (IBAction)confirmAddRelation:(id)sender
{
+ [self closeRelationSheet:self];
+
NSString *thisTable = [tablesListInstance tableName];
NSString *thisColumn = [columnPopUpButton titleOfSelectedItem];
NSString *thatTable = [refTablePopUpButton titleOfSelectedItem];
@@ -106,7 +108,16 @@
int retCode = (![[connection getLastErrorMessage] isEqualToString:@""]);
- [NSApp stopModalWithCode:retCode];
+ // 0 indicates success
+ if (retCode) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error creating relation", @"error creating relation message"),
+ NSLocalizedString(@"OK", @"OK button"),
+ nil, nil, [NSApp mainWindow], nil, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"The specified relation was unable to be created.\n\nMySQL said: %@", @"error creating relation informative message"), [connection getLastErrorMessage]]);
+ }
+ else {
+ [self _refreshRelationDataForcingCacheRefresh:YES];
+ }
}
/**
@@ -155,22 +166,6 @@
modalDelegate:self
didEndSelector:nil
contextInfo:nil];
-
- int code = [NSApp runModalForWindow:addRelationPanel];
-
- [NSApp endSheet:addRelationPanel];
- [addRelationPanel orderOut:nil];
-
- // 0 indicates success
- if (code) {
- NSBeginAlertSheet(NSLocalizedString(@"Error creating relation", @"error creating relation message"),
- NSLocalizedString(@"OK", @"OK button"),
- nil, nil, [NSApp mainWindow], nil, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"The specified relation was unable to be created.\n\nMySQL said: %@", @"error creating relation informative message"), [connection getLastErrorMessage]]);
- }
- else {
- [self _refreshRelationDataForcingCacheRefresh:YES];
- }
}
/**