[gnome-initial-setup: 2/3] gnome-initial-setup: Allow welcome tour to be skipped via vendor config




commit 3ef32820f0bdde13702b8931700f0f11cbb52e36
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Aug 13 12:42:53 2020 +0100

    gnome-initial-setup: Allow welcome tour to be skipped via vendor config
    
    Add a new `run_welcome_tour` vendor config key, which defaults to true,
    but if false it allows the welcome tour to be skipped.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 README.md                                            |  2 ++
 gnome-initial-setup/gnome-initial-setup.c            | 16 +++++++++++-----
 gnome-initial-setup/gnome-initial-setup.h            |  2 +-
 gnome-initial-setup/pages/summary/gis-summary-page.c |  2 +-
 4 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/README.md b/README.md
index 0918910e..aa13dbaf 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,8 @@ skip=timezone
 existing_user_only=language;keyboard
 # Only show the privacy page in the 'first boot' situation
 new_user_only=privacy
+# Don’t run the welcome tour once initial setup is complete
+run_welcome_tour=false
 
 [goa]
 # Offer a different set of GNOME Online Accounts providers on the Online
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 3e8e3484..107be55b 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -48,6 +48,7 @@
 #define VENDOR_SKIP_KEY "skip"
 #define VENDOR_NEW_USER_ONLY_KEY "new_user_only"
 #define VENDOR_EXISTING_USER_ONLY_KEY "existing_user_only"
+#define VENDOR_RUN_WELCOME_TOUR_KEY "run_welcome_tour"
 
 static gboolean force_existing_user_mode;
 
@@ -299,16 +300,21 @@ main (int argc, char *argv[])
 }
 
 void
-gis_ensure_stamp_files (void)
+gis_ensure_stamp_files (GisDriver *driver)
 {
   g_autofree gchar *welcome_file = NULL;
   g_autofree gchar *done_file = NULL;
   g_autoptr(GError) error = NULL;
 
-  welcome_file = g_build_filename (g_get_user_config_dir (), "run-welcome-tour", NULL);
-  if (!g_file_set_contents (welcome_file, "yes", -1, &error)) {
-      g_warning ("Unable to create %s: %s", welcome_file, error->message);
-      g_clear_error (&error);
+  if (gis_driver_conf_get_boolean (driver,
+                                   VENDOR_PAGES_GROUP,
+                                   VENDOR_RUN_WELCOME_TOUR_KEY,
+                                   TRUE)) {
+      welcome_file = g_build_filename (g_get_user_config_dir (), "run-welcome-tour", NULL);
+      if (!g_file_set_contents (welcome_file, "yes", -1, &error)) {
+          g_warning ("Unable to create %s: %s", welcome_file, error->message);
+          g_clear_error (&error);
+      }
   }
 
   done_file = g_build_filename (g_get_user_config_dir (), "gnome-initial-setup-done", NULL);
diff --git a/gnome-initial-setup/gnome-initial-setup.h b/gnome-initial-setup/gnome-initial-setup.h
index b6af4f31..55fcc7d2 100644
--- a/gnome-initial-setup/gnome-initial-setup.h
+++ b/gnome-initial-setup/gnome-initial-setup.h
@@ -35,7 +35,7 @@ typedef struct _GisPage      GisPage;
 #include "gis-page.h"
 #include "gis-keyring.h"
 
-void gis_ensure_stamp_files (void);
+void gis_ensure_stamp_files (GisDriver *driver);
 gboolean gis_get_mock_mode (void);
 
 #endif /* __GNOME_INITIAL_SETUP_H__ */
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c 
b/gnome-initial-setup/pages/summary/gis-summary-page.c
index db232c7f..106cf48e 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -181,7 +181,7 @@ log_user_in (GisSummaryPage *page)
 static void
 done_cb (GtkButton *button, GisSummaryPage *page)
 {
-  gis_ensure_stamp_files ();
+  gis_ensure_stamp_files (GIS_PAGE (page)->driver);
 
   switch (gis_driver_get_mode (GIS_PAGE (page)->driver))
     {


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