Permalink
Browse files

Remove another 2 cases of very strange object notification behavior (…

…code style)
  • Loading branch information...
dmoagx committed Jan 17, 2018
1 parent 74b18ee commit ef21bc5c3749756c21804d1592f3a3fe2faf7cab
View
@@ -452,6 +452,8 @@ extern NSString *SPSSHEnableMuxingPreference;
extern NSString *SPSSHClientPath;
extern NSString *SPSSLCipherListKey;
extern NSString *SPQueryFavoritesHaveBeenUpdatedNotification;
extern NSString *SPHistoryItemsHaveBeenUpdatedNotification;
extern NSString *SPContentFiltersHaveBeenUpdatedNotification;
// URLs
extern NSString *SPDonationsURL;
View
@@ -249,6 +249,8 @@
NSString *SPSSHClientPath = @"SSHClientPath";
NSString *SPSSLCipherListKey = @"SSLCipherList";
NSString *SPQueryFavoritesHaveBeenUpdatedNotification = @"QueryFavoritesHaveBeenUpdatedNotification";
NSString *SPHistoryItemsHaveBeenUpdatedNotification = @"HistoryItemsHaveBeenUpdatedNotification";
NSString *SPContentFiltersHaveBeenUpdatedNotification = @"ContentFiltersHaveBeenUpdatedNotification";
// URLs
NSString *SPDonationsURL = @"http://www.sequelpro.com/donate/";
@@ -31,12 +31,6 @@
@class SPDatabaseDocument;
@class SPSplitView;
@interface NSObject (SPContentFilterManagerDelegate)
- (void)contentFiltersHaveBeenUpdated:(id)manager;
@end
@interface SPContentFilterManager : NSWindowController <NSOpenSavePanelDelegate>
{
#ifndef SP_CODA /* ivars */
@@ -406,11 +406,8 @@ - (IBAction)closeContentFilterManagerSheet:(id)sender
[cf release];
// Inform all opened documents to update the query favorites list
for(id doc in [SPAppDelegate orderedDocuments])
if([[doc valueForKeyPath:@"tableContentInstance"] respondsToSelector:@selector(setCompareTypes:)])
[[doc valueForKeyPath:@"tableContentInstance"] setCompareTypes:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:SPContentFiltersHaveBeenUpdatedNotification object:self];
#endif
}
}
View
@@ -298,7 +298,6 @@
- (NSRange)currentQueryRange;
- (NSString *)buildHistoryString;
- (void)addHistoryEntry:(NSString *)entryString;
- (void)historyItemsHaveBeenUpdated:(id)manager;
- (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo;
@end
View
@@ -72,6 +72,7 @@ - (id)_resultDataItemAtRow:(NSInteger)row columnIndex:(NSUInteger)column preserv
+ (NSString *)linkToHelpTopic:(NSString *)aTopic;
- (void)documentWillClose:(NSNotification *)notification;
- (void)queryFavoritesHaveBeenUpdated:(NSNotification *)notification;
- (void)historyItemsHaveBeenUpdated:(NSNotification *)notification;
@end
@@ -1621,7 +1622,7 @@ - (void)setConnection:(SPMySQLConnection *)theConnection
#ifndef SP_CODA
if ( [[SPQueryController sharedQueryController] historyForFileURL:[tableDocumentInstance fileURL]] )
[self performSelectorOnMainThread:@selector(historyItemsHaveBeenUpdated:) withObject:self waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(historyItemsHaveBeenUpdated:) withObject:nil waitUntilDone:YES];
// Populate query favorites
[self queryFavoritesHaveBeenUpdated:nil];
@@ -3369,8 +3370,12 @@ - (BOOL)windowShouldClose:(id)sender
/**
* Rebuild history popup menu.
*
* Warning: notification may be nil if invoked directly from within this class.
*
* MUST BE CALLED ON THE UI THREAD!
*/
- (void)historyItemsHaveBeenUpdated:(id)manager
- (void)historyItemsHaveBeenUpdated:(NSNotification *)notification
{
// Abort if the connection has been closed already - sign of a closed window
if (![mySQLConnection isConnected]) return;
@@ -3997,6 +4002,10 @@ - (void)awakeFromNib
selector:@selector(queryFavoritesHaveBeenUpdated:)
name:SPQueryFavoritesHaveBeenUpdatedNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(historyItemsHaveBeenUpdated:)
name:SPHistoryItemsHaveBeenUpdatedNotification
object:nil];
#ifndef SP_CODA
[prefs addObserver:self forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL];
@@ -204,13 +204,8 @@ - (void)replaceHistoryByArray:(NSArray *)historyArray forFileURL:(NSURL *)fileUR
}
// Inform all opened documents to update the history list
for (id doc in [SPAppDelegate orderedDocuments])
{
if([[doc valueForKeyPath:@"customQueryInstance"] respondsToSelector:@selector(historyItemsHaveBeenUpdated:)]) {
[[doc valueForKeyPath:@"customQueryInstance"] performSelectorOnMainThread:@selector(historyItemsHaveBeenUpdated:) withObject:self waitUntilDone:NO];
}
}
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPHistoryItemsHaveBeenUpdatedNotification object:self];
// User did choose to clear the global history list
if (![fileURL isFileURL] && ![historyArray count]) {
[prefs setObject:historyArray forKey:SPQueryHistory];
View
@@ -83,6 +83,7 @@ @interface SPTableContent ()
- (BOOL)cancelRowEditing;
- (void)documentWillClose:(NSNotification *)notification;
- (void)contentFiltersHaveBeenUpdated:(NSNotification *)notification;
@end
@@ -305,6 +306,10 @@ - (void)awakeFromNib
selector:@selector(documentWillClose:)
name:SPDocumentWillCloseNotification
object:tableDocumentInstance];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentFiltersHaveBeenUpdated:)
name:SPContentFiltersHaveBeenUpdatedNotification
object:nil];
}
#pragma mark -
@@ -2595,6 +2600,11 @@ - (void)clickLinkArrowTask:(SPTextAndLinkCell *)theArrowCell
[linkPool drain];
}
- (void)contentFiltersHaveBeenUpdated:(NSNotification *)notification
{
[self setCompareTypes:nil];
}
/**
* Sets the compare types for the filter and the appropriate formatter for the textField
*/

0 comments on commit ef21bc5

Please sign in to comment.