ui: refresh the About dialog's links and license
CI / test (push) Successful in 48s

Link the trademark policy from the license text, on the word "trademarks",
and make the trademark sentence its own paragraph. Point "Report an issue"
and a new "Source Code (on Nostr)" row at the ngit repository, and add an
"Email" row. Drop the separate Trademark Policy and Nostr rows: the policy
is now inline, and the author credit already links the Nostr profile.
This commit is contained in:
raucao committed 2026-11-30 17:22:23 +04:00
1 parent 30053efac7
commit c4f0ef8c1a
1 file changed
+32 -17
+32 -17
View File
@@ -13,12 +13,21 @@ use libadwaita as adw;
use crate::{APP_ID, VERSION};
/// Where Regent is developed — the project page, the source and the issue
/// tracker at once.
/// Where Regent is developed on Gitea — the project page and the canonical
/// source at once. The issue tracker lives on the Nostr mirror (`ISSUES`).
const REPOSITORY: &str = "https://gitea.kosmos.org/raucao/regent";
/// The trademark policy, a file in the same repository, linked from the details
/// page beside the source.
/// The same repository over Nostr (ngit), where issues are filed and discussed.
const NOSTR_SOURCE: &str = "https://gitworkshop.dev/raucao@kosmos.org/relay.ngit.dev/regent";
/// The issue tracker, as the About dialog's "Report an issue" target.
const ISSUES: &str = "https://gitworkshop.dev/raucao@kosmos.org/relay.ngit.dev/regent/issues";
/// The author's e-mail, linked from the details page.
const EMAIL: &str = "mailto:raucao@kosmos.org";
/// The trademark policy, a file in the same repository, linked inline from the
/// license text in the Legal section.
const TRADEMARK: &str = "https://gitea.kosmos.org/raucao/regent/src/branch/main/TRADEMARK.md";
/// Râu Cao's Nostr profile as a **njump** link: a `nostr:` URI only opens where
@@ -38,16 +47,21 @@ shown to you before it is answered.";
/// `gtk_label_set_markup`, so this is our own markup — the raw `LICENSE` file
/// (it contains `<https://unlicense.org>`) would not parse.
///
/// The second sentence is deliberate: the code is public domain but the name and
/// the logo are not, and the About dialog is where a user looks for exactly that
/// distinction. The policy itself is a details-page link (`TRADEMARK`).
const LICENSE: &str =
"Released into the public domain under the <a href=\"https://unlicense.org\">Unlicense</a>. \
The Regent name and logo are trademarks.";
/// The trademark sentence is a deliberate second paragraph: the code is public
/// domain but the name and the logo are not, and the About dialog is where a
/// user looks for exactly that distinction. It is built at runtime so the policy
/// link (`TRADEMARK`) has a single source.
fn license() -> String {
format!(
"Released into the public domain under the \
<a href=\"https://unlicense.org\">Unlicense</a>.\n\n\
The Regent name and logo are <a href=\"{TRADEMARK}\">trademarks</a>."
)
}
/// Build and present the About dialog inside `parent` — the window the app is.
pub fn present(parent: Option<&impl IsA<gtk::Widget>>) {
let issues = format!("{REPOSITORY}/issues");
let license_text = license();
let dialog = adw::AboutDialog::builder()
.application_name("Regent")
@@ -55,23 +69,24 @@ pub fn present(parent: Option<&impl IsA<gtk::Widget>>) {
.version(VERSION)
.developer_name("Râu Cao")
.comments(COMMENTS)
.issue_url(&issues)
.issue_url(ISSUES)
// `set_license` already implies CUSTOM; the property documents intent.
.license_type(gtk::License::Custom)
.license(LICENSE)
.license(&license_text)
.build();
// "Code by" is libadwaita's hardcoded heading for the `developers` list, so
// the author goes in a custom section titled "Made by" instead. A trailing
// URL makes the entry a `LinkRow` (`AdwAboutDialog` parses "Name https://…"),
// so the name links out to the same njump profile the Nostr row uses.
// so the name links out to Râu Cao's njump profile.
let author = format!("Râu Cao {NOSTR}");
dialog.add_credit_section(Some("Made by"), &[&author]);
// Details-page links.
// Details-page links. The author's Nostr profile is already the "Made by"
// credit's link, so it is not repeated here.
dialog.add_link("Source Code", REPOSITORY);
dialog.add_link("Trademark Policy", TRADEMARK);
dialog.add_link("Nostr", NOSTR);
dialog.add_link("Source Code (on Nostr)", NOSTR_SOURCE);
dialog.add_link("Email", EMAIL);
dialog.present(parent);
}