From cd4ee1b9932c3abe22be6e956aedab5e87f44ab6 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Mon, 22 Dec 2008 20:47:36 +0100 Subject: [PATCH] Update views when switching --- PBGitCommitController.m | 5 +++++ PBGitHistoryController.m | 5 +++++ PBGitWindowController.m | 5 +++++ PBViewController.h | 1 + PBViewController.m | 6 ++++++ 5 files changed, 22 insertions(+) diff --git a/PBGitCommitController.m b/PBGitCommitController.m index 8e01c75..deb31e1 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -112,6 +112,11 @@ self.files = files; } +- (void) updateView +{ + [self refresh:nil]; +} + - (void) doneProcessingIndex { if (!--self.busy) diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index 05b8b07..69a79f7 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -173,6 +173,11 @@ [repository.revisionList reload]; } +- (void) updateView +{ + [self refresh:nil]; +} + - (void) selectCommit: (NSString*) commit { NSPredicate* selection = [NSPredicate predicateWithFormat:@"realSha == %@", commit]; diff --git a/PBGitWindowController.m b/PBGitWindowController.m index bb7c125..8314feb 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -60,11 +60,16 @@ case 0: // swap in the "CustomImageViewController - NSImageView" if (!historyViewController) historyViewController = [[PBGitHistoryController alloc] initWithRepository:repository superController:self]; + else + [historyViewController updateView]; viewController = historyViewController; break; case 1: if (!commitViewController) commitViewController = [[PBGitCommitController alloc] initWithRepository:repository superController:self]; + else + [commitViewController updateView]; + viewController = commitViewController; break; } diff --git a/PBViewController.h b/PBViewController.h index 6996ad6..c3c5901 100644 --- a/PBViewController.h +++ b/PBViewController.h @@ -22,4 +22,5 @@ - (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller; - (void) removeView; +- (void) updateView; @end diff --git a/PBViewController.m b/PBViewController.m index 823fd39..6cc20a6 100644 --- a/PBViewController.m +++ b/PBViewController.m @@ -34,4 +34,10 @@ - (void) awakeFromNib { } + +// This is called when the view is displayed again; it +// should be updated to show the most recent information +- (void) updateView +{ +} @end