main: Show welcome dialogue on first start

This hooks the recently added welcome dialogue to be shown the first
time a new session is started, and disabled after that.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3632
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1619>
This commit is contained in:
Bastien Nocera 2021-02-01 13:31:41 +01:00 committed by Marge Bot
parent b0a48fad57
commit 512016dcb5
2 changed files with 27 additions and 0 deletions

View File

@ -94,6 +94,16 @@
adapter is ever seen not to have devices associated to it. adapter is ever seen not to have devices associated to it.
</description> </description>
</key> </key>
<key name="welcome-dialog-last-shown-version" type="s">
<default>''</default>
<summary>The last version the “Welcome to GNOME” dialogue was shown for</summary>
<description>
This key determines when the “Welcome to GNOME” dialog was last shown for.
An empty string represents the oldest possible version, and huge number will
represents versions that do not exist yet, and should be used to disable the
dialogue should that be needed.
</description>
</key>
<key name="introspect" type="b"> <key name="introspect" type="b">
<default>false</default> <default>false</default>
<summary>Enable introspection API</summary> <summary>Enable introspection API</summary>

View File

@ -47,9 +47,15 @@ const KbdA11yDialog = imports.ui.kbdA11yDialog;
const LocatePointer = imports.ui.locatePointer; const LocatePointer = imports.ui.locatePointer;
const PointerA11yTimeout = imports.ui.pointerA11yTimeout; const PointerA11yTimeout = imports.ui.pointerA11yTimeout;
const ParentalControlsManager = imports.misc.parentalControlsManager; const ParentalControlsManager = imports.misc.parentalControlsManager;
const Config = imports.misc.config;
const Util = imports.misc.util;
const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard'; const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
const STICKY_KEYS_ENABLE = 'stickykeys-enable'; const STICKY_KEYS_ENABLE = 'stickykeys-enable';
const WELCOME_DIALOG_LAST_SHOWN_VERSION = 'welcome-dialog-last-shown-version';
// Make sure to mention the point release, otherwise it will show every time
// until this version is current
const WELCOME_DIALOG_LAST_TOUR_CHANGE = '40.beta';
const LOG_DOMAIN = 'GNOME Shell'; const LOG_DOMAIN = 'GNOME Shell';
const GNOMESHELL_STARTED_MESSAGE_ID = 'f3ea493c22934e26811cd62abe8e203a'; const GNOMESHELL_STARTED_MESSAGE_ID = 'f3ea493c22934e26811cd62abe8e203a';
@ -297,6 +303,9 @@ function _initializeUI() {
if (credentials.get_unix_user() === 0) { if (credentials.get_unix_user() === 0) {
notify(_('Logged in as a privileged user'), notify(_('Logged in as a privileged user'),
_('Running a session as a privileged user should be avoided for security reasons. If possible, you should log in as a normal user.')); _('Running a session as a privileged user should be avoided for security reasons. If possible, you should log in as a normal user.'));
} else if (sessionMode.currentMode !== 'gdm' &&
sessionMode.currentMode !== 'initial-setup') {
_handleShowWelcomeScreen();
} }
if (sessionMode.currentMode !== 'gdm' && if (sessionMode.currentMode !== 'gdm' &&
@ -314,6 +323,14 @@ function _initializeUI() {
}); });
} }
function _handleShowWelcomeScreen() {
const lastShownVersion = global.settings.get_string(WELCOME_DIALOG_LAST_SHOWN_VERSION);
if (Util.GNOMEversionCompare(WELCOME_DIALOG_LAST_TOUR_CHANGE, lastShownVersion) > 0) {
openWelcomeDialog();
global.settings.set_string(WELCOME_DIALOG_LAST_SHOWN_VERSION, Config.PACKAGE_VERSION);
}
}
async function _handleLockScreenWarning() { async function _handleLockScreenWarning() {
const path = '%s/lock-warning-shown'.format(global.userdatadir); const path = '%s/lock-warning-shown'.format(global.userdatadir);
const file = Gio.File.new_for_path(path); const file = Gio.File.new_for_path(path);