forked from aparoksha/adwaita-swift
Compare commits
2 Commits
9cb8ca266d
...
aababde03f
| Author | SHA1 | Date | |
|---|---|---|---|
| aababde03f | |||
| e6ccd23298 |
@ -8,6 +8,9 @@
|
|||||||
import CAdw
|
import CAdw
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
/// URL links for about dialog.
|
||||||
|
public typealias AboutLink = (title: String, url: String)
|
||||||
|
|
||||||
/// Initialization options for the about dialog wrapper.
|
/// Initialization options for the about dialog wrapper.
|
||||||
public struct AdwaitaAboutDialogConfig {
|
public struct AdwaitaAboutDialogConfig {
|
||||||
|
|
||||||
@ -78,6 +81,12 @@ public struct AdwaitaAboutDialogConfig {
|
|||||||
public var website: URL?
|
public var website: URL?
|
||||||
/// The link for opening issues.
|
/// The link for opening issues.
|
||||||
public var issues: URL?
|
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
|
/// The app's release notes
|
||||||
public var releaseNotes: String?
|
public var releaseNotes: String?
|
||||||
/// The comments about the application
|
/// The comments about the application
|
||||||
@ -91,6 +100,9 @@ public struct AdwaitaAboutDialogConfig {
|
|||||||
/// - icon: The app icon.
|
/// - icon: The app icon.
|
||||||
/// - website: The app's website.
|
/// - website: The app's website.
|
||||||
/// - issues: Website for reporting issues.
|
/// - 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.
|
/// - releaseNotes: The app's release notes.
|
||||||
/// - comments: The comments about the application.
|
/// - comments: The comments about the application.
|
||||||
public init(
|
public init(
|
||||||
@ -100,6 +112,9 @@ public struct AdwaitaAboutDialogConfig {
|
|||||||
icon: Icon? = nil,
|
icon: Icon? = nil,
|
||||||
website: URL? = nil,
|
website: URL? = nil,
|
||||||
issues: URL? = nil,
|
issues: URL? = nil,
|
||||||
|
links: [AboutLink]? = nil,
|
||||||
|
copyright: String? = nil,
|
||||||
|
license: String? = nil,
|
||||||
releaseNotes: String? = nil,
|
releaseNotes: String? = nil,
|
||||||
comments: String? = nil
|
comments: String? = nil
|
||||||
) {
|
) {
|
||||||
@ -109,6 +124,9 @@ public struct AdwaitaAboutDialogConfig {
|
|||||||
self.icon = icon
|
self.icon = icon
|
||||||
self.website = website
|
self.website = website
|
||||||
self.issues = issues
|
self.issues = issues
|
||||||
|
self.links = links
|
||||||
|
self.copyright = copyright
|
||||||
|
self.license = license
|
||||||
self.releaseNotes = releaseNotes
|
self.releaseNotes = releaseNotes
|
||||||
self.comments = comments
|
self.comments = comments
|
||||||
}
|
}
|
||||||
@ -124,6 +142,8 @@ public struct AdwaitaAboutDialogConfig {
|
|||||||
(icon?.string, adw_about_dialog_set_application_icon),
|
(icon?.string, adw_about_dialog_set_application_icon),
|
||||||
(website?.absoluteString, adw_about_dialog_set_website),
|
(website?.absoluteString, adw_about_dialog_set_website),
|
||||||
(issues?.absoluteString, adw_about_dialog_set_issue_url),
|
(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),
|
(releaseNotes, adw_about_dialog_set_release_notes),
|
||||||
(comments, adw_about_dialog_set_comments)
|
(comments, adw_about_dialog_set_comments)
|
||||||
]
|
]
|
||||||
@ -131,6 +151,8 @@ public struct AdwaitaAboutDialogConfig {
|
|||||||
for (value, action) in handlers {
|
for (value, action) in handlers {
|
||||||
value.map { action(dialog, $0) }
|
value.map { action(dialog, $0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
links?.forEach { (title: String, url: String) in adw_about_dialog_add_link(dialog, title, url) }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,6 +157,12 @@ struct Demo: App {
|
|||||||
cfg.icon = .default(icon: .applicationXExecutable)
|
cfg.icon = .default(icon: .applicationXExecutable)
|
||||||
cfg.website = URL(string: "https://adwaita-swift.aparoksha.dev/")
|
cfg.website = URL(string: "https://adwaita-swift.aparoksha.dev/")
|
||||||
cfg.issues = URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift/issues")
|
cfg.issues = URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift/issues")
|
||||||
|
cfg.links = [
|
||||||
|
("Source Code", "https://git.aparoksha.dev/aparoksha/adwaita-swift"),
|
||||||
|
(title: "Donate", url: "https://ko-fi.com/david_swift")
|
||||||
|
]
|
||||||
|
cfg.copyright = "© 2026 david-swift"
|
||||||
|
cfg.license = "MIT"
|
||||||
cfg.releaseNotes = AdwaitaAboutDialogConfig.demoReleaseNotes
|
cfg.releaseNotes = AdwaitaAboutDialogConfig.demoReleaseNotes
|
||||||
cfg.comments = AdwaitaAboutDialogConfig.demoComments
|
cfg.comments = AdwaitaAboutDialogConfig.demoComments
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user