forked from aparoksha/adwaita-swift
Add support URL field and use URL for AboutLink
This commit is contained in:
parent
aababde03f
commit
5c37730483
@ -9,7 +9,7 @@ import CAdw
|
||||
import Foundation
|
||||
|
||||
/// URL links for about dialog.
|
||||
public typealias AboutLink = (title: String, url: String)
|
||||
public typealias AboutLink = (title: String, url: URL?)
|
||||
|
||||
/// Initialization options for the about dialog wrapper.
|
||||
public struct AdwaitaAboutDialogConfig {
|
||||
@ -81,6 +81,8 @@ public struct AdwaitaAboutDialogConfig {
|
||||
public var website: URL?
|
||||
/// The link for opening issues.
|
||||
public var issues: URL?
|
||||
/// The link for getting support.
|
||||
public var support: URL?
|
||||
/// Additional links related to the app.
|
||||
public var links: [AboutLink]?
|
||||
/// The app's copyright information.
|
||||
@ -100,6 +102,7 @@ public struct AdwaitaAboutDialogConfig {
|
||||
/// - icon: The app icon.
|
||||
/// - website: The app's website.
|
||||
/// - issues: Website for reporting issues.
|
||||
/// - support: Website for getting support.
|
||||
/// - links: Additional links related to the app.
|
||||
/// - copyright: The app's copyright information.
|
||||
/// - license: The app's license.
|
||||
@ -112,6 +115,7 @@ public struct AdwaitaAboutDialogConfig {
|
||||
icon: Icon? = nil,
|
||||
website: URL? = nil,
|
||||
issues: URL? = nil,
|
||||
support: URL? = nil,
|
||||
links: [AboutLink]? = nil,
|
||||
copyright: String? = nil,
|
||||
license: String? = nil,
|
||||
@ -124,6 +128,7 @@ public struct AdwaitaAboutDialogConfig {
|
||||
self.icon = icon
|
||||
self.website = website
|
||||
self.issues = issues
|
||||
self.support = support
|
||||
self.links = links
|
||||
self.copyright = copyright
|
||||
self.license = license
|
||||
@ -142,6 +147,7 @@ public struct AdwaitaAboutDialogConfig {
|
||||
(icon?.string, adw_about_dialog_set_application_icon),
|
||||
(website?.absoluteString, adw_about_dialog_set_website),
|
||||
(issues?.absoluteString, adw_about_dialog_set_issue_url),
|
||||
(support?.absoluteString, adw_about_dialog_set_support_url),
|
||||
(copyright, adw_about_dialog_set_copyright),
|
||||
(license, adw_about_dialog_set_license),
|
||||
(releaseNotes, adw_about_dialog_set_release_notes),
|
||||
@ -152,7 +158,7 @@ public struct AdwaitaAboutDialogConfig {
|
||||
value.map { action(dialog, $0) }
|
||||
}
|
||||
|
||||
links?.forEach { (title: String, url: String) in adw_about_dialog_add_link(dialog, title, url) }
|
||||
links?.forEach { (title: String, url: URL?) in adw_about_dialog_add_link(dialog, title, url?.absoluteString) }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -155,11 +155,12 @@ struct Demo: App {
|
||||
cfg.developer = "david-swift"
|
||||
cfg.version = "Test"
|
||||
cfg.icon = .default(icon: .applicationXExecutable)
|
||||
cfg.website = URL(string: "https://adwaita-swift.aparoksha.dev/")
|
||||
cfg.website = URL(string: "https://adwaita-swift.aparoksha.dev/tutorials/table-of-contents")
|
||||
cfg.issues = URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift/issues")
|
||||
cfg.support = URL(string: "https://adwaita-swift.aparoksha.dev/")
|
||||
cfg.links = [
|
||||
("Source Code", "https://git.aparoksha.dev/aparoksha/adwaita-swift"),
|
||||
(title: "Donate", url: "https://ko-fi.com/david_swift")
|
||||
("Source Code", URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift")),
|
||||
(title: "Donate", url: URL(string: "https://ko-fi.com/david_swift"))
|
||||
]
|
||||
cfg.copyright = "© 2026 david-swift"
|
||||
cfg.license = "MIT"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user