Add a NSUserDefaultsDidChangeNotification listener to PBGitHistoryController.

Add method decl signatures for updateKeys and scrollSelectionToTopOfViewFrom:

- Call preferencesChangedWithNotification: on self when the notification is
received. This gives us the opportunity to refresh the history controller's
commit list in case defaults like the relative dates option have changed.
This makes the effect of switching that option while the prefs panel is still
open instant.
This commit is contained in:
André Berg
2010-04-05 21:27:45 +02:00
parent 4ed7911c6f
commit f704c99fa8
2 changed files with 12 additions and 0 deletions
+2
View File
@@ -76,9 +76,11 @@
- (IBAction) openSelectedFile:(id)sender;
- (BOOL) selectCommit: (NSString*) commit;
- (void) updateKeys;
- (void) updateQuicklookForce: (BOOL) force;
- (void) scrollSelectionToTopOfViewFrom:(NSInteger)oldIndex;
// Moved over Sidebar methods
- (IBAction) fetchPullPushAction:(id)sender;
+10
View File
@@ -82,6 +82,12 @@
[repository addObserver:self forKeyPath:@"currentBranch" options:0 context:@"branchChange"];
[repository addObserver:self forKeyPath:@"refs" options:0 context:@"updateRefs"];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(preferencesChangedWithNotification:)
name:NSUserDefaultsDidChangeNotification
object:nil];
forceSelectionUpdate = YES;
NSSize cellSpacing = [commitList intercellSpacing];
cellSpacing.height = 0;
@@ -183,6 +189,10 @@
self.status = [NSString stringWithFormat:@"%d commits loaded", [[commitController arrangedObjects] count]];
}
- (void) preferencesChangedWithNotification:(NSNotification *)notification {
[[[repository windowForSheet] contentView] setNeedsDisplay:YES];
}
- (void) restoreFileBrowserSelection
{
if (self.selectedCommitDetailsIndex != kHistoryTreeViewIndex)