BathyScapheのデフォルトWebブラウザを変更するプラグイン
リビジョン | fec00a372e1c29657d10fdcbb094edbb957994b0 (tree) |
---|---|
日時 | 2013-02-10 11:42:29 |
作者 | masakih <masakih@user...> |
コミッター | masakih |
[Fix] ブラウザが正しく変更されない問題を修正
@@ -54,6 +54,11 @@ additionalEventParamDescriptor:nil | ||
54 | 54 | toObject:self |
55 | 55 | withKeyPath:@"browserIdentifier" |
56 | 56 | options:nil]; |
57 | + | |
58 | + [self.viewController addObserver:self | |
59 | + forKeyPath:@"appIdentifier" | |
60 | + options:NSKeyValueObservingOptionNew | |
61 | + context:self.viewController]; | |
57 | 62 | } |
58 | 63 | return [self.viewController view]; |
59 | 64 | } |
@@ -61,6 +66,10 @@ additionalEventParamDescriptor:nil | ||
61 | 66 | |
62 | 67 | - (void)setPreference:(id)pref forKey:(id)key |
63 | 68 | { |
69 | + if(!key) { | |
70 | + [[self.defaults imagePreviewerPrefsDict] removeObjectForKey:key]; | |
71 | + return; | |
72 | + } | |
64 | 73 | [[self.defaults imagePreviewerPrefsDict] setObject:pref forKey:key]; |
65 | 74 | } |
66 | 75 | - (id)preferenceForKey:(id)key |
@@ -80,5 +89,16 @@ additionalEventParamDescriptor:nil | ||
80 | 89 | [tmp release]; |
81 | 90 | } |
82 | 91 | |
92 | +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context | |
93 | +{ | |
94 | + if(context == self.viewController) { | |
95 | + if([keyPath isEqualToString:@"appIdentifier"]) { | |
96 | + self.browserIdentifier = [change objectForKey:NSKeyValueChangeNewKey]; | |
97 | + } | |
98 | + return; | |
99 | + } | |
100 | + | |
101 | + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; | |
102 | +} | |
83 | 103 | |
84 | 104 | @end |