diff options
author | ritsuka <[email protected]> | 2014-08-02 16:14:16 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-08-02 16:14:16 +0000 |
commit | e51d2ad08ee494c46ef1d97260437f9462f69ee2 (patch) | |
tree | d306dc2f9fefa1e76aa625d5426ceedf50a72c7c /macosx/HBSubtitlesDefaultsController.m | |
parent | 969fe98fc90991e61f74720221f53bd746fbd5d4 (diff) |
MacGui: add drag & drop to rearrange languages in the subtitles default panel.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6258 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBSubtitlesDefaultsController.m')
-rw-r--r-- | macosx/HBSubtitlesDefaultsController.m | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/macosx/HBSubtitlesDefaultsController.m b/macosx/HBSubtitlesDefaultsController.m index f529798d4..ead542080 100644 --- a/macosx/HBSubtitlesDefaultsController.m +++ b/macosx/HBSubtitlesDefaultsController.m @@ -8,6 +8,8 @@ #import "HBSubtitlesSettings.h" #import "HBLanguagesSelection.h" +static void *HBSubtitlesDefaultsContex = &HBSubtitlesDefaultsContex; + @interface HBSubtitlesDefaultsController () @property (nonatomic, readonly) HBSubtitlesSettings *settings; @@ -33,10 +35,25 @@ - (void)windowDidLoad { + [self addObserver:self forKeyPath:@"tableController.showSelectedOnly" options:0 context:HBSubtitlesDefaultsContex]; + if (self.settings.trackSelectionLanguages.count) { self.tableController.showSelectedOnly = YES; - [self.showAllButton setState:NSOffState]; + } +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if (context == HBSubtitlesDefaultsContex) { + if ([keyPath isEqualToString:@"tableController.showSelectedOnly"]) + { + [self.showAllButton setState:!self.tableController.showSelectedOnly]; + } + } + else + { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } @@ -61,8 +78,13 @@ - (void)dealloc { - [super dealloc]; [_settings release]; + + @try { + [self removeObserver:self forKeyPath:@"tableController.showSelectedOnly"]; + } @catch (NSException * __unused exception) {} + + [super dealloc]; } @end |