From eb5c1a49f7b04df97b0f173083b264f62366b57f Mon Sep 17 00:00:00 2001 From: Phil Viso Date: Sun, 19 May 2019 09:14:40 -0500 Subject: [PATCH] Disable adding a new folder if there are no active accounts --- Mac/MainWindow/MainWindowController.swift | 8 ++++++++ Mac/MainWindow/Sidebar/SidebarViewController.swift | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index 1a7cf28c7..7cb1edc7a 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -231,6 +231,10 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { if item.action == #selector(showAddFeedWindow(_:)) { return canAddNewFeed() } + + if item.action == #selector(showAddFolderWindow(_:)) { + return canAddNewFolder() + } return true } @@ -599,6 +603,10 @@ private extension MainWindowController { func canAddNewFeed() -> Bool { return sidebarViewController?.canAddNewFeed() ?? false } + + func canAddNewFolder() -> Bool { + return sidebarViewController?.canAddNewFolder() ?? false + } func validateToggleRead(_ item: NSValidatedUserInterfaceItem) -> Bool { diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index 19a66cdcd..3489172df 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -365,6 +365,10 @@ protocol SidebarDelegate: class { return !accountNodes.isEmpty } + func canAddNewFolder() -> Bool { + return !accountNodes.isEmpty + } + } // MARK: - NSUserInterfaceValidations