From 0d2ff4f5cdcfeda324da86233f5e0362e8166616 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 7 Jan 2023 20:42:36 +0100 Subject: [PATCH 1/2] :wrench: Use Adw.AboutWindow if available --- prefs.js | 89 ++++++++++++++++++++++++++------- resources/credits/sponsors.json | 85 ++++++++++++++++++++++++------- 2 files changed, 139 insertions(+), 35 deletions(-) diff --git a/prefs.js b/prefs.js index 92f12e0..5ab36a1 100644 --- a/prefs.js +++ b/prefs.js @@ -320,26 +320,78 @@ var PreferencesDialog = class PreferencesDialog { }); const sponsors = this._getJSONResource('/credits/sponsors.json'); + let dialog; + + // We try to use the special Adw.AboutWindow if it is available. + if (utils.isADW() && Adw.AboutWindow) { + let formatSponsors = (sponsors) => { + return sponsors.map(s => { + if (s.url == '') + return s.name; + else + return `${s.name} ${s.url}`; + }); + }; + + dialog = new Adw.AboutWindow({transient_for: window, modal: true}); + dialog.set_application_icon('burn-my-windows-symbolic'); + dialog.set_application_name('Burn-My-Windows'); + dialog.set_version(`${Me.metadata.version}`); + dialog.set_developer_name('Simon Schneegans'); + dialog.set_issue_url('https://github.com/Schneegans/Burn-My-Windows/issues'); + if (sponsors.gold.length > 0) { + dialog.add_credit_section(_('Gold Sponsors'), + formatSponsors(sponsors.gold)); + } + if (sponsors.silver.length > 0) { + dialog.add_credit_section(_('Silver Sponsors'), + formatSponsors(sponsors.silver)); + } + if (sponsors.bronze.length > 0) { + dialog.add_credit_section(_('Bronze Sponsors'), + formatSponsors(sponsors.bronze)); + } + if (sponsors.past.length > 0) { + dialog.add_credit_section(_('Past Sponsors'), + formatSponsors(sponsors.past)); + } + + } else { + + let formatSponsors = (sponsors) => { + return sponsors.map(s => { + if (s.url == '') + return s.name; + else + return `${s.name}`; + }); + }; + + dialog = new Gtk.AboutDialog({transient_for: window, modal: true}); + dialog.set_logo_icon_name('burn-my-windows-symbolic'); + dialog.set_program_name(`Burn-My-Windows ${Me.metadata.version}`); + dialog.set_authors(['Simon Schneegans']); + if (sponsors.gold.length > 0) { + dialog.add_credit_section(_('Gold Sponsors'), + formatSponsors(sponsors.gold)); + } + if (sponsors.silver.length > 0) { + dialog.add_credit_section(_('Silver Sponsors'), + formatSponsors(sponsors.silver)); + } + if (sponsors.bronze.length > 0) { + dialog.add_credit_section(_('Bronze Sponsors'), + formatSponsors(sponsors.bronze)); + } + if (sponsors.past.length > 0) { + dialog.add_credit_section(_('Past Sponsors'), + formatSponsors(sponsors.past)); + } + } - const dialog = new Gtk.AboutDialog({transient_for: window, modal: true}); - dialog.set_logo_icon_name('burn-my-windows-symbolic'); - dialog.set_program_name(`Burn-My-Windows ${Me.metadata.version}`); - dialog.set_website('https://github.com/Schneegans/Burn-My-Windows'); - dialog.set_authors(['Simon Schneegans']); - dialog.set_copyright('© 2022 Simon Schneegans'); dialog.set_translator_credits([...translators].join('\n')); - if (sponsors.gold.length > 0) { - dialog.add_credit_section(_('Gold Sponsors'), sponsors.gold); - } - if (sponsors.silver.length > 0) { - dialog.add_credit_section(_('Silver Sponsors'), sponsors.silver); - } - if (sponsors.bronze.length > 0) { - dialog.add_credit_section(_('Bronze Sponsors'), sponsors.bronze); - } - if (sponsors.past.length > 0) { - dialog.add_credit_section(_('Past Sponsors'), sponsors.past); - } + dialog.set_copyright('© 2022 Simon Schneegans'); + dialog.set_website('https://github.com/Schneegans/Burn-My-Windows'); dialog.set_license_type(Gtk.License.GPL_3_0); if (utils.isGTK4()) { @@ -348,6 +400,7 @@ var PreferencesDialog = class PreferencesDialog { dialog.show_all(); } }); + group.add_action(aboutAction); } diff --git a/resources/credits/sponsors.json b/resources/credits/sponsors.json index 75c8916..a30092b 100644 --- a/resources/credits/sponsors.json +++ b/resources/credits/sponsors.json @@ -1,27 +1,78 @@ { "gold": [ - "D3vil0p3r", - "Maxence Sebald", - "Dennis ten Hoove" + { + "name": "D3vil0p3r", + "url": "https://github.com/D3vil0p3r" + }, + { + "name": "Maxence Sebald", + "url": "" + }, + { + "name": "Dennis ten Hoove", + "url": "https://github.com/dennis1248" + } ], "silver": [ - "@danielheadbang", - "@MRR-dev", - "Jorge Castro" + { + "name": "@danielheadbang", + "url": "https://github.com/danielheadbang" + }, + { + "name": "@MRR-dev", + "url": "https://github.com/MRR-dev" + }, + { + "name": "Jorge Castro", + "url": "https://github.com/castrojo" + } ], "bronze": [ - "Angel Brielez" + { + "name": "Angel Brielez", + "url": "https://github.com/AngelBrielez" + } ], "past": [ - "@taconomix", - "@enolive", - "@Aggraxis", - "tj3k", - "@wolfyrion", - "@MrTomRod", - "Pouhiou", - "DAPREMONT Christophe", - "@manero6", - "@RickStanley" + { + "name": "@taconomix", + "url": "https://github.com/taconomix" + }, + { + "name": "@enolive", + "url": "https://github.com/enolive" + }, + { + "name": "@Aggraxis", + "url": "https://github.com/Aggraxis" + }, + { + "name": "tj3k", + "url": "https://twitter.com/tjiiik" + }, + { + "name": "@wolfyrion", + "url": "https://github.com/wolfyrion" + }, + { + "name": "@MrTomRod", + "url": "https://github.com/MrTomRod" + }, + { + "name": "Pouhiou", + "url": "" + }, + { + "name": "DAPREMONT Christophe", + "url": "" + }, + { + "name": "@manero6", + "url": "https://github.com/manero6" + }, + { + "name": "@RickStanley", + "url": "https://github.com/RickStanley" + } ] } \ No newline at end of file From 05c4c8979f64020acc943b4f23b29b643b4c7754 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 7 Jan 2023 20:43:17 +0100 Subject: [PATCH 2/2] :memo: Add changelog entry --- docs/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.md b/docs/changelog.md index e597167..e674df4 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -17,6 +17,7 @@ SPDX-License-Identifier: CC-BY-4.0 #### Other Enhancements * The menu button of the settings dialog has been moved to the left and now shows a heart instead of three dots. +* The about dialog now uses the `Adw.AboutWindow` if available. ## [Burn My Windows 23](https://github.com/schneegans/Burn-My-Windows/releases/tag/v23)