aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPProcessListController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPProcessListController.m')
-rw-r--r--Source/SPProcessListController.m34
1 files changed, 28 insertions, 6 deletions
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index 84cd32e8..8290b5d9 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -54,6 +54,8 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id";
- (void)_killProcessQueryWithId:(long long)processId;
- (void)_killProcessConnectionWithId:(long long)processId;
- (void)_updateServerProcessesFilterForFilterString:(NSString *)filterString;
+- (void)_addPreferenceObservers;
+- (void)_removePreferenceObservers;
@end
@@ -111,9 +113,8 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id";
if (columnWidth) [column setWidth:[columnWidth floatValue]];
}
-
- // Register as an observer for the when the UseMonospacedFonts preference changes
- [prefs addObserver:self forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
+
+ [self _addPreferenceObservers];
}
/**
@@ -760,14 +761,35 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id";
[saveProcessesButton setTitle:NSLocalizedString(@"Save View As...", @"save view as button title")];
}
+/**
+ * Add any necessary preference observers to allow live updating on changes.
+ */
+- (void)_addPreferenceObservers
+{
+ // Register as an observer for the when the UseMonospacedFonts preference changes
+ [prefs addObserver:self forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
+
+ // Register to obeserve table view vertical grid line pref changes
+ [prefs addObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL];
+}
+
+/**
+ * Remove any previously added preference observers.
+ */
+- (void)_removePreferenceObservers
+{
+ [prefs removeObserver:self forKeyPath:SPUseMonospacedFonts];
+ [prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines];
+}
+
#pragma mark -
- (void)dealloc
{
- [prefs removeObserver:self forKeyPath:SPUseMonospacedFonts];
-
processListThreadRunning = NO;
-
+
+ [self _removePreferenceObservers];
+
SPClear(processes);
if (autoRefreshTimer) SPClear(autoRefreshTimer);