mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 07:34:09 +01:00
Get the app delegate the old-fashioned way.
This commit is contained in:
parent
512aee6ce8
commit
e990b7aab1
@ -578,6 +578,7 @@ extension MainWindowController: NSWindowDelegate {
|
||||
|
||||
func windowWillClose(_ notification: Notification) {
|
||||
detailViewController?.stopMediaPlayback()
|
||||
let appDelegate = NSApp.delegate as! AppDelegate
|
||||
appDelegate.removeMainWindow(self)
|
||||
}
|
||||
|
||||
@ -1248,7 +1249,8 @@ private extension MainWindowController {
|
||||
}
|
||||
|
||||
guard let selectedObjects = selectedObjectsInSidebar(), selectedObjects.count > 0 else {
|
||||
window?.title = appDelegate.appName!
|
||||
window?.title = AppConfig.appName
|
||||
let appDelegate = NSApp.delegate as! AppDelegate
|
||||
setSubtitle(appDelegate.unreadCount)
|
||||
return
|
||||
}
|
||||
|
@ -467,6 +467,8 @@ private extension SidebarOutlineDataSource {
|
||||
return false
|
||||
}
|
||||
|
||||
let appDelegate = NSApp.delegate as! AppDelegate
|
||||
|
||||
// Show the add-feed sheet.
|
||||
if let account = parentNode.representedObject as? Account {
|
||||
appDelegate.addFeed(draggedFeed.url, name: draggedFeed.editedName ?? draggedFeed.name, account: account, folder: nil)
|
||||
|
@ -25,11 +25,15 @@ extension NSApplication : ScriptingObjectContainer {
|
||||
var scriptingKey: String {
|
||||
return "application"
|
||||
}
|
||||
|
||||
|
||||
private var scriptingAppDelegate: ScriptingAppDelegate {
|
||||
NSApp.delegate as! ScriptingAppDelegate
|
||||
}
|
||||
|
||||
@objc(currentArticle)
|
||||
func currentArticle() -> ScriptableArticle? {
|
||||
var scriptableArticle: ScriptableArticle?
|
||||
if let currentArticle = appDelegate.scriptingCurrentArticle {
|
||||
if let currentArticle = scriptingAppDelegate.scriptingCurrentArticle {
|
||||
if let feed = currentArticle.feed {
|
||||
let scriptableFeed = ScriptableFeed(feed, container:self)
|
||||
scriptableArticle = ScriptableArticle(currentArticle, container:scriptableFeed)
|
||||
@ -40,7 +44,7 @@ extension NSApplication : ScriptingObjectContainer {
|
||||
|
||||
@objc(selectedArticles)
|
||||
func selectedArticles() -> NSArray {
|
||||
let articles = appDelegate.scriptingSelectedArticles
|
||||
let articles = scriptingAppDelegate.scriptingSelectedArticles
|
||||
let scriptableArticles:[ScriptableArticle] = articles.compactMap { article in
|
||||
if let feed = article.feed {
|
||||
let scriptableFeed = ScriptableFeed(feed, container:self)
|
||||
|
Loading…
Reference in New Issue
Block a user