Make progress on the Feed Directory window.

This commit is contained in:
Brent Simmons 2018-02-11 16:20:46 -08:00
parent 3262a7a8fc
commit 263fc50c38
7 changed files with 122 additions and 90 deletions

View File

@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
8403E75B201C4A79007F7246 /* FeedListKeyboardDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8403E75A201C4A79007F7246 /* FeedListKeyboardDelegate.swift */; };
840D617F2029031C009BC708 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840D617E2029031C009BC708 /* AppDelegate.swift */; };
840D61812029031C009BC708 /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840D61802029031C009BC708 /* MasterViewController.swift */; };
840D61832029031C009BC708 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840D61822029031C009BC708 /* DetailViewController.swift */; };
@ -36,7 +35,6 @@
844B5B651FEA11F200C7C76A /* GlobalKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 844B5B641FEA11F200C7C76A /* GlobalKeyboardShortcuts.plist */; };
844B5B671FEA18E300C7C76A /* MainWIndowKeyboardHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844B5B661FEA18E300C7C76A /* MainWIndowKeyboardHandler.swift */; };
844B5B691FEA20DF00C7C76A /* SidebarKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 844B5B681FEA20DF00C7C76A /* SidebarKeyboardShortcuts.plist */; };
84513F901FAA63950023A1A9 /* FeedListControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */; };
845213231FCA5B11003B6E93 /* ImageDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845213221FCA5B10003B6E93 /* ImageDownloader.swift */; };
845479881FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 845479871FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist */; };
845A29091FC74B8E007B49E3 /* SingleFaviconDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845A29081FC74B8E007B49E3 /* SingleFaviconDownloader.swift */; };
@ -128,7 +126,6 @@
84BBB12D20142A4700F054F5 /* Inspector.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84BBB12B20142A4700F054F5 /* Inspector.storyboard */; };
84BBB12E20142A4700F054F5 /* InspectorWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BBB12C20142A4700F054F5 /* InspectorWindowController.swift */; };
84C12A151FF5B0080009A267 /* FeedList.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84C12A141FF5B0080009A267 /* FeedList.storyboard */; };
84CC08061FF5D2E000C0C0ED /* FeedListSplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CC08051FF5D2E000C0C0ED /* FeedListSplitViewController.swift */; };
84CC88181FE59CBF00644329 /* SmartFeedsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CC88171FE59CBF00644329 /* SmartFeedsController.swift */; };
84D52E951FE588BB00D14F5B /* DetailStatusBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D52E941FE588BB00D14F5B /* DetailStatusBarView.swift */; };
84D5BA20201E8FB6009092BD /* SidebarGearMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D5BA1F201E8FB6009092BD /* SidebarGearMenuDelegate.swift */; };
@ -1022,14 +1019,12 @@
children = (
84C12A141FF5B0080009A267 /* FeedList.storyboard */,
849A978C1ED9EE4D007D329B /* FeedListWindowController.swift */,
84CC08051FF5D2E000C0C0ED /* FeedListSplitViewController.swift */,
84F204CD1FAACB660076E152 /* FeedListViewController.swift */,
8403E75A201C4A79007F7246 /* FeedListKeyboardDelegate.swift */,
84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */,
84B99C661FAE35E600ECDEDB /* FeedListTreeControllerDelegate.swift */,
84B99C681FAE36B800ECDEDB /* FeedListFolder.swift */,
84B99C6A1FAE370B00ECDEDB /* FeedListFeed.swift */,
84E95CF61FABB3C800552D99 /* FeedList.plist */,
84DC413A20310AEE00198AD4 /* UnusedIn1.0 */,
);
name = "Feed List";
path = Evergreen/FeedList;
@ -1267,6 +1262,16 @@
path = Importers;
sourceTree = "<group>";
};
84DC413A20310AEE00198AD4 /* UnusedIn1.0 */ = {
isa = PBXGroup;
children = (
84CC08051FF5D2E000C0C0ED /* FeedListSplitViewController.swift */,
8403E75A201C4A79007F7246 /* FeedListKeyboardDelegate.swift */,
84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */,
);
path = UnusedIn1.0;
sourceTree = "<group>";
};
84EB380F1FBA8B9F000D2111 /* KeyboardShortcuts */ = {
isa = PBXGroup;
children = (
@ -1870,7 +1875,6 @@
files = (
84F204E01FAACBB30076E152 /* ArticleArray.swift in Sources */,
849C64641ED37A5D003D8FC0 /* AppDelegate.swift in Sources */,
84513F901FAA63950023A1A9 /* FeedListControlsView.swift in Sources */,
84BBB12E20142A4700F054F5 /* InspectorWindowController.swift in Sources */,
84E46C7D1F75EF7B005ECFB3 /* AppDefaults.swift in Sources */,
D5907D972004B7EB005947E5 /* Account+Scriptability.swift in Sources */,
@ -1894,7 +1898,6 @@
D5A2678C20130ECF00A8D3C0 /* Author+Scriptability.swift in Sources */,
84F2D5371FC22FCC00998D64 /* PseudoFeed.swift in Sources */,
D553738B20186C20006D8857 /* Article+Scriptability.swift in Sources */,
8403E75B201C4A79007F7246 /* FeedListKeyboardDelegate.swift in Sources */,
845EE7C11FC2488C00854A1F /* SmartFeed.swift in Sources */,
84702AA41FA27AC0006B8943 /* MarkStatusCommand.swift in Sources */,
D5907D7F2004AC00005947E5 /* NSApplication+Scriptability.swift in Sources */,
@ -1945,7 +1948,6 @@
842611A01FCB72600086A189 /* FeaturedImageDownloader.swift in Sources */,
849A97781ED9EC04007D329B /* TimelineCellLayout.swift in Sources */,
84E8E0EB202F693600562D8F /* DetailWebView.swift in Sources */,
84CC08061FF5D2E000C0C0ED /* FeedListSplitViewController.swift in Sources */,
849A976C1ED9EBC8007D329B /* TimelineTableRowView.swift in Sources */,
849A977B1ED9EC04007D329B /* UnreadIndicatorView.swift in Sources */,
84B99C9D1FAE83C600ECDEDB /* DeleteFromSidebarCommand.swift in Sources */,

View File

@ -22,92 +22,35 @@
</connections>
</window>
<connections>
<segue destination="ju5-jM-WKk" kind="relationship" relationship="window.shadowedContentViewController" id="vHc-9b-sEw"/>
<segue destination="QX3-Wg-cdZ" kind="relationship" relationship="window.shadowedContentViewController" id="LR5-Ry-Pi6"/>
</connections>
</windowController>
<customObject id="l74-pi-xxL" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-828" y="-22"/>
</scene>
<!--View Controller-->
<scene sceneID="b5P-LI-56y">
<objects>
<viewController id="ju5-jM-WKk" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="46a-ok-dQm">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<containerView translatesAutoresizingMaskIntoConstraints="NO" id="YFk-Bu-Nnc">
<rect key="frame" x="0.0" y="32" width="480" height="238"/>
<connections>
<segue destination="QX3-Wg-cdZ" kind="embed" id="a16-zz-S3j"/>
</connections>
</containerView>
<customView horizontalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="xKq-9P-ibo" customClass="FeedListControlsView" customModule="Evergreen" customModuleProvider="target">
<rect key="frame" x="96" y="0.0" width="288" height="32"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bv8-Eq-0cT">
<rect key="frame" x="20" y="3" width="120" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Add to Feeds" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0gj-Cw-KCE">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ohy-a3-XkT">
<rect key="frame" x="148" y="3" width="120" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Open Home Page" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="hom-If-fbd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
<constraints>
<constraint firstItem="Ohy-a3-XkT" firstAttribute="width" secondItem="Bv8-Eq-0cT" secondAttribute="width" id="1Kl-sg-GHU"/>
<constraint firstItem="Ohy-a3-XkT" firstAttribute="leading" secondItem="Bv8-Eq-0cT" secondAttribute="trailing" constant="8" symbolic="YES" id="5Og-09-12P"/>
<constraint firstItem="Ohy-a3-XkT" firstAttribute="centerY" secondItem="xKq-9P-ibo" secondAttribute="centerY" id="7Yu-Ab-dfe"/>
<constraint firstAttribute="trailing" secondItem="Ohy-a3-XkT" secondAttribute="trailing" constant="20" symbolic="YES" id="ACJ-M3-QR1"/>
<constraint firstItem="Bv8-Eq-0cT" firstAttribute="leading" secondItem="xKq-9P-ibo" secondAttribute="leading" constant="20" symbolic="YES" id="Iph-MK-E6k"/>
<constraint firstAttribute="height" constant="32" id="dH4-pR-OmT"/>
<constraint firstItem="Bv8-Eq-0cT" firstAttribute="centerY" secondItem="xKq-9P-ibo" secondAttribute="centerY" id="qgr-sL-IFQ"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="YFk-Bu-Nnc" firstAttribute="top" secondItem="46a-ok-dQm" secondAttribute="top" id="71x-bl-RZk"/>
<constraint firstItem="YFk-Bu-Nnc" firstAttribute="leading" secondItem="46a-ok-dQm" secondAttribute="leading" id="7lT-YG-EN5"/>
<constraint firstItem="xKq-9P-ibo" firstAttribute="centerX" secondItem="46a-ok-dQm" secondAttribute="centerX" id="DcC-JO-Mfg"/>
<constraint firstAttribute="trailing" secondItem="YFk-Bu-Nnc" secondAttribute="trailing" id="LZY-8D-poG"/>
<constraint firstAttribute="bottom" secondItem="xKq-9P-ibo" secondAttribute="bottom" id="uIU-wj-1Wk"/>
<constraint firstItem="xKq-9P-ibo" firstAttribute="top" secondItem="YFk-Bu-Nnc" secondAttribute="bottom" id="yB2-aB-byH"/>
</constraints>
</view>
</viewController>
<customObject id="ANr-fb-gv3" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1169" y="566"/>
<point key="canvasLocation" x="-1275" y="-36"/>
</scene>
<!--Feed List View Controller-->
<scene sceneID="TKm-CD-zMs">
<objects>
<viewController id="QX3-Wg-cdZ" customClass="FeedListViewController" customModule="Evergreen" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="vp3-VV-Mzw">
<rect key="frame" x="0.0" y="0.0" width="285" height="300"/>
<view key="view" wantsLayer="YES" id="vp3-VV-Mzw">
<rect key="frame" x="0.0" y="0.0" width="288" height="300"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rir-se-YCO">
<rect key="frame" x="0.0" y="0.0" width="285" height="300"/>
<rect key="frame" x="0.0" y="32" width="288" height="268"/>
<clipView key="contentView" drawsBackground="NO" id="vli-sv-HLg">
<rect key="frame" x="0.0" y="0.0" width="285" height="300"/>
<rect key="frame" x="0.0" y="0.0" width="288" height="268"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="medium" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="23" outlineTableColumn="Ytm-dS-0WJ" id="Hxu-8i-6rp">
<rect key="frame" x="0.0" y="0.0" width="285" height="300"/>
<rect key="frame" x="0.0" y="0.0" width="288" height="268"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="" width="282" minWidth="16" maxWidth="1000" id="Ytm-dS-0WJ">
<tableColumn identifier="" width="285" minWidth="16" maxWidth="1000" id="Ytm-dS-0WJ">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@ -121,11 +64,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="HeaderCell" id="Do1-0K-GCV">
<rect key="frame" x="1" y="1" width="282" height="17"/>
<rect key="frame" x="1" y="1" width="285" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vm6-1A-a5G">
<rect key="frame" x="0.0" y="1" width="282" height="14"/>
<rect key="frame" x="0.0" y="1" width="285" height="14"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="HEADER CELL" id="eL0-h5-mFm">
<font key="font" metaFont="smallSystemBold"/>
@ -139,7 +82,7 @@
</connections>
</tableCellView>
<tableCellView identifier="FeedListCell" id="M2x-Bb-n1x" customClass="SidebarCell" customModule="Evergreen" customModuleProvider="target">
<rect key="frame" x="1" y="20" width="282" height="17"/>
<rect key="frame" x="1" y="20" width="285" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iAS-DV-SKL">
@ -186,21 +129,54 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<customView horizontalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="xKq-9P-ibo">
<rect key="frame" x="0.0" y="0.0" width="288" height="32"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bv8-Eq-0cT">
<rect key="frame" x="20" y="3" width="120" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Add to Feeds" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="0gj-Cw-KCE">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ohy-a3-XkT">
<rect key="frame" x="148" y="3" width="120" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Open Home Page" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="hom-If-fbd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
<constraints>
<constraint firstItem="Ohy-a3-XkT" firstAttribute="width" secondItem="Bv8-Eq-0cT" secondAttribute="width" id="1Kl-sg-GHU"/>
<constraint firstItem="Ohy-a3-XkT" firstAttribute="leading" secondItem="Bv8-Eq-0cT" secondAttribute="trailing" constant="8" symbolic="YES" id="5Og-09-12P"/>
<constraint firstItem="Ohy-a3-XkT" firstAttribute="centerY" secondItem="xKq-9P-ibo" secondAttribute="centerY" id="7Yu-Ab-dfe"/>
<constraint firstAttribute="trailing" secondItem="Ohy-a3-XkT" secondAttribute="trailing" constant="20" symbolic="YES" id="ACJ-M3-QR1"/>
<constraint firstItem="Bv8-Eq-0cT" firstAttribute="leading" secondItem="xKq-9P-ibo" secondAttribute="leading" constant="20" symbolic="YES" id="Iph-MK-E6k"/>
<constraint firstAttribute="height" constant="32" id="dH4-pR-OmT"/>
<constraint firstItem="Bv8-Eq-0cT" firstAttribute="centerY" secondItem="xKq-9P-ibo" secondAttribute="centerY" id="qgr-sL-IFQ"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="xKq-9P-ibo" secondAttribute="bottom" id="2cb-L2-JEt"/>
<constraint firstAttribute="trailing" secondItem="rir-se-YCO" secondAttribute="trailing" id="7WI-u5-sU6"/>
<constraint firstAttribute="bottom" secondItem="rir-se-YCO" secondAttribute="bottom" id="B0Q-Ma-ojH"/>
<constraint firstAttribute="trailing" secondItem="xKq-9P-ibo" secondAttribute="trailing" id="BBs-yc-DzP"/>
<constraint firstItem="rir-se-YCO" firstAttribute="top" secondItem="vp3-VV-Mzw" secondAttribute="top" id="Koo-lp-EvO"/>
<constraint firstItem="xKq-9P-ibo" firstAttribute="leading" secondItem="vp3-VV-Mzw" secondAttribute="leading" id="VCK-uS-LAK"/>
<constraint firstItem="xKq-9P-ibo" firstAttribute="top" secondItem="rir-se-YCO" secondAttribute="bottom" id="WN7-F2-8Cn"/>
<constraint firstItem="rir-se-YCO" firstAttribute="leading" secondItem="vp3-VV-Mzw" secondAttribute="leading" id="bGY-bf-MdA"/>
</constraints>
</view>
<connections>
<outlet property="addToFeedsButton" destination="Bv8-Eq-0cT" id="ZD6-YN-9oa"/>
<outlet property="openHomePageButton" destination="Ohy-a3-XkT" id="G55-UY-RQ8"/>
<outlet property="outlineView" destination="Hxu-8i-6rp" id="Hm2-on-0JP"/>
</connections>
</viewController>
<customObject id="MKk-xD-0Fh" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-967" y="1488"/>
<point key="canvasLocation" x="-1268" y="547"/>
</scene>
</scenes>
<resources>

View File

@ -23,12 +23,26 @@ struct FeedListUserInfoKey {
final class FeedListViewController: NSViewController {
@IBOutlet var outlineView: NSOutlineView!
@IBOutlet var openHomePageButton: NSButton!
@IBOutlet var addToFeedsButton: NSButton!
private var sidebarCellAppearance: SidebarCellAppearance!
private let treeControllerDelegate = FeedListTreeControllerDelegate()
lazy var treeController: TreeController = {
TreeController(delegate: treeControllerDelegate)
}()
private var selectedNodes: [Node] {
if let nodes = outlineView.selectedItems as? [Node] {
return nodes
}
return [Node]()
}
private var selectedObjects: [AnyObject] {
return selectedNodes.representedObjects()
}
// MARK: NSViewController
override func viewDidLoad() {
@ -38,6 +52,7 @@ final class FeedListViewController: NSViewController {
sidebarCellAppearance = SidebarCellAppearance(theme: appDelegate.currentTheme, fontSize: AppDefaults.shared.sidebarFontSize)
NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
outlineView.needsLayout = true
updateUI()
}
// MARK: - Notifications
@ -48,6 +63,19 @@ final class FeedListViewController: NSViewController {
}
}
// MARK: Actions
extension FeedListViewController {
func openHomePage(_ sender: Any?) {
}
func addToFeeds(_ sender: Any?) {
}
}
// MARK: - NSOutlineViewDataSource
extension FeedListViewController: NSOutlineViewDataSource {
@ -92,6 +120,8 @@ extension FeedListViewController: NSOutlineViewDelegate {
func outlineViewSelectionDidChange(_ notification: Notification) {
updateUI()
let selectedRow = self.outlineView.selectedRow
if selectedRow < 0 || selectedRow == NSNotFound {
@ -176,4 +206,37 @@ private extension FeedListViewController {
NotificationCenter.default.post(name: .FeedListSidebarSelectionDidChange, object: self, userInfo: userInfo)
}
func updateUI() {
updateButtons()
}
func updateButtons() {
let objects = selectedObjects
if objects.isEmpty {
openHomePageButton.isEnabled = false
addToFeedsButton.isEnabled = false
return
}
addToFeedsButton.isEnabled = true
if let _ = singleSelectedHomePageURL() {
openHomePageButton.isEnabled = true
}
else {
openHomePageButton.isEnabled = false
}
}
func singleSelectedHomePageURL() -> String? {
guard selectedObjects.count == 1, let homePageURL = (selectedObjects.first! as? FeedListFeed)?.homePageURL, !homePageURL.isEmpty else {
return nil
}
return homePageURL
}
}

View File

@ -10,19 +10,10 @@ import AppKit
class FeedListWindowController : NSWindowController {
override func windowDidLoad() {
window!.appearance = NSAppearance(named: .vibrantDark)
}
@IBAction func addToFeeds(_ sender: AnyObject) {
}
@IBAction func openHomePage(_ sender: AnyObject) {
}
}

View File

@ -8,8 +8,8 @@
import AppKit
// Unused, at least for now.
@objc final class FeedListControlsView: NSView {
@IBOutlet var addToFeedsButton: NSButton!
@IBOutlet var openHomePageButton: NSButton!
}