diff options
author | rowanbeentje <rowan@beent.je> | 2009-11-04 23:31:24 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-11-04 23:31:24 +0000 |
commit | 97fd0957cef34210caece133fee16a370e5b9f5d (patch) | |
tree | 7ce20b594d9ef662b9585f51bea5cb22be64df64 | |
parent | 98938d5adb4e563a8be1ceb60d1fb4122276fbe0 (diff) | |
download | sequelpro-97fd0957cef34210caece133fee16a370e5b9f5d.tar.gz sequelpro-97fd0957cef34210caece133fee16a370e5b9f5d.tar.bz2 sequelpro-97fd0957cef34210caece133fee16a370e5b9f5d.zip |
- Use threaded loads when switching view tabs for unloaded tables
-rw-r--r-- | Source/TablesList.m | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m index 9264b9f1..c2dcd4a7 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -1404,10 +1404,18 @@ #pragma mark TabView delegate methods /** - * Loads structure or source if tab selected the first time + * Loads structure or source if tab selected the first time, + * using a threaded load. */ - (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { + [tableDocumentInstance startTaskWithDescription:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTableName]]; + [NSThread detachNewThreadSelector:@selector(loadTabTask:) toTarget:self withObject:tabViewItem]; +} +- (void)loadTabTask:(NSTabViewItem *)tabViewItem +{ + NSAutoreleasePool *tabLoadPool = [[NSAutoreleasePool alloc] init]; + if ( [tablesListView numberOfSelectedRows] == 1 && ([self tableType] == SP_TABLETYPE_TABLE || [self tableType] == SP_TABLETYPE_VIEW) ) { @@ -1430,6 +1438,9 @@ [tableSourceInstance loadTable:nil]; [tableContentInstance loadTable:nil]; } + + [tableDocumentInstance endTask]; + [tabLoadPool drain]; } /** |