From 865ae5f4223697a56acbd71bb46da19a1a8a683a Mon Sep 17 00:00:00 2001 From: Daniel Lundqvist Date: Fri, 26 Dec 2008 21:00:41 +0800 Subject: [PATCH] Have PBWebController react to configuration changes. Override preferencesChanged in subclasses to actually react to changes. Base class does nothing by default. --- PBWebController.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/PBWebController.m b/PBWebController.m index 95319e7..0548b08 100644 --- a/PBWebController.m +++ b/PBWebController.m @@ -13,6 +13,10 @@ #include +@interface PBWebController() +- (void)preferencesChangedWithNotification:(NSNotification *)theNotification; +@end + @implementation PBWebController @synthesize startFile, repository; @@ -24,6 +28,12 @@ NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:file]]; callbacks = [NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsObjectPointerPersonality|NSPointerFunctionsStrongMemory) valueOptions:(NSPointerFunctionsObjectPointerPersonality|NSPointerFunctionsStrongMemory)]; + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc addObserver:self + selector:@selector(preferencesChangedWithNotification:) + name:NSUserDefaultsDidChangeNotification + object:nil]; + finishedLoading = NO; [view setUIDelegate:self]; [view setFrameLoadDelegate:self]; @@ -179,4 +189,13 @@ [self returnCallBackForObject:[notification object] withData:data]; } +- (void) preferencesChanged +{ +} + +- (void)preferencesChangedWithNotification:(NSNotification *)theNotification +{ + [self preferencesChanged]; +} + @end