diff options
author | Max <post@wickenrode.com> | 2015-10-25 23:42:27 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-10-25 23:42:27 +0100 |
commit | 2ed7473afe7bcc9ab7243f3347a5112d917b7385 (patch) | |
tree | 1971289d8acda331e1a8939cbf40715d654f9c7e /Source | |
parent | 80272af56eb0236f4c56e60bf0661f036c6e311b (diff) | |
download | sequelpro-2ed7473afe7bcc9ab7243f3347a5112d917b7385.tar.gz sequelpro-2ed7473afe7bcc9ab7243f3347a5112d917b7385.tar.bz2 sequelpro-2ed7473afe7bcc9ab7243f3347a5112d917b7385.zip |
Wrap a repeated call in a simpler method
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPDataImport.m | 4 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 2 | ||||
-rw-r--r-- | Source/SPDatabaseStructure.h | 1 | ||||
-rw-r--r-- | Source/SPDatabaseStructure.m | 8 | ||||
-rw-r--r-- | Source/SPNavigatorController.m | 2 | ||||
-rw-r--r-- | Source/SPTableStructure.m | 2 | ||||
-rw-r--r-- | Source/SPTableStructureLoading.m | 5 | ||||
-rw-r--r-- | Source/SPTablesList.m | 18 |
8 files changed, 21 insertions, 21 deletions
diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 418b7970..1439d7ca 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -670,7 +670,7 @@ [tablesListInstance updateTables:self]; // Re-query the structure of all databases in the background - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier",tableDocumentInstance) target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; // Import finished Growl notification [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished" @@ -1193,7 +1193,7 @@ [[tablesListInstance onMainThread] updateTables:self]; // Re-query the structure of all databases in the background - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier",tableDocumentInstance) target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; // Select the new table [tablesListInstance selectItemWithName:selectedTableTarget]; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index fd4a74c5..2f7a5235 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -1032,7 +1032,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; [self _addDatabase]; // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier",self) target:databaseStructureRetrieval selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + [databaseStructureRetrieval queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; } else { // Reset chooseDatabaseButton diff --git a/Source/SPDatabaseStructure.h b/Source/SPDatabaseStructure.h index b40dd449..cfc0b3eb 100644 --- a/Source/SPDatabaseStructure.h +++ b/Source/SPDatabaseStructure.h @@ -57,6 +57,7 @@ - (SPMySQLConnection *)connection; // Structure retrieval from the server +- (void)queryDbStructureInBackgroundWithUserInfo:(NSDictionary *)userInfo; - (void)queryDbStructureWithUserInfo:(NSDictionary*)userInfo; - (BOOL)isQueryingDatabaseStructure; diff --git a/Source/SPDatabaseStructure.m b/Source/SPDatabaseStructure.m index 83ba38bb..6644e922 100644 --- a/Source/SPDatabaseStructure.m +++ b/Source/SPDatabaseStructure.m @@ -147,6 +147,14 @@ #pragma mark - #pragma mark Structure retrieval from the server +- (void)queryDbStructureInBackgroundWithUserInfo:(NSDictionary *)userInfo +{ + [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", delegate) + target:self + selector:@selector(queryDbStructureWithUserInfo:) + object:userInfo]; +} + /** * Updates the dict containing the structure of all available databases (mainly for completion/navigator) * executed on the helper connection. diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 1c7bfbba..47352f06 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -610,7 +610,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if (![[doc getConnection] isConnected]) return; - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", doc) target:[doc databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + [[doc databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; } - (IBAction)outlineViewAction:(id)sender diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 35e4c0f1..9973bf4b 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -969,7 +969,7 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey"; [tableDocumentInstance setContentRequiresReload:YES]; // Query the structure of all databases in the background - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", selectedTable, @"affectedItem", [NSNumber numberWithInteger:[tablesListInstance tableType]], @"affectedItemType", nil]]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:@YES, @"forceUpdate", selectedTable, @"affectedItem", [NSNumber numberWithInteger:[tablesListInstance tableType]], @"affectedItemType", nil]]; return YES; } diff --git a/Source/SPTableStructureLoading.m b/Source/SPTableStructureLoading.m index a28348dd..2c6d65fe 100644 --- a/Source/SPTableStructureLoading.m +++ b/Source/SPTableStructureLoading.m @@ -296,10 +296,7 @@ [tableDocumentInstance setStatusRequiresReload:YES]; // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) - target:[tableDocumentInstance databaseStructureRetrieval] - selector:@selector(queryDbStructureWithUserInfo:) - object:@{@"forceUpdate" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; [self loadTable:selectedTable]; } diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 4189d618..7449a2cf 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -357,10 +357,10 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; // Query the structure of all databases in the background if (sender == self) // Invoked by SP - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:nil]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:nil]; else // User press refresh button ergo force update - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES, @"cancelQuerying" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES, @"cancelQuerying" : @YES}]; } /** @@ -1611,7 +1611,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; #endif // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; } #ifndef SP_CODA @@ -2266,10 +2266,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; #endif // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) - target:[tableDocumentInstance databaseStructureRetrieval] - selector:@selector(queryDbStructureWithUserInfo:) - object:@{@"forceUpdate" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; } #ifndef SP_CODA /* operations performed on whole tables */ @@ -2417,10 +2414,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; #endif // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) - target:[tableDocumentInstance databaseStructureRetrieval] - selector:@selector(queryDbStructureWithUserInfo:) - object:@{@"forceUpdate" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; } else { // Error while creating new table @@ -2640,7 +2634,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType]; // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier", tableDocumentInstance) target:[tableDocumentInstance databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; } #endif |