~not/sonar

0d2349b905096448a574b4cb1596cde517610443 — b123400 1 year, 10 months ago 45a345f
Try to preserve sorting between launch (not really work, probably AppKit bug)
1 files changed, 9 insertions(+), 0 deletions(-)

M Sonar/Player/PlayerWindowController.m
M Sonar/Player/PlayerWindowController.m => Sonar/Player/PlayerWindowController.m +9 -0
@@ 450,6 450,7 @@ typedef enum : NSUInteger {
    [coder encodeBool:self.isRandomMode forKey:@"isRandomMode"];
    [coder encodeObject:@(self.repeatMode) forKey:@"repeatMode"];
    [coder encodeObject:@(self.volume) forKey:@"volume"];
    [coder encodeObject:self.outlineView.sortDescriptors forKey:@"sortDescriptors"];
}

- (void)restoreStateWithCoder:(NSCoder *)coder {


@@ 459,6 460,14 @@ typedef enum : NSUInteger {
    self.viewMode = _viewMode;
    float v = [(NSNumber*)[coder decodeObjectOfClass:[NSNumber class] forKey:@"volume"] floatValue];
    [self setVolume:v];
    if ([coder containsValueForKey:@"sortDescriptors"]) {
        // TODO: Fix this, don't know why this is always nil (but the above condition is true)
        // Maybe have to do with the buggy state restoration on Mac
        NSArray *x = [coder decodeObjectForKey:@"sortDescriptors"];
        if (x != nil) {
            self.outlineView.sortDescriptors = x;
        }
    }
}

#pragma mark - Outline View