[gnome-initial-setup] gnome-initial-setup: use new vendor configuration file to skip pages
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] gnome-initial-setup: use new vendor configuration file to skip pages
- Date: Mon, 12 Jun 2017 16:43:27 +0000 (UTC)
commit 8efc55094022ba02272b414ee5b137c2736bee3e
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Jun 3 11:22:22 2017 -0700
gnome-initial-setup: use new vendor configuration file to skip pages
This will allow defining a custom list of skipped pages as part of
vendor image configuration.
https://bugzilla.gnome.org/show_bug.cgi?id=783388
gnome-initial-setup/Makefile.am | 1 +
gnome-initial-setup/gnome-initial-setup.c | 42 ++++++++++++++++++++--------
2 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/gnome-initial-setup/Makefile.am b/gnome-initial-setup/Makefile.am
index d275dda..c04f1e4 100644
--- a/gnome-initial-setup/Makefile.am
+++ b/gnome-initial-setup/Makefile.am
@@ -8,6 +8,7 @@ AM_CPPFLAGS = \
$(INITIAL_SETUP_CFLAGS) \
-DSECRET_API_SUBJECT_TO_CHANGE \
-DGCR_API_SUBJECT_TO_CHANGE \
+ -DVENDOR_CONF_FILE="\"$(VENDOR_CONF_FILE)\"" \
-DUIDIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DLIBLOCALEDIR=\""$(prefix)/lib/locale"\" \
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 2ec91b9..600e730 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -49,6 +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"
+
static gboolean force_existing_user_mode;
typedef void (*PreparePage) (GisDriver *driver);
@@ -101,21 +104,36 @@ static gchar **
pages_to_skip_from_file (void)
{
GKeyFile *skip_pages_file;
- gchar **skip_pages;
+ 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:
+ * - skip (optional): list of pages to be skipped.
+ *
+ * This is how this file would look on a vendor image:
+ *
+ * [pages]
+ * skip=language
+ */
skip_pages_file = g_key_file_new ();
- /* TODO: put the skipfile somewhere sensible */
- if (g_key_file_load_from_file (skip_pages_file, "/tmp/skip_pages_file",
- G_KEY_FILE_NONE,
- NULL)) {
- skip_pages = g_key_file_get_string_list (skip_pages_file, "pages", "skip",
- NULL, NULL);
- g_key_file_free (skip_pages_file);
-
- return skip_pages;
+ if (!g_key_file_load_from_file (skip_pages_file, VENDOR_CONF_FILE,
+ G_KEY_FILE_NONE, &error)) {
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+ g_warning ("Could not read file %s: %s", VENDOR_CONF_FILE, error->message);
+
+ g_error_free (error);
+ goto out;
}
- return NULL;
+ skip_pages = g_key_file_get_string_list (skip_pages_file, VENDOR_PAGES_GROUP,
+ VENDOR_PAGES_SKIP_KEY, NULL, NULL);
+
+ out:
+ g_key_file_free (skip_pages_file);
+
+ return skip_pages;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]