[gnome-shell/wip/hadess/welcome-tour: 2/3] main: Show welcome tour dialogue on first start




commit 46d2338805eb4643b66e4b9c5c87082cbba93f24
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 1 13:31:41 2021 +0100

    main: Show welcome tour dialogue on first start
    
    This hooks the recently added welcome tour 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/3652

 data/org.gnome.shell.gschema.xml.in |  8 ++++++++
 js/ui/main.js                       | 13 +++++++++++++
 2 files changed, 21 insertions(+)
---
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
index 0ae047e188..94527dfd0d 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -94,6 +94,14 @@
         adapter is ever seen not to have devices associated to it.
       </description>
     </key>
+    <key name="show-welcome-tour" type="b">
+      <default>true</default>
+      <summary>Whether to show the “Welcome to GNOME” dialogue on startup</summary>
+      <description>
+        This key determines whether we show the “Welcome to GNOME” dialog on startup.
+        This key will be set to false when the dialogue has been shown once.
+      </description>
+    </key>
     <key name="introspect" type="b">
       <default>false</default>
       <summary>Enable introspection API</summary>
diff --git a/js/ui/main.js b/js/ui/main.js
index 9f3fb7b26c..ea59c2e619 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -50,6 +50,8 @@ const ParentalControlsManager = imports.misc.parentalControlsManager;
 
 const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
 const STICKY_KEYS_ENABLE = 'stickykeys-enable';
+const SHELL_SCHEMA = 'org.gnome.shell'
+const SHOW_WELCOME_TOUR = 'show-welcome-tour'
 const LOG_DOMAIN = 'GNOME Shell';
 const GNOMESHELL_STARTED_MESSAGE_ID = 'f3ea493c22934e26811cd62abe8e203a';
 
@@ -297,6 +299,9 @@ function _initializeUI() {
         if (credentials.get_unix_user() === 0) {
             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.'));
+        } else if (sessionMode.currentMode !== 'gdm' &&
+                   sessionMode.currentMode !== 'initial-setup') {
+            _handleShowWelcomeScreen();
         }
 
         if (sessionMode.currentMode !== 'gdm' &&
@@ -314,6 +319,14 @@ function _initializeUI() {
     });
 }
 
+function _handleShowWelcomeScreen() {
+    let _shellSettings = new Gio.Settings({ schema_id: SHELL_SCHEMA });
+    if (_shellSettings.get_boolean(SHOW_WELCOME_TOUR)) {
+        openWelcomeDialog();
+        _shellSettings.set_boolean(SHOW_WELCOME_TOUR, false);
+    }
+}
+
 async function _handleLockScreenWarning() {
     const path = '%s/lock-warning-shown'.format(global.userdatadir);
     const file = Gio.File.new_for_path(path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]