[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 11af369544e3026cb234444e0a9e0394db3e3a98
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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 2d8804aca8..fe282e5488 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -354,8 +354,8 @@ 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);
     }
 }
@@ -710,7 +710,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]