summaryrefslogtreecommitdiffstats
path: root/macosx/Controller.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-08-25 09:19:31 +0000
committerritsuka <[email protected]>2014-08-25 09:19:31 +0000
commitc89e0d23ed80fda4fc9985582046664d5991c34c (patch)
tree62898df02c635061e5a9ee0a791077ea80559647 /macosx/Controller.m
parent0ffa5fc5e8f98e470f106759600a85cb6fb8d480 (diff)
MacGui: toggle the Advanced tab when the prefs setting changes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6355 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/Controller.m')
-rw-r--r--macosx/Controller.m33
1 files changed, 33 insertions, 0 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index be9e3ca31..f75d50b86 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -671,14 +671,47 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
fVideoController.fHBController = self;
[fVideoTab setView:[fVideoController view]];
+ [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
+ forKeyPath:@"values.HBShowAdvancedTab"
+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+ context:NULL];
+
[fWindow recalculateKeyViewLoop];
// Presets initialization
[self checkBuiltInsForUpdates];
[self buildPresetsMenu];
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(buildPresetsMenu) name:HBPresetsChangedNotification object:nil];
}
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ if (context == NULL)
+ {
+ if ([keyPath isEqualToString:@"values.HBShowAdvancedTab"])
+ {
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBShowAdvancedTab"])
+ {
+ if (![[fMainTabView tabViewItems] containsObject:fAdvancedTab])
+ {
+ [fMainTabView insertTabViewItem:fAdvancedTab atIndex:3];
+ [fAdvancedTab release];
+ }
+ }
+ else
+ {
+ [fAdvancedTab retain];
+ [fMainTabView removeTabViewItem:fAdvancedTab];
+ }
+ }
+ }
+ else
+ {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ }
+}
+
- (void) enableUI: (BOOL) b
{
NSControl * controls[] =