[gnome-shell/wip/wjt/dont-set-welcome-dialog-last-shown-if-tour-not-installed] main: Only set last-shown-version if welcome actually shown




commit 2256173f6c410076973d6fca3c6c163417f1b65d
Author: Will Thompson <wjt endlessos org>
Date:   Tue Aug 16 07:07:16 2022 +0100

    main: Only set last-shown-version if welcome actually shown
    
    At startup, if the welcome-dialog-last-shown-version GSetting compares
    older than WELCOME_DIALOG_LAST_TOUR_CHANGE, Shell attempts to offer the
    welcome tour to the user, and then sets that GSetting to the current
    version of Shell.
    
    However, showing the welcome dialog can fail. In particular, if
    gnome-tour is not installed, WelcomeDialog.open() returns false and the
    dialog is not shown; but there are other reasons, such as another modal
    dialog already being open. Previously, welcome-dialog-last-shown-version
    would nonetheless be updated in this case, so if you subsequently
    install gnome-tour (or on the next login, if there is no modal dialog),
    the welcome dialog will not be offered until the next time
    WELCOME_DIALOG_LAST_TOUR_CHANGE is bumped.
    
    Instead, check whether WelcomeDialog.open() fails; if so, don't update
    welcome-dialog-last-shown-version.

 js/ui/main.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 2d8804aca8..e1862c82eb 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -354,10 +354,9 @@ 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();
+    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() {
@@ -710,7 +709,7 @@ function openWelcomeDialog() {
     if (welcomeDialog === null)
         welcomeDialog = new WelcomeDialog.WelcomeDialog();
 
-    welcomeDialog.open();
+    return welcomeDialog.open();
 }
 
 /**


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