gnome-initial-setup/enhanced-page-skipping.patch

99 lines
3.4 KiB
Diff
Raw Normal View History

From a477f87d4883c383dd8bac61193b81ad0d85a77c Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Thu, 15 Feb 2018 21:12:08 -0600
Subject: [PATCH 2/2] Allow skipping pages only in new/existing user modes
This makes the skip file a bit more powerful. Instead of specifying
pages that will always be skipped, it's now possible to specify pages to
be skipped in just new user mode or just existing user mode. This way we
can hide pages that are redundant with distro installers in new user
mode (firstboot), but still show them otherwise.
To skip a page always, like Endless has been doing, just put it in
both sections.
https://bugzilla.gnome.org/show_bug.cgi?id=793501
---
gnome-initial-setup/gnome-initial-setup.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 6cca10b..622fb82 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -49,8 +49,9 @@
#include "pages/password/gis-password-page.h"
#include "pages/summary/gis-summary-page.h"
-#define VENDOR_PAGES_GROUP "pages"
-#define VENDOR_PAGES_SKIP_KEY "skip"
+#define VENDOR_NEW_USER_GROUP "new user"
+#define VENDOR_EXISTING_USER_GROUP "existing user"
+#define VENDOR_SKIP_KEY "skip"
static gboolean force_existing_user_mode;
@@ -101,20 +102,23 @@ should_skip_page (GisDriver *driver,
}
static gchar **
-pages_to_skip_from_file (void)
+pages_to_skip_from_file (gboolean is_new_user)
{
GKeyFile *skip_pages_file;
gchar **skip_pages = NULL;
GError *error = NULL;
/* VENDOR_CONF_FILE points to a keyfile containing vendor customization
- * options. This code will look for options under the "pages" group, and
- * supports the following keys:
+ * options. This code will look for options under the "new user" and
+ * "existing user" groups, and supports the following keys:
* - skip (optional): list of pages to be skipped.
*
- * This is how this file would look on a vendor image:
+ * This is how this file might look on a vendor image:
*
- * [pages]
+ * [new user]
+ * skip=language;keyboard
+ *
+ * [existing user]
* skip=language
*/
skip_pages_file = g_key_file_new ();
@@ -127,8 +131,9 @@ pages_to_skip_from_file (void)
goto out;
}
- skip_pages = g_key_file_get_string_list (skip_pages_file, VENDOR_PAGES_GROUP,
- VENDOR_PAGES_SKIP_KEY, NULL, NULL);
+ skip_pages = g_key_file_get_string_list (skip_pages_file,
+ is_new_user ? VENDOR_NEW_USER_GROUP : VENDOR_EXISTING_USER_GROUP,
+ VENDOR_SKIP_KEY, NULL, NULL);
out:
g_key_file_free (skip_pages_file);
@@ -166,9 +171,6 @@ rebuild_pages_cb (GisDriver *driver)
assistant = gis_driver_get_assistant (driver);
current_page = gis_assistant_get_current_page (assistant);
-
- skip_pages = pages_to_skip_from_file ();
-
page_data = page_table;
if (current_page != NULL) {
@@ -182,6 +184,8 @@ rebuild_pages_cb (GisDriver *driver)
}
is_new_user = (gis_driver_get_mode (driver) == GIS_DRIVER_MODE_NEW_USER);
+ skip_pages = pages_to_skip_from_file (is_new_user);
+
for (; page_data->page_id != NULL; ++page_data) {
if (page_data->new_user_only && !is_new_user)
continue;
--
2.14.3