Add support for extra links, copyright and license

This commit is contained in:
Ira Limitanei 2026-01-16 12:34:04 +09:00
parent 9cb8ca266d
commit e6ccd23298
Signed by: lambdaclan
GPG Key ID: 43D6A575B03B80E4

View File

@ -8,6 +8,9 @@
import CAdw
import Foundation
/// URL links for about dialog.
public typealias AboutLink = (title: String, url: String)
/// Initialization options for the about dialog wrapper.
public struct AdwaitaAboutDialogConfig {
@ -78,6 +81,12 @@ public struct AdwaitaAboutDialogConfig {
public var website: URL?
/// The link for opening issues.
public var issues: URL?
/// Additional links related to the app.
public var links: [AboutLink]?
/// The app's copyright information.
public var copyright: String?
/// The app's license.
public var license: String?
/// The app's release notes
public var releaseNotes: String?
/// The comments about the application
@ -91,6 +100,9 @@ public struct AdwaitaAboutDialogConfig {
/// - icon: The app icon.
/// - website: The app's website.
/// - issues: Website for reporting issues.
/// - links: Additional links related to the app.
/// - copyright: The app's copyright information.
/// - license: The app's license.
/// - releaseNotes: The app's release notes.
/// - comments: The comments about the application.
public init(
@ -100,6 +112,9 @@ public struct AdwaitaAboutDialogConfig {
icon: Icon? = nil,
website: URL? = nil,
issues: URL? = nil,
links: [AboutLink]? = nil,
copyright: String? = nil,
license: String? = nil,
releaseNotes: String? = nil,
comments: String? = nil
) {
@ -109,6 +124,9 @@ public struct AdwaitaAboutDialogConfig {
self.icon = icon
self.website = website
self.issues = issues
self.links = links
self.copyright = copyright
self.license = license
self.releaseNotes = releaseNotes
self.comments = comments
}
@ -124,6 +142,8 @@ 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),
(copyright, adw_about_dialog_set_copyright),
(license, adw_about_dialog_set_license),
(releaseNotes, adw_about_dialog_set_release_notes),
(comments, adw_about_dialog_set_comments)
]
@ -131,6 +151,8 @@ public struct AdwaitaAboutDialogConfig {
for (value, action) in handlers {
value.map { action(dialog, $0) }
}
links?.forEach { (title: String, url: String) in adw_about_dialog_add_link(dialog, title, url) }
}
}