<commit_before>//
//  MainWindowController.swift
//  Cloudy
//
//  Created by <NAME> on 4/16/15.
//  Copyright (c) 2015 Shiny Bits. All rights reserved.
//

import Cocoa
import ReactiveCocoa

final class MainWindowController: NSWindowController, NSWindowDelegate {

    // MARK: - Properties

    @IBOutlet var navigationControl: NSSegmentedControl?

    @IBOutlet var shareButton: NSButton?

    @IBOutlet var playbackButton: NSButton?


    // MARK: - NSWindowController

    override func windowDidLoad() {
        super.windowDidLoad()
        window?.titleVisibility = .Hidden

        navigationControl?.rac_liftSelector("setEnabled:forSegment:", withSignalsFromArray: [
            rac_valuesForKeyPath("contentViewController.webView.canGoBack", observer: self),
            RACSignal.`return`(0)
        ])

        navigationControl?.rac_liftSelector("setEnabled:forSegment:", withSignalsFromArray: [
            rac_valuesForKeyPath("contentViewController.webView.canGoForward", observer: self),
            RACSignal.`return`(1)
        ])

        rac_valuesForKeyPath("contentViewController.isEpisodePage", observer: self)
            .setKeyPath("shareButton.enabled", onObject: self)

        rac_valuesForKeyPath("contentViewController.isEpisodePage", observer: self)
            .setKeyPath("playbackButton.enabled", onObject: self)

//        rac_valuesForKeyPath("contentViewController.playing", observer: self)
//            .map({
//                let value = $0 as! Bool
//                return value ? "Pause" : "Play"
//            })
//            .setKeyPath("playbackButton.title", onObject: self)
    }


    // MARK: - NSWindowDelegate

    func windowShouldClose(sender: AnyObject) -> Bool {
        NSApplication.sharedApplication().terminate(self)
        return false
    }
}<commit_msg>Push playback state into toolbar.<commit_after>//
//  MainWindowController.swift
//  Cloudy
//
//  Created by <NAME> on 4/16/15.
//  Copyright (c) 2015 Shiny Bits. All rights reserved.
//

import Cocoa
import ReactiveCocoa

final class MainWindowController: NSWindowController, NSWindowDelegate {

    // MARK: - Properties

    @IBOutlet var navigationControl: NSSegmentedControl?

    @IBOutlet var shareButton: NSButton?

    @IBOutlet var playbackButton: NSButton?


    // MARK: - NSWindowController

    override func windowDidLoad() {
        super.windowDidLoad()
        window?.titleVisibility = .Hidden

        navigationControl?.rac_liftSelector("setEnabled:forSegment:", withSignalsFromArray: [
            rac_valuesForKeyPath("contentViewController.webView.canGoBack", observer: self),
            RACSignal.`return`(0)
        ])

        navigationControl?.rac_liftSelector("setEnabled:forSegment:", withSignalsFromArray: [
            rac_valuesForKeyPath("contentViewController.webView.canGoForward", observer: self),
            RACSignal.`return`(1)
        ])

        rac_valuesForKeyPath("contentViewController.isEpisodePage", observer: self)
            .setKeyPath("shareButton.enabled", onObject: self)

        rac_valuesForKeyPath("contentViewController.isEpisodePage", observer: self)
            .setKeyPath("playbackButton.enabled", onObject: self)

        rac_valuesForKeyPath("contentViewController.isPlaying", observer: self)
            .map({ $0 as! Bool ? "Pause" : "Play" })
            .setKeyPath("playbackButton.title", onObject: self)
    }


    // MARK: - NSWindowDelegate

    func windowShouldClose(sender: AnyObject) -> Bool {
        NSApplication.sharedApplication().terminate(self)
        return false
    }
}
{'fraction_non_alphanumeric': 0.10767085076708507, 'fraction_numerical': 0.0066945606694560665, 'mean_word_length': 2.988876529477197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3289426', 'n_tokens_mistral': 1053, 'n_tokens_neox': 970, 'n_words': 192}