From 81546652c6c6bb5166f7fba0d69e25cc06a15eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 27 Oct 2021 15:18:20 +0200 Subject: [PATCH] welcomeDialog: Adapt dialog title Use the downstream OS info if it's available, instead of hardcoding the GNOME release. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7026 Part-of: --- js/ui/welcomeDialog.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/js/ui/welcomeDialog.js b/js/ui/welcomeDialog.js index d1b02b3aa..d6f682483 100644 --- a/js/ui/welcomeDialog.js +++ b/js/ui/welcomeDialog.js @@ -1,6 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- import Clutter from 'gi://Clutter'; +import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -34,9 +35,22 @@ class WelcomeDialog extends ModalDialog.ModalDialog { return super.open(); } - _buildLayout() { + _getOSName() { + const prettyName = GLib.get_os_info('PRETTY_NAME'); + if (prettyName) + return prettyName; + + const name = GLib.get_os_info('NAME'); + const version = GLib.get_os_info('VERSION'); + if (name) + return version ? `${name} ${version}` : name; + const [majorVersion] = Config.PACKAGE_VERSION.split('.'); - const title = _('Welcome to GNOME %s').format(majorVersion); + return _('GNOME %s').format(majorVersion); + } + + _buildLayout() { + const title = _('Welcome to %s').format(this._getOSName()); const description = _('If you want to learn your way around, check out the tour.'); const content = new Dialog.MessageDialogContent({title, description});