Update reduce initial setup redundancy patch again
This commit is contained in:
parent
b67a9e192e
commit
6bc84dc4da
@ -6,7 +6,7 @@
|
||||
|
||||
Name: gnome-initial-setup
|
||||
Version: 3.28.0
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Bootstrapping your OS
|
||||
|
||||
License: GPLv2+
|
||||
@ -112,6 +112,9 @@ useradd -rM -d /run/gnome-initial-setup/ -s /sbin/nologin %{name} &>/dev/null ||
|
||||
%{_localstatedir}/lib/gnome-initial-setup/vendor.conf
|
||||
|
||||
%changelog
|
||||
* Fri Mar 30 2018 Michael Catanzaro <mcatanzaro@gnome.org> - 3.28.0-3
|
||||
- Update reduce initial setup redundancy patch again
|
||||
|
||||
* Fri Mar 30 2018 Michael Catanzaro <mcatanzaro@gnome.org> - 3.28.0-2
|
||||
- Update reduce initial setup redundancy patches
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 59e732ce83059c16540d7208446c99b8e3937e8c Mon Sep 17 00:00:00 2001
|
||||
From de07cbc69b8f64b1a7708f454f029814d3c48b10 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Catanzaro <mcatanzaro@igalia.com>
|
||||
Date: Thu, 15 Feb 2018 21:08:38 -0600
|
||||
Subject: [PATCH] Reduce initial setup redundancy
|
||||
@ -8,12 +8,14 @@ This contains patches from these bugs:
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=793501
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=794166
|
||||
|
||||
Some work is by Peng Wu and some by Michael Catanzaro.
|
||||
modified a bit to not conflict with each other.
|
||||
|
||||
This is a combination of work by Peng Wu and Michael Catanzaro.
|
||||
---
|
||||
gnome-initial-setup/gis-assistant.c | 3 +-
|
||||
gnome-initial-setup/gis-page.c | 8 +
|
||||
gnome-initial-setup/gis-page.h | 2 +
|
||||
gnome-initial-setup/gnome-initial-setup.c | 53 ++++--
|
||||
gnome-initial-setup/gnome-initial-setup.c | 77 +++++++--
|
||||
.../pages/account/gis-account-page.h | 2 -
|
||||
.../pages/account/gis-account-pages.c | 9 +-
|
||||
.../pages/account/gis-account-pages.h | 2 +-
|
||||
@ -40,7 +42,7 @@ Some work is by Peng Wu and some by Michael Catanzaro.
|
||||
.../pages/summary/gis-summary-page.h | 2 +-
|
||||
.../pages/timezone/gis-timezone-page.c | 9 +-
|
||||
.../pages/timezone/gis-timezone-page.h | 2 +-
|
||||
30 files changed, 270 insertions(+), 138 deletions(-)
|
||||
30 files changed, 296 insertions(+), 136 deletions(-)
|
||||
|
||||
diff --git a/gnome-initial-setup/gis-assistant.c b/gnome-initial-setup/gis-assistant.c
|
||||
index 37ed563..0a3bd05 100644
|
||||
@ -57,7 +59,7 @@ index 37ed563..0a3bd05 100644
|
||||
}
|
||||
|
||||
diff --git a/gnome-initial-setup/gis-page.c b/gnome-initial-setup/gis-page.c
|
||||
index e28f573..39fe613 100644
|
||||
index e28f573..8564935 100644
|
||||
--- a/gnome-initial-setup/gis-page.c
|
||||
+++ b/gnome-initial-setup/gis-page.c
|
||||
@@ -382,3 +382,11 @@ gis_page_shown (GisPage *page)
|
||||
@ -70,7 +72,7 @@ index e28f573..39fe613 100644
|
||||
+{
|
||||
+ if (GIS_PAGE_GET_CLASS (page)->skip)
|
||||
+ return GIS_PAGE_GET_CLASS (page)->skip (page);
|
||||
+ return FALSE;
|
||||
+ return TRUE;
|
||||
+}
|
||||
diff --git a/gnome-initial-setup/gis-page.h b/gnome-initial-setup/gis-page.h
|
||||
index 02e3085..1f11578 100644
|
||||
@ -93,18 +95,17 @@ index 02e3085..1f11578 100644
|
||||
G_END_DECLS
|
||||
|
||||
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
|
||||
index 5a988a3..0fdfb45 100644
|
||||
index 5a988a3..4558810 100644
|
||||
--- a/gnome-initial-setup/gnome-initial-setup.c
|
||||
+++ b/gnome-initial-setup/gnome-initial-setup.c
|
||||
@@ -49,12 +49,15 @@
|
||||
#include "pages/password/gis-password-page.h"
|
||||
@@ -50,11 +50,15 @@
|
||||
#include "pages/summary/gis-summary-page.h"
|
||||
|
||||
-#define VENDOR_PAGES_GROUP "pages"
|
||||
#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"
|
||||
+#define VENDOR_NEW_USER_ONLY_KEY "new_user_only"
|
||||
+#define VENDOR_EXISTING_USER_ONLY_KEY "existing_user_only"
|
||||
|
||||
static gboolean force_existing_user_mode;
|
||||
|
||||
@ -115,48 +116,75 @@ index 5a988a3..0fdfb45 100644
|
||||
|
||||
typedef struct {
|
||||
const gchar *page_id;
|
||||
@@ -101,20 +104,23 @@ should_skip_page (GisDriver *driver,
|
||||
@@ -101,21 +105,40 @@ should_skip_page (GisDriver *driver,
|
||||
}
|
||||
|
||||
static gchar **
|
||||
-pages_to_skip_from_file (void)
|
||||
+strv_append (gchar **a,
|
||||
+ gchar **b)
|
||||
+{
|
||||
+ guint n = g_strv_length (a);
|
||||
+ guint m = g_strv_length (b);
|
||||
+
|
||||
+ a = g_renew (gchar *, a, n + m + 1);
|
||||
+ for (guint i = 0; i < m; i++)
|
||||
+ a[n + i] = g_strdup (b[i]);
|
||||
+ a[n + m] = NULL;
|
||||
+
|
||||
+ return a;
|
||||
+}
|
||||
+
|
||||
+static gchar **
|
||||
+pages_to_skip_from_file (gboolean is_new_user)
|
||||
{
|
||||
GKeyFile *skip_pages_file;
|
||||
gchar **skip_pages = NULL;
|
||||
+ gchar **additional_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.
|
||||
* options. This code will look for options under the "pages" group, and
|
||||
* supports the following keys:
|
||||
- * - skip (optional): list of pages to be skipped.
|
||||
+ * - skip (optional): list of pages to be skipped always
|
||||
+ * - new_user_only (optional): list of pages to be skipped in existing user mode
|
||||
+ * - existing_user_only (optional): list of pages to be skipped in new user mode
|
||||
*
|
||||
- * This is how this file would look on a vendor image:
|
||||
+ * This is how this file might look on a vendor image:
|
||||
+ *
|
||||
+ * [new user]
|
||||
+ * skip=language;keyboard
|
||||
*
|
||||
- * [pages]
|
||||
+ * [existing user]
|
||||
* skip=language
|
||||
* [pages]
|
||||
- * skip=language
|
||||
+ * skip=timezone
|
||||
+ * existing_user_only=language;keyboard
|
||||
*/
|
||||
skip_pages_file = g_key_file_new ();
|
||||
@@ -127,8 +133,9 @@ pages_to_skip_from_file (void)
|
||||
if (!g_key_file_load_from_file (skip_pages_file, VENDOR_CONF_FILE,
|
||||
@@ -127,8 +150,20 @@ 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_PAGES_GROUP,
|
||||
+ VENDOR_SKIP_KEY, NULL, NULL);
|
||||
+ additional_skip_pages = g_key_file_get_string_list (skip_pages_file,
|
||||
+ VENDOR_PAGES_GROUP,
|
||||
+ is_new_user ? VENDOR_EXISTING_USER_ONLY_KEY : VENDOR_NEW_USER_ONLY_KEY,
|
||||
+ NULL, NULL);
|
||||
+
|
||||
+ if (!skip_pages && additional_skip_pages) {
|
||||
+ skip_pages = additional_skip_pages;
|
||||
+ } else if (skip_pages && additional_skip_pages) {
|
||||
+ skip_pages = strv_append (skip_pages, additional_skip_pages);
|
||||
+ g_strfreev (additional_skip_pages);
|
||||
+ }
|
||||
|
||||
out:
|
||||
g_key_file_free (skip_pages_file);
|
||||
@@ -159,16 +166,14 @@ static void
|
||||
@@ -159,16 +194,14 @@ static void
|
||||
rebuild_pages_cb (GisDriver *driver)
|
||||
{
|
||||
PageData *page_data;
|
||||
@ -175,7 +203,7 @@ index 5a988a3..0fdfb45 100644
|
||||
page_data = page_table;
|
||||
|
||||
if (current_page != NULL) {
|
||||
@@ -182,14 +187,23 @@ rebuild_pages_cb (GisDriver *driver)
|
||||
@@ -182,14 +215,23 @@ rebuild_pages_cb (GisDriver *driver)
|
||||
}
|
||||
|
||||
is_new_user = (gis_driver_get_mode (driver) == GIS_DRIVER_MODE_NEW_USER);
|
||||
@ -185,12 +213,12 @@ index 5a988a3..0fdfb45 100644
|
||||
- if (page_data->new_user_only && !is_new_user)
|
||||
- continue;
|
||||
+ skipped = FALSE;
|
||||
|
||||
- if (should_skip_page (driver, page_data->page_id, skip_pages))
|
||||
+
|
||||
+ if ((page_data->new_user_only && !is_new_user) ||
|
||||
+ (should_skip_page (driver, page_data->page_id, skip_pages)))
|
||||
+ skipped = TRUE;
|
||||
+
|
||||
|
||||
- if (should_skip_page (driver, page_data->page_id, skip_pages))
|
||||
+ page = page_data->prepare_page_func (driver);
|
||||
+ if (!page)
|
||||
continue;
|
||||
@ -203,7 +231,7 @@ index 5a988a3..0fdfb45 100644
|
||||
}
|
||||
|
||||
g_strfreev (skip_pages);
|
||||
@@ -267,6 +281,7 @@ main (int argc, char *argv[])
|
||||
@@ -267,6 +309,7 @@ main (int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -211,7 +239,7 @@ index 5a988a3..0fdfb45 100644
|
||||
mode = get_mode ();
|
||||
|
||||
/* We only do this in existing-user mode, because if gdm launches us
|
||||
@@ -290,6 +305,8 @@ main (int argc, char *argv[])
|
||||
@@ -290,6 +333,8 @@ main (int argc, char *argv[])
|
||||
g_signal_connect (driver, "rebuild-pages", G_CALLBACK (rebuild_pages_cb), NULL);
|
||||
status = g_application_run (G_APPLICATION (driver), argc, argv);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user