Fix crash in new user mode
This commit is contained in:
parent
15273e7483
commit
139b92e142
@ -1,16 +1,16 @@
|
||||
From ff6f8806884cbfbd570a598a293c1704dbe355c7 Mon Sep 17 00:00:00 2001
|
||||
From 555b00faf5c25f6903ff9f247a60b0a488bfee14 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Tue, 15 Aug 2023 10:53:41 -0400
|
||||
Subject: [PATCH 04/12] gnome-initial-setup: Bump GLib required version to 2.70
|
||||
Subject: [PATCH 1/9] gnome-initial-setup: Bump GLib required version to 2.76
|
||||
|
||||
This gives us GStrvBuilder
|
||||
This gives us GStrvBuilder, g_ptr_array_sort_values, etc
|
||||
---
|
||||
gnome-initial-setup/meson.build | 2 +-
|
||||
meson.build | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gnome-initial-setup/meson.build b/gnome-initial-setup/meson.build
|
||||
index a6a014d1..d0ad5ff8 100644
|
||||
index a6a014d1..64fa834a 100644
|
||||
--- a/gnome-initial-setup/meson.build
|
||||
+++ b/gnome-initial-setup/meson.build
|
||||
@@ -25,61 +25,61 @@ sources += [
|
||||
@ -45,7 +45,7 @@ index a6a014d1..d0ad5ff8 100644
|
||||
dependency ('goa-1.0'),
|
||||
dependency ('gtk4', version: '>= 4.6'),
|
||||
- dependency ('glib-2.0', version: '>= 2.63.1'),
|
||||
+ dependency ('glib-2.0', version: '>= 2.70.0'),
|
||||
+ dependency ('glib-2.0', version: '>= 2.76.0'),
|
||||
dependency ('gio-unix-2.0', version: '>= 2.53.0'),
|
||||
dependency ('gdm', version: '>= 3.8.3'),
|
||||
gweather_dep,
|
||||
@ -77,7 +77,7 @@ index a6a014d1..d0ad5ff8 100644
|
||||
'gnome-initial-setup-copy-worker',
|
||||
['gnome-initial-setup-copy-worker.c'],
|
||||
diff --git a/meson.build b/meson.build
|
||||
index a1057988..28cf7998 100644
|
||||
index a1057988..7dd876e3 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -3,62 +3,62 @@ project('gnome-initial-setup',
|
||||
@ -113,8 +113,8 @@ index a1057988..28cf7998 100644
|
||||
conf.set('G_LOG_USE_STRUCTURED', true)
|
||||
-conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_64')
|
||||
-conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_64')
|
||||
+conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_70')
|
||||
+conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_70')
|
||||
+conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_76')
|
||||
+conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_76')
|
||||
|
||||
enable_systemd = get_option('systemd')
|
||||
if enable_systemd
|
@ -1,82 +0,0 @@
|
||||
From 0cfffbc2fbadc0249186f4e2840943fc374f2e0c Mon Sep 17 00:00:00 2001
|
||||
From: Michael Catanzaro <mcatanzaro@redhat.com>
|
||||
Date: Tue, 22 Aug 2023 12:58:50 -0500
|
||||
Subject: [PATCH 01/12] keyboard: stop setting 'current' input source
|
||||
|
||||
This setting is deprecated and ignored since 3.22. We don't need to set
|
||||
it anymore because nothing uses it. See:
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=766847
|
||||
---
|
||||
gnome-initial-setup/pages/keyboard/gis-keyboard-page.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
index fa41230f..693bb117 100644
|
||||
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
@@ -84,61 +84,60 @@ set_input_settings (GisKeyboardPage *self)
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
const gchar *type;
|
||||
const gchar *id;
|
||||
GVariantBuilder builder;
|
||||
GSList *l;
|
||||
gboolean is_xkb_source = FALSE;
|
||||
|
||||
type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser));
|
||||
id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser));
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)"));
|
||||
|
||||
if (g_str_equal (type, "xkb")) {
|
||||
g_variant_builder_add (&builder, "(ss)", type, id);
|
||||
is_xkb_source = TRUE;
|
||||
}
|
||||
|
||||
for (l = priv->system_sources; l; l = l->next) {
|
||||
const gchar *sid = l->data;
|
||||
|
||||
if (g_str_equal (id, sid) && g_str_equal (type, "xkb"))
|
||||
continue;
|
||||
|
||||
g_variant_builder_add (&builder, "(ss)", "xkb", sid);
|
||||
}
|
||||
|
||||
if (!is_xkb_source)
|
||||
g_variant_builder_add (&builder, "(ss)", type, id);
|
||||
|
||||
g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
|
||||
- g_settings_set_uint (priv->input_settings, KEY_CURRENT_INPUT_SOURCE, 0);
|
||||
|
||||
g_settings_apply (priv->input_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
set_localed_input (GisKeyboardPage *self)
|
||||
{
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
const gchar *layout, *variant;
|
||||
GString *layouts;
|
||||
GString *variants;
|
||||
GSList *l;
|
||||
|
||||
if (!priv->localed)
|
||||
return;
|
||||
|
||||
cc_input_chooser_get_layout (CC_INPUT_CHOOSER (priv->input_chooser), &layout, &variant);
|
||||
if (layout == NULL)
|
||||
layout = "";
|
||||
if (variant == NULL)
|
||||
variant = "";
|
||||
|
||||
layouts = g_string_new (layout);
|
||||
variants = g_string_new (variant);
|
||||
|
||||
#define LAYOUT(a) (a[0])
|
||||
#define VARIANT(a) (a[1] ? a[1] : "")
|
||||
for (l = priv->system_sources; l; l = l->next) {
|
||||
const gchar *sid = l->data;
|
||||
gchar **lv = g_strsplit (sid, "+", -1);
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a4c286ad57e53935de67034ea9224069a3ad7472 Mon Sep 17 00:00:00 2001
|
||||
From 1a15a39b5cc4cfa14f3b953c19b03901c923cbc1 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Sat, 9 Sep 2023 17:07:46 -0400
|
||||
Subject: [PATCH 06/12] keyboard: Don't require localed for non-system modes
|
||||
Subject: [PATCH 2/9] keyboard: Don't require localed for existing user mode
|
||||
|
||||
If we're in existing user mode, the user may not have
|
||||
permission to set the system keymap.
|
||||
@ -13,10 +13,10 @@ prevent the keyboard page from completing.
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
index ad48d933..d23b72b2 100644
|
||||
index fa41230f..da384495 100644
|
||||
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
@@ -396,62 +396,67 @@ preselect_input_source (GisKeyboardPage *self)
|
||||
@@ -388,62 +388,67 @@ preselect_input_source (GisKeyboardPage *self)
|
||||
* - If we got nothing from gnome-desktop and there's no system-wide
|
||||
* keyboard layout set, we don't preselect anything.
|
||||
*
|
||||
@ -49,7 +49,7 @@ index ad48d933..d23b72b2 100644
|
||||
|
||||
- complete = (priv->localed != NULL &&
|
||||
- cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)) != NULL);
|
||||
+ if (gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM) {
|
||||
+ if (gis_driver_get_mode (GIS_PAGE (self)->driver) == GIS_DRIVER_MODE_NEW_USER) {
|
||||
+ complete = (priv->localed != NULL &&
|
||||
+ cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)) != NULL);
|
||||
+ } else {
|
@ -1,160 +0,0 @@
|
||||
From 78e81f1f63363f8113d7c34f6ca257dbd64a2691 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Catanzaro <mcatanzaro@redhat.com>
|
||||
Date: Thu, 24 Aug 2023 13:03:07 -0500
|
||||
Subject: [PATCH 02/12] keyboard: write to mru-sources setting if it has never
|
||||
been set before
|
||||
|
||||
This is a port of:
|
||||
|
||||
https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1893
|
||||
|
||||
In theory, this shouldn't matter during a firstboot scenario as
|
||||
mru-sources should not be touched yet, but gnome-initial-setup may be
|
||||
run in a different ways and it seems useful to be robust here.
|
||||
---
|
||||
.../pages/keyboard/gis-keyboard-page.c | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
index 693bb117..ad48d933 100644
|
||||
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
@@ -17,60 +17,61 @@
|
||||
* Author: Sergey Udaltsov <svu@gnome.org>
|
||||
* Michael Wood <michael.g.wood@intel.com>
|
||||
*
|
||||
* Based on gnome-control-center cc-region-panel.c
|
||||
*/
|
||||
|
||||
#define PAGE_ID "keyboard"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <polkit/polkit.h>
|
||||
|
||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#include <libgnome-desktop/gnome-languages.h>
|
||||
|
||||
#include "gis-keyboard-page.h"
|
||||
#include "keyboard-resources.h"
|
||||
#include "cc-input-chooser.h"
|
||||
|
||||
#include "cc-common-language.h"
|
||||
|
||||
#include "gis-page-header.h"
|
||||
|
||||
#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources"
|
||||
#define KEY_CURRENT_INPUT_SOURCE "current"
|
||||
#define KEY_INPUT_SOURCES "sources"
|
||||
+#define KEY_MRU_SOURCES "mru-sources"
|
||||
|
||||
struct _GisKeyboardPagePrivate {
|
||||
GtkWidget *input_chooser;
|
||||
|
||||
GDBusProxy *localed;
|
||||
GCancellable *cancellable;
|
||||
GPermission *permission;
|
||||
GSettings *input_settings;
|
||||
|
||||
GSList *system_sources;
|
||||
};
|
||||
typedef struct _GisKeyboardPagePrivate GisKeyboardPagePrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GisKeyboardPage, gis_keyboard_page, GIS_TYPE_PAGE);
|
||||
|
||||
static void
|
||||
gis_keyboard_page_finalize (GObject *object)
|
||||
{
|
||||
GisKeyboardPage *self = GIS_KEYBOARD_PAGE (object);
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
|
||||
if (priv->cancellable)
|
||||
g_cancellable_cancel (priv->cancellable);
|
||||
g_clear_object (&priv->cancellable);
|
||||
|
||||
g_clear_object (&priv->permission);
|
||||
g_clear_object (&priv->localed);
|
||||
g_clear_object (&priv->input_settings);
|
||||
|
||||
g_slist_free_full (priv->system_sources, g_free);
|
||||
@@ -83,63 +84,71 @@ set_input_settings (GisKeyboardPage *self)
|
||||
{
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
const gchar *type;
|
||||
const gchar *id;
|
||||
GVariantBuilder builder;
|
||||
GSList *l;
|
||||
gboolean is_xkb_source = FALSE;
|
||||
|
||||
type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser));
|
||||
id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser));
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)"));
|
||||
|
||||
if (g_str_equal (type, "xkb")) {
|
||||
g_variant_builder_add (&builder, "(ss)", type, id);
|
||||
is_xkb_source = TRUE;
|
||||
}
|
||||
|
||||
for (l = priv->system_sources; l; l = l->next) {
|
||||
const gchar *sid = l->data;
|
||||
|
||||
if (g_str_equal (id, sid) && g_str_equal (type, "xkb"))
|
||||
continue;
|
||||
|
||||
g_variant_builder_add (&builder, "(ss)", "xkb", sid);
|
||||
}
|
||||
|
||||
if (!is_xkb_source)
|
||||
g_variant_builder_add (&builder, "(ss)", type, id);
|
||||
|
||||
- g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
|
||||
+ if (type != NULL && id != NULL) {
|
||||
+ GVariantBuilder mru_input_source_builder;
|
||||
|
||||
- g_settings_apply (priv->input_settings);
|
||||
+ g_variant_builder_init (&mru_input_source_builder, G_VARIANT_TYPE ("a(ss)"));
|
||||
+ g_variant_builder_add (&mru_input_source_builder, "(ss)", type, id);
|
||||
+ g_settings_set_value (priv->input_settings, KEY_MRU_SOURCES, g_variant_builder_end (&mru_input_source_builder));
|
||||
+ }
|
||||
+
|
||||
+ g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
|
||||
+
|
||||
+ g_settings_apply (priv->input_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
set_localed_input (GisKeyboardPage *self)
|
||||
{
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
const gchar *layout, *variant;
|
||||
GString *layouts;
|
||||
GString *variants;
|
||||
GSList *l;
|
||||
|
||||
if (!priv->localed)
|
||||
return;
|
||||
|
||||
cc_input_chooser_get_layout (CC_INPUT_CHOOSER (priv->input_chooser), &layout, &variant);
|
||||
if (layout == NULL)
|
||||
layout = "";
|
||||
if (variant == NULL)
|
||||
variant = "";
|
||||
|
||||
layouts = g_string_new (layout);
|
||||
variants = g_string_new (variant);
|
||||
|
||||
#define LAYOUT(a) (a[0])
|
||||
#define VARIANT(a) (a[1] ? a[1] : "")
|
||||
for (l = priv->system_sources; l; l = l->next) {
|
||||
const gchar *sid = l->data;
|
||||
gchar **lv = g_strsplit (sid, "+", -1);
|
||||
|
||||
if (!g_str_equal (LAYOUT (lv), layout) ||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 3f4db2669b673eec3bd90bb00eac8dc3be3b9563 Mon Sep 17 00:00:00 2001
|
||||
From ec880bd018b4ff243baba1d44ac24ff3558b13b5 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Fri, 8 Sep 2023 11:02:39 -0400
|
||||
Subject: [PATCH 03/12] language: Don't proceed until localed has set locale
|
||||
Subject: [PATCH 3/9] language: Don't proceed until localed has set locale
|
||||
|
||||
In sysmte modes, the keyboard page requires reading the locale from
|
||||
localed, so we need to make sure the setting has been applied before
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 5731eb16e81b5aeeb4aefe052630241b562002c3 Mon Sep 17 00:00:00 2001
|
||||
From f34f6580a33b4e5e4073ea1ddf10e7a9b4aa751e Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Thu, 24 Aug 2023 21:19:40 -0400
|
||||
Subject: [PATCH 07/12] keyboard: Get default input sources from gnome-desktop
|
||||
Subject: [PATCH 4/9] keyboard: Get default input sources from gnome-desktop
|
||||
|
||||
Right now, we figure out the default input sources ourselves,
|
||||
based on the current locale and layout information coming from
|
||||
@ -16,14 +16,15 @@ The same time if leverages a gnome-desktop API to fix a bug
|
||||
where cyrillic layouts were getting added without a latin
|
||||
counterpart.
|
||||
---
|
||||
.../pages/keyboard/gis-keyboard-page.c | 467 +++++++++---------
|
||||
1 file changed, 231 insertions(+), 236 deletions(-)
|
||||
.../pages/keyboard/gis-keyboard-page.c | 475 +++++++++---------
|
||||
1 file changed, 239 insertions(+), 236 deletions(-)
|
||||
|
||||
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
index d23b72b2..179553da 100644
|
||||
index da384495..f2bfe164 100644
|
||||
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
@@ -18,515 +18,510 @@
|
||||
@@ -17,508 +17,511 @@
|
||||
* Author: Sergey Udaltsov <svu@gnome.org>
|
||||
* Michael Wood <michael.g.wood@intel.com>
|
||||
*
|
||||
* Based on gnome-control-center cc-region-panel.c
|
||||
@ -53,7 +54,7 @@ index d23b72b2..179553da 100644
|
||||
#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources"
|
||||
#define KEY_CURRENT_INPUT_SOURCE "current"
|
||||
#define KEY_INPUT_SOURCES "sources"
|
||||
#define KEY_MRU_SOURCES "mru-sources"
|
||||
+#define KEY_MRU_SOURCES "mru-sources"
|
||||
+#define KEY_INPUT_OPTIONS "xkb-options"
|
||||
|
||||
struct _GisKeyboardPagePrivate {
|
||||
@ -123,7 +124,7 @@ index d23b72b2..179553da 100644
|
||||
- type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser));
|
||||
- id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser));
|
||||
+ for (i = 0; priv->default_input_source_ids && priv->default_input_source_ids[i] != NULL; i++) {
|
||||
+ if (g_str_equal (already_added_id, priv->default_input_source_ids[i]) && g_str_equal (already_added_type, priv->default_input_source_types[i])) {
|
||||
+ if (g_strcmp0 (already_added_id, priv->default_input_source_ids[i]) == 0 && g_strcmp0 (already_added_type, priv->default_input_source_types[i]) == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
@ -155,14 +156,11 @@ index d23b72b2..179553da 100644
|
||||
+{
|
||||
+ g_auto(GStrv) layout_and_variant = NULL;
|
||||
+ const char *layout, *variant;
|
||||
|
||||
- g_variant_builder_add (&builder, "(ss)", "xkb", sid);
|
||||
+
|
||||
+ if (!g_str_equal (type, "xkb")) {
|
||||
+ return;
|
||||
}
|
||||
|
||||
- if (!is_xkb_source)
|
||||
- g_variant_builder_add (&builder, "(ss)", type, id);
|
||||
+ }
|
||||
+
|
||||
+ layout_and_variant = g_strsplit (id, "+", -1);
|
||||
+
|
||||
+ layout = layout_and_variant[0];
|
||||
@ -216,10 +214,10 @@ index d23b72b2..179553da 100644
|
||||
+ return;
|
||||
+
|
||||
+ g_clear_pointer (&input_sources, g_variant_unref);
|
||||
|
||||
+
|
||||
+ g_variant_builder_init (&input_options_builder, G_VARIANT_TYPE ("as"));
|
||||
+
|
||||
+ is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM;
|
||||
+ is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) == GIS_DRIVER_MODE_NEW_USER;
|
||||
+
|
||||
+ layouts_array = g_ptr_array_new ();
|
||||
+ variants_array = g_ptr_array_new ();
|
||||
@ -230,7 +228,7 @@ index d23b72b2..179553da 100644
|
||||
+ * in the UI.
|
||||
+ */
|
||||
+ g_variant_builder_init (&input_source_builder, G_VARIANT_TYPE ("a(ss)"));
|
||||
if (type != NULL && id != NULL) {
|
||||
+ if (type != NULL && id != NULL) {
|
||||
+ add_input_source_to_arrays (self, type, id, layouts_array, variants_array);
|
||||
+
|
||||
+ if (gnome_input_source_is_non_latin (type, id)) {
|
||||
@ -240,10 +238,13 @@ index d23b72b2..179553da 100644
|
||||
+ } else {
|
||||
+ default_input_source_id = g_strdup (id);
|
||||
+ }
|
||||
+
|
||||
|
||||
- g_variant_builder_add (&builder, "(ss)", "xkb", sid);
|
||||
+ g_variant_builder_add (&input_source_builder, "(ss)", type, id);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
- if (!is_xkb_source)
|
||||
- g_variant_builder_add (&builder, "(ss)", type, id);
|
||||
+ if (default_input_source_id == NULL || !is_system_mode) {
|
||||
+ add_defaults_to_variant_builder (self, type, id, &input_source_builder, &default_input_source_id);
|
||||
+ }
|
||||
@ -260,24 +261,24 @@ index d23b72b2..179553da 100644
|
||||
+
|
||||
+ priv->system_layouts = (char **) g_ptr_array_steal (layouts_array, NULL);
|
||||
+ priv->system_variants = (char **) g_ptr_array_steal (variants_array, NULL);
|
||||
+
|
||||
|
||||
- g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
|
||||
- g_settings_set_uint (priv->input_settings, KEY_CURRENT_INPUT_SOURCE, 0);
|
||||
+ g_variant_get (input_options, "^as", &priv->system_options);
|
||||
+
|
||||
+ g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_steal_pointer (&input_sources));
|
||||
+ g_settings_set_value (priv->input_settings, KEY_INPUT_OPTIONS, g_steal_pointer (&input_options));
|
||||
+
|
||||
+ if (default_input_source_id != NULL) {
|
||||
GVariantBuilder mru_input_source_builder;
|
||||
|
||||
g_variant_builder_init (&mru_input_source_builder, G_VARIANT_TYPE ("a(ss)"));
|
||||
- g_variant_builder_add (&mru_input_source_builder, "(ss)", type, id);
|
||||
+ GVariantBuilder mru_input_source_builder;
|
||||
+
|
||||
+ g_variant_builder_init (&mru_input_source_builder, G_VARIANT_TYPE ("a(ss)"));
|
||||
+ g_variant_builder_add (&mru_input_source_builder, "(ss)", type, default_input_source_id);
|
||||
g_settings_set_value (priv->input_settings, KEY_MRU_SOURCES, g_variant_builder_end (&mru_input_source_builder));
|
||||
}
|
||||
+ g_settings_set_value (priv->input_settings, KEY_MRU_SOURCES, g_variant_builder_end (&mru_input_source_builder));
|
||||
+ }
|
||||
|
||||
- g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
|
||||
-
|
||||
g_settings_apply (priv->input_settings);
|
||||
- g_settings_apply (priv->input_settings);
|
||||
+ g_settings_apply (priv->input_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -604,7 +605,7 @@ index d23b72b2..179553da 100644
|
||||
+ got_input_source = gnome_get_input_source_from_locale (language, &type, &id);
|
||||
+
|
||||
+ if (got_input_source) {
|
||||
+ gboolean is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM;
|
||||
+ gboolean is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) == GIS_DRIVER_MODE_NEW_USER;
|
||||
+ if (is_system_mode || g_str_equal (type, "ibus")) {
|
||||
+ cc_input_chooser_set_input (CC_INPUT_CHOOSER (priv->input_chooser),
|
||||
+ id,
|
||||
@ -626,7 +627,7 @@ index d23b72b2..179553da 100644
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
gboolean complete;
|
||||
|
||||
if (gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM) {
|
||||
if (gis_driver_get_mode (GIS_PAGE (self)->driver) == GIS_DRIVER_MODE_NEW_USER) {
|
||||
complete = (priv->localed != NULL &&
|
||||
cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)) != NULL);
|
||||
} else {
|
@ -1,7 +1,7 @@
|
||||
From e007dde4ae8e99589f12c58e6fcfce75b1f76ca1 Mon Sep 17 00:00:00 2001
|
||||
From 07f191dbc961b793fe9761f577d94f5f10502380 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Sun, 13 Aug 2023 09:09:56 -0400
|
||||
Subject: [PATCH 05/12] driver: Specify mode via flags instead of boolean
|
||||
Subject: [PATCH 5/9] driver: Specify mode via flags instead of boolean
|
||||
|
||||
At the moment we just have system mode and new user mode,
|
||||
but we're actually going to want other modes (such as
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a53288f0ce04d4347635167fc313f357bd02a3e3 Mon Sep 17 00:00:00 2001
|
||||
From 026a99057ae42b6aee41e8be486c56c63bbaeb43 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Sun, 13 Aug 2023 09:39:07 -0400
|
||||
Subject: [PATCH 08/12] gnome-initial-setup: Add live user mode
|
||||
Subject: [PATCH 6/9] gnome-initial-setup: Add live user mode
|
||||
|
||||
This commit adds a new "live user" mode meant to be run in live image
|
||||
environments.
|
||||
@ -22,11 +22,11 @@ or just jump into the live session instead.
|
||||
.../pages/install/gis-install-page.ui | 49 +++
|
||||
.../pages/install/install.gresource.xml | 7 +
|
||||
gnome-initial-setup/pages/install/meson.build | 9 +
|
||||
.../pages/keyboard/gis-keyboard-page.c | 4 +-
|
||||
.../pages/keyboard/gis-keyboard-page.c | 10 +-
|
||||
.../pages/language/gis-language-page.c | 5 +-
|
||||
gnome-initial-setup/pages/meson.build | 1 +
|
||||
.../pages/password/gis-password-page.c | 6 +
|
||||
16 files changed, 632 insertions(+), 15 deletions(-)
|
||||
16 files changed, 635 insertions(+), 18 deletions(-)
|
||||
create mode 100644 gnome-initial-setup/pages/install/gis-install-page.c
|
||||
create mode 100644 gnome-initial-setup/pages/install/gis-install-page.h
|
||||
create mode 100644 gnome-initial-setup/pages/install/gis-install-page.ui
|
||||
@ -1285,9 +1285,72 @@ index 00000000..e5084e5e
|
||||
+ 'gis-install-page.h'
|
||||
+)
|
||||
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
index 179553da..85028970 100644
|
||||
index f2bfe164..7801667c 100644
|
||||
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
||||
@@ -160,61 +160,61 @@ add_defaults_to_arrays (GisKeyboardPage *self,
|
||||
|
||||
static void
|
||||
set_input_settings (GisKeyboardPage *self,
|
||||
const char *type,
|
||||
const char *id)
|
||||
{
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
g_autofree char *layout = NULL;
|
||||
g_autofree char *variant = NULL;
|
||||
g_autoptr(GVariant) default_input_sources = NULL;
|
||||
g_autoptr(GVariant) input_sources = NULL;
|
||||
g_autoptr(GPtrArray) layouts_array = NULL;
|
||||
g_autoptr(GPtrArray) variants_array = NULL;
|
||||
GVariantBuilder input_source_builder;
|
||||
GVariantBuilder input_options_builder;
|
||||
g_autoptr(GVariant) input_options = NULL;
|
||||
gboolean is_system_mode;
|
||||
size_t i;
|
||||
g_autofree char *default_input_source_id = NULL;
|
||||
|
||||
default_input_sources = g_settings_get_default_value (priv->input_settings, KEY_INPUT_SOURCES);
|
||||
input_sources = g_settings_get_value (priv->input_settings, KEY_INPUT_SOURCES);
|
||||
|
||||
if (!g_variant_equal (default_input_sources, input_sources))
|
||||
return;
|
||||
|
||||
g_clear_pointer (&input_sources, g_variant_unref);
|
||||
|
||||
g_variant_builder_init (&input_options_builder, G_VARIANT_TYPE ("as"));
|
||||
|
||||
- is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) == GIS_DRIVER_MODE_NEW_USER;
|
||||
+ is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM;
|
||||
|
||||
layouts_array = g_ptr_array_new ();
|
||||
variants_array = g_ptr_array_new ();
|
||||
|
||||
/* Notice the added latin layout (if relevant) gets put first for gsettings
|
||||
* (input_source_builder and last for localed (layouts_array/variants_array)
|
||||
* This ensures we get a cyrillic layout on ttys, but a latin layout by default
|
||||
* in the UI.
|
||||
*/
|
||||
g_variant_builder_init (&input_source_builder, G_VARIANT_TYPE ("a(ss)"));
|
||||
if (type != NULL && id != NULL) {
|
||||
add_input_source_to_arrays (self, type, id, layouts_array, variants_array);
|
||||
|
||||
if (gnome_input_source_is_non_latin (type, id)) {
|
||||
default_input_source_id = g_strdup ("us");
|
||||
add_input_source_to_arrays (self, "xkb", default_input_source_id, layouts_array, variants_array);
|
||||
g_variant_builder_add (&input_source_builder, "(ss)", "xkb", default_input_source_id);
|
||||
} else {
|
||||
default_input_source_id = g_strdup (id);
|
||||
}
|
||||
|
||||
g_variant_builder_add (&input_source_builder, "(ss)", type, id);
|
||||
}
|
||||
|
||||
if (default_input_source_id == NULL || !is_system_mode) {
|
||||
add_defaults_to_variant_builder (self, type, id, &input_source_builder, &default_input_source_id);
|
||||
}
|
||||
input_sources = g_variant_builder_end (&input_source_builder);
|
||||
|
||||
for (i = 0; priv->default_options[i] != NULL; i++) {
|
||||
@@ -274,61 +274,61 @@ change_locale_permission_acquired (GObject *source,
|
||||
{
|
||||
GisKeyboardPage *page = GIS_KEYBOARD_PAGE (data);
|
||||
@ -1351,6 +1414,91 @@ index 179553da..85028970 100644
|
||||
{
|
||||
GisKeyboardPage *self = GIS_KEYBOARD_PAGE (page);
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
@@ -336,82 +336,82 @@ gis_keyboard_page_skip (GisPage *page)
|
||||
priv->should_skip = TRUE;
|
||||
|
||||
if (priv->default_input_source_ids != NULL)
|
||||
add_default_input_sources (self);
|
||||
}
|
||||
|
||||
static void
|
||||
preselect_input_source (GisKeyboardPage *self)
|
||||
{
|
||||
const char *language = NULL;
|
||||
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
|
||||
language = cc_common_language_get_current_language ();
|
||||
|
||||
/* We deduce the initial input source from language if we're in a system mode
|
||||
* (where preexisting system configuration may be stale) or if the language
|
||||
* requires an input method (because there is no way for system configuration
|
||||
* to denote the need for an input method)
|
||||
*
|
||||
* If it's a non-system mode we can trust the system configuration is probably
|
||||
* a better bet than a heuristic based on locale.
|
||||
*/
|
||||
if (language != NULL) {
|
||||
gboolean got_input_source;
|
||||
const char *id, *type;
|
||||
|
||||
got_input_source = gnome_get_input_source_from_locale (language, &type, &id);
|
||||
|
||||
if (got_input_source) {
|
||||
- gboolean is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) == GIS_DRIVER_MODE_NEW_USER;
|
||||
+ gboolean is_system_mode = gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM;
|
||||
if (is_system_mode || g_str_equal (type, "ibus")) {
|
||||
cc_input_chooser_set_input (CC_INPUT_CHOOSER (priv->input_chooser),
|
||||
id,
|
||||
type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cc_input_chooser_set_input (CC_INPUT_CHOOSER (priv->input_chooser),
|
||||
priv->default_input_source_ids[0],
|
||||
priv->default_input_source_types[0]);
|
||||
}
|
||||
|
||||
static void
|
||||
update_page_complete (GisKeyboardPage *self)
|
||||
{
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
gboolean complete;
|
||||
|
||||
- if (gis_driver_get_mode (GIS_PAGE (self)->driver) == GIS_DRIVER_MODE_NEW_USER) {
|
||||
+ if (gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM) {
|
||||
complete = (priv->localed != NULL &&
|
||||
cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)) != NULL);
|
||||
} else {
|
||||
complete = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)) != NULL;
|
||||
}
|
||||
|
||||
gis_page_set_complete (GIS_PAGE (self), complete);
|
||||
}
|
||||
|
||||
static void
|
||||
localed_proxy_ready (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer data)
|
||||
{
|
||||
GisKeyboardPage *self = data;
|
||||
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
||||
GDBusProxy *proxy;
|
||||
GError *error = NULL;
|
||||
|
||||
proxy = g_dbus_proxy_new_finish (res, &error);
|
||||
|
||||
if (!proxy) {
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
g_warning ("Failed to contact localed: %s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
priv->localed = proxy;
|
||||
update_page_complete (self);
|
||||
@@ -469,61 +469,61 @@ static void
|
||||
gis_keyboard_page_constructed (GObject *object)
|
||||
{
|
@ -1,8 +1,7 @@
|
||||
From c83990dee352f8ba86ae4bfeaa1bef75f666fe37 Mon Sep 17 00:00:00 2001
|
||||
From 53f42c970a1233c84dcc80667a096eb428f27592 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Wed, 16 Aug 2023 10:47:13 -0400
|
||||
Subject: [PATCH 09/12] initial-setup: Don't show duplicated pages between
|
||||
modes
|
||||
Subject: [PATCH 7/9] initial-setup: Don't show duplicated pages between modes
|
||||
|
||||
It's possible a user just got asked questions in live mode
|
||||
before install that they'll then get asked again on first
|
||||
@ -468,7 +467,7 @@ index bc7a4ee9..2bd2d375 100644
|
||||
return (g_getenv ("UNDER_JHBUILD") != NULL);
|
||||
}
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 28cf7998..4c294dfe 100644
|
||||
index 7dd876e3..7058e6cf 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -1,59 +1,63 @@
|
||||
@ -508,8 +507,8 @@ index 28cf7998..4c294dfe 100644
|
||||
conf.set('SECRET_API_SUBJECT_TO_CHANGE', true)
|
||||
conf.set_quoted('G_LOG_DOMAIN', 'InitialSetup')
|
||||
conf.set('G_LOG_USE_STRUCTURED', true)
|
||||
conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_70')
|
||||
conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_70')
|
||||
conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_76')
|
||||
conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_76')
|
||||
|
||||
enable_systemd = get_option('systemd')
|
||||
if enable_systemd
|
@ -1,7 +1,7 @@
|
||||
From d5f1a3c01aee9249a3ba6fea15fcea43eb690ed1 Mon Sep 17 00:00:00 2001
|
||||
From 2706720a58dba752ca0dbc65d7f1425df7db3bda Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Sun, 13 Aug 2023 16:33:49 -0400
|
||||
Subject: [PATCH 11/12] polkit: Add fedora specfic rules
|
||||
Subject: [PATCH 8/9] polkit: Add fedora specfic rules
|
||||
|
||||
We should probably add some way to check vendor.conf for the policy
|
||||
updates instead of a hardcoded list.
|
@ -1,7 +1,7 @@
|
||||
From 80488c36ed74902de7a2d4a34bd1e7f7ccaa2964 Mon Sep 17 00:00:00 2001
|
||||
From d42637a6f59981bac75a55eaee8fd1fc3b251e02 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Tue, 22 Aug 2023 13:51:40 -0400
|
||||
Subject: [PATCH 12/12] gnome-initial-setup: Read /etc/sysconfig/anaconda
|
||||
Subject: [PATCH 9/9] gnome-initial-setup: Read /etc/sysconfig/anaconda
|
||||
|
||||
Just as /var/lib/gnome-initial-setup/state may show pages the user has
|
||||
already answered, on Fedora, /etc/sysconfig/anaconda shows pages the user has
|
||||
@ -13,10 +13,10 @@ This commit skips those from the --new-user mode as well.
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
|
||||
index 6fe57017..f9b3923f 100644
|
||||
index 2bd2d375..474dfc58 100644
|
||||
--- a/gnome-initial-setup/gnome-initial-setup.c
|
||||
+++ b/gnome-initial-setup/gnome-initial-setup.c
|
||||
@@ -172,72 +172,95 @@ pages_to_skip_from_file (GisDriver *driver)
|
||||
@@ -171,72 +171,95 @@ pages_to_skip_from_file (GisDriver *driver)
|
||||
g_strv_builder_addv (builder, (const char **) skip_pages);
|
||||
g_clear_pointer (&skip_pages, g_strfreev);
|
||||
}
|
@ -1,350 +0,0 @@
|
||||
From 117c0451e7db296c62461944a254d2dcbc1b390f Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Sun, 13 Aug 2023 10:30:11 -0400
|
||||
Subject: [PATCH 10/12] gnome-initial-setup: Add OEM mode
|
||||
|
||||
OEM mode is designed to get run when a site has imaged a bunch
|
||||
of machines, and handed them off to the user.
|
||||
|
||||
In this scenario, the user never saw the installer, so we need to
|
||||
ask the user questions that the installer would have normally
|
||||
asked them already.
|
||||
|
||||
For example, the installer likely asks language, but if the user
|
||||
never saw the installer, then we need to ask language again.
|
||||
---
|
||||
gnome-initial-setup/gis-driver.c | 1 +
|
||||
gnome-initial-setup/gis-driver.h | 5 +++--
|
||||
gnome-initial-setup/gnome-initial-setup.c | 22 ++++++++++++++--------
|
||||
3 files changed, 18 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
|
||||
index 41cd6e38..55b2493c 100644
|
||||
--- a/gnome-initial-setup/gis-driver.c
|
||||
+++ b/gnome-initial-setup/gis-driver.c
|
||||
@@ -20,60 +20,61 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gnome-initial-setup.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_WEBKITGTK_6_0
|
||||
#include <webkit/webkit.h>
|
||||
#else
|
||||
#include <webkit2/webkit2.h>
|
||||
#endif
|
||||
|
||||
#include "cc-common-language.h"
|
||||
#include "gis-assistant.h"
|
||||
|
||||
/* Statically include this for now. Maybe later
|
||||
* we'll generate this from glib-mkenums. */
|
||||
GType
|
||||
gis_driver_mode_get_type (void) {
|
||||
static GType enum_type_id = 0;
|
||||
if (G_UNLIKELY (!enum_type_id))
|
||||
{
|
||||
static const GFlagsValue values[] = {
|
||||
{ GIS_DRIVER_MODE_NEW_USER, "GIS_DRIVER_MODE_NEW_USER", "new_user" },
|
||||
{ GIS_DRIVER_MODE_EXISTING_USER, "GIS_DRIVER_MODE_EXISTING_USER", "existing_user" },
|
||||
{ GIS_DRIVER_MODE_LIVE_USER, "GIS_DRIVER_MODE_LIVE_USER", "live_user" },
|
||||
+ { GIS_DRIVER_MODE_OEM, "GIS_DRIVER_MODE_OEM", "oem" },
|
||||
{ GIS_DRIVER_MODE_SYSTEM, "GIS_DRIVER_MODE_SYSTEM", "system" },
|
||||
{ GIS_DRIVER_MODE_ALL, "GIS_DRIVER_MODE_ALL", "all" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
enum_type_id = g_flags_register_static("GisDriverMode", values);
|
||||
}
|
||||
return enum_type_id;
|
||||
}
|
||||
|
||||
enum {
|
||||
REBUILD_PAGES,
|
||||
LOCALE_CHANGED,
|
||||
LAST_SIGNAL,
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL];
|
||||
|
||||
typedef enum {
|
||||
PROP_MODE = 1,
|
||||
PROP_USERNAME,
|
||||
PROP_SMALL_SCREEN,
|
||||
PROP_PARENTAL_CONTROLS_ENABLED,
|
||||
PROP_FULL_NAME,
|
||||
PROP_AVATAR,
|
||||
} GisDriverProperty;
|
||||
|
||||
static GParamSpec *obj_props[PROP_AVATAR + 1];
|
||||
|
||||
struct _GisDriver {
|
||||
AdwApplication parent_instance;
|
||||
diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h
|
||||
index aedb9a73..49639bef 100644
|
||||
--- a/gnome-initial-setup/gis-driver.h
|
||||
+++ b/gnome-initial-setup/gis-driver.h
|
||||
@@ -18,62 +18,63 @@
|
||||
* Written by:
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
*/
|
||||
|
||||
#ifndef __GIS_DRIVER_H__
|
||||
#define __GIS_DRIVER_H__
|
||||
|
||||
#include "gis-assistant.h"
|
||||
#include "gis-page.h"
|
||||
#include <act/act-user-manager.h>
|
||||
#include <gdm/gdm-client.h>
|
||||
#include <adwaita.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GIS_TYPE_DRIVER (gis_driver_get_type ())
|
||||
#define GIS_TYPE_DRIVER_MODE (gis_driver_mode_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GisDriver, gis_driver, GIS, DRIVER, AdwApplication)
|
||||
|
||||
typedef enum {
|
||||
UM_LOCAL,
|
||||
UM_ENTERPRISE,
|
||||
NUM_MODES,
|
||||
} UmAccountMode;
|
||||
|
||||
typedef enum {
|
||||
GIS_DRIVER_MODE_NEW_USER = 1 << 0,
|
||||
GIS_DRIVER_MODE_EXISTING_USER = 1 << 1,
|
||||
GIS_DRIVER_MODE_LIVE_USER = 1 << 2,
|
||||
- GIS_DRIVER_MODE_SYSTEM = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER),
|
||||
- GIS_DRIVER_MODE_ALL = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_LIVE_USER),
|
||||
+ GIS_DRIVER_MODE_OEM = 1 << 3,
|
||||
+ GIS_DRIVER_MODE_SYSTEM = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM),
|
||||
+ GIS_DRIVER_MODE_ALL = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM),
|
||||
} GisDriverMode;
|
||||
|
||||
GType gis_driver_mode_get_type (void);
|
||||
|
||||
GisAssistant *gis_driver_get_assistant (GisDriver *driver);
|
||||
|
||||
void gis_driver_set_user_permissions (GisDriver *driver,
|
||||
ActUser *user,
|
||||
const gchar *password);
|
||||
|
||||
void gis_driver_get_user_permissions (GisDriver *driver,
|
||||
ActUser **user,
|
||||
const gchar **password);
|
||||
|
||||
void gis_driver_set_parent_permissions (GisDriver *driver,
|
||||
ActUser *parent,
|
||||
const gchar *password);
|
||||
|
||||
void gis_driver_get_parent_permissions (GisDriver *driver,
|
||||
ActUser **parent,
|
||||
const gchar **password);
|
||||
|
||||
void gis_driver_set_account_mode (GisDriver *driver,
|
||||
UmAccountMode mode);
|
||||
|
||||
UmAccountMode gis_driver_get_account_mode (GisDriver *driver);
|
||||
|
||||
void gis_driver_set_parental_controls_enabled (GisDriver *driver,
|
||||
gboolean parental_controls_enabled);
|
||||
|
||||
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
|
||||
index 2bd2d375..6fe57017 100644
|
||||
--- a/gnome-initial-setup/gnome-initial-setup.c
|
||||
+++ b/gnome-initial-setup/gnome-initial-setup.c
|
||||
@@ -26,90 +26,91 @@
|
||||
#include <adwaita.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "pages/welcome/gis-welcome-page.h"
|
||||
#include "pages/language/gis-language-page.h"
|
||||
#include "pages/keyboard/gis-keyboard-page.h"
|
||||
#include "pages/network/gis-network-page.h"
|
||||
#include "pages/timezone/gis-timezone-page.h"
|
||||
#include "pages/privacy/gis-privacy-page.h"
|
||||
#include "pages/software/gis-software-page.h"
|
||||
#include "pages/goa/gis-goa-page.h"
|
||||
#include "pages/account/gis-account-pages.h"
|
||||
#include "pages/parental-controls/gis-parental-controls-page.h"
|
||||
#include "pages/password/gis-password-page.h"
|
||||
#include "pages/summary/gis-summary-page.h"
|
||||
#include "pages/install/gis-install-page.h"
|
||||
|
||||
#define VENDOR_PAGES_GROUP "pages"
|
||||
#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_LIVE_USER_ONLY_KEY "live_user_only"
|
||||
|
||||
#define STATE_FILE GIS_WORKING_DIR "/state"
|
||||
|
||||
static gboolean force_existing_user_mode;
|
||||
static gboolean force_live_user_mode;
|
||||
+static gboolean force_oem_mode;
|
||||
|
||||
static GPtrArray *skipped_pages;
|
||||
|
||||
typedef GisPage *(*PreparePage) (GisDriver *driver);
|
||||
|
||||
typedef struct {
|
||||
const gchar *page_id;
|
||||
PreparePage prepare_page_func;
|
||||
GisDriverMode modes;
|
||||
} PageData;
|
||||
|
||||
#define PAGE(name, modes) { #name, gis_prepare_ ## name ## _page, modes }
|
||||
|
||||
static PageData page_table[] = {
|
||||
PAGE (welcome, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER),
|
||||
PAGE (language, GIS_DRIVER_MODE_ALL),
|
||||
PAGE (keyboard, GIS_DRIVER_MODE_ALL),
|
||||
PAGE (network, GIS_DRIVER_MODE_ALL),
|
||||
- PAGE (privacy, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER),
|
||||
+ PAGE (privacy, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM),
|
||||
PAGE (timezone, GIS_DRIVER_MODE_ALL),
|
||||
- PAGE (software, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER),
|
||||
- PAGE (goa, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER),
|
||||
+ PAGE (software, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM),
|
||||
+ PAGE (goa, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM),
|
||||
/* In live user mode, the account page isn't displayed, it just quietly creates the live user */
|
||||
- PAGE (account, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER),
|
||||
- PAGE (password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER),
|
||||
+ PAGE (account, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM),
|
||||
+ PAGE (password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM),
|
||||
#ifdef HAVE_PARENTAL_CONTROLS
|
||||
- PAGE (parental_controls, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER),
|
||||
- PAGE (parent_password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER),
|
||||
+ PAGE (parental_controls, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM),
|
||||
+ PAGE (parent_password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM),
|
||||
#endif
|
||||
- PAGE (summary, GIS_DRIVER_MODE_NEW_USER),
|
||||
+ PAGE (summary, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_OEM),
|
||||
PAGE (install, GIS_DRIVER_MODE_LIVE_USER),
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
#undef PAGE
|
||||
|
||||
static gboolean
|
||||
should_skip_page (const gchar *page_id,
|
||||
gchar **skip_pages)
|
||||
{
|
||||
guint i = 0;
|
||||
|
||||
/* special case welcome. We only want to show it if language
|
||||
* is skipped
|
||||
*/
|
||||
if (strcmp (page_id, "welcome") == 0)
|
||||
return !should_skip_page ("language", skip_pages);
|
||||
|
||||
/* check through our skip pages list for pages we don't want */
|
||||
if (skip_pages) {
|
||||
while (skip_pages[i]) {
|
||||
if (g_strcmp0 (skip_pages[i], page_id) == 0)
|
||||
return TRUE;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -315,81 +316,86 @@ static gboolean
|
||||
initial_setup_disabled_by_anaconda (void)
|
||||
{
|
||||
const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda";
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GKeyFile) key_file = g_key_file_new ();
|
||||
|
||||
if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) {
|
||||
if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
|
||||
!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
|
||||
g_warning ("Could not read %s: %s", file_name, error->message);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return g_key_file_get_boolean (key_file, "General", "post_install_tools_disabled", NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GisDriver *driver;
|
||||
int status;
|
||||
GOptionContext *context;
|
||||
GisDriverMode mode;
|
||||
|
||||
GOptionEntry entries[] = {
|
||||
{ "existing-user", 0, 0, G_OPTION_ARG_NONE, &force_existing_user_mode,
|
||||
_("Force existing user mode"), NULL },
|
||||
{ "live-user", 0, 0, G_OPTION_ARG_NONE, &force_live_user_mode,
|
||||
_("Force live user mode"), NULL },
|
||||
+ { "oem", 0, 0, G_OPTION_ARG_NONE, &force_oem_mode,
|
||||
+ _("Force OEM mode"), NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
g_unsetenv ("GIO_USE_VFS");
|
||||
|
||||
/* By default, libadwaita reads settings from the Settings portal, which causes
|
||||
* the portal to be started, which causes gnome-keyring to be started. This
|
||||
* interferes with our attempt below to manually start gnome-keyring and set
|
||||
* the login keyring password to a well-known value, which we overwrite with
|
||||
* the user's password once they choose one.
|
||||
*/
|
||||
g_setenv ("ADW_DISABLE_PORTAL", "1", TRUE);
|
||||
|
||||
context = g_option_context_new (_("— GNOME initial setup"));
|
||||
g_option_context_add_main_entries (context, entries, NULL);
|
||||
|
||||
g_option_context_parse (context, &argc, &argv, NULL);
|
||||
|
||||
if (gis_kernel_command_line_has_argument ((const char *[]) { "rd.live.image", "endless.live_boot", NULL }))
|
||||
force_live_user_mode = TRUE;
|
||||
|
||||
+ if (gis_kernel_command_line_has_argument ((const char *[]) { "gnome.oem_mode", NULL }))
|
||||
+ force_oem_mode = TRUE;
|
||||
+
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
g_message ("Starting gnome-initial-setup");
|
||||
if (gis_get_mock_mode ())
|
||||
g_message ("Mock mode: changes will not be saved to disk");
|
||||
else
|
||||
g_message ("Production mode: changes will be saved to disk");
|
||||
|
||||
skipped_pages = g_ptr_array_new_with_free_func (destroy_page);
|
||||
mode = get_mode ();
|
||||
|
||||
/* When we are running as the gnome-initial-setup user we
|
||||
* dont have a normal user session and need to initialize
|
||||
* the keyring manually so that we can pass the credentials
|
||||
* along to the new user in the handoff.
|
||||
*/
|
||||
if ((mode & GIS_DRIVER_MODE_SYSTEM) && !gis_get_mock_mode ())
|
||||
gis_ensure_login_keyring ();
|
||||
|
||||
driver = gis_driver_new (mode);
|
||||
adw_style_manager_set_color_scheme (adw_style_manager_get_default (),
|
||||
ADW_COLOR_SCHEME_PREFER_LIGHT);
|
||||
|
||||
/* On first login, GNOME Shell offers to run a tour. If we also run Initial
|
||||
* Setup, the two immovable, centred windows will sit atop one another.
|
||||
* Until we have the ability to run Initial Setup in the "kiosk" mode, like
|
||||
* it does in new-user mode, disable Initial Setup for existing users.
|
||||
*
|
||||
--
|
||||
2.41.0
|
||||
|
@ -17,18 +17,15 @@ URL: https://wiki.gnome.org/Design/OS/InitialSetup
|
||||
Source0: https://download.gnome.org/sources/%{name}/45/%{name}-%{tarball_version}.tar.xz
|
||||
Source1: vendor.conf
|
||||
|
||||
Patch: 0001-keyboard-stop-setting-current-input-source.patch
|
||||
Patch: 0002-keyboard-write-to-mru-sources-setting-if-it-has-neve.patch
|
||||
Patch: 0001-gnome-initial-setup-Bump-GLib-required-version-to-2..patch
|
||||
Patch: 0002-keyboard-Don-t-require-localed-for-existing-user-mod.patch
|
||||
Patch: 0003-language-Don-t-proceed-until-localed-has-set-locale.patch
|
||||
Patch: 0004-gnome-initial-setup-Bump-GLib-required-version-to-2..patch
|
||||
Patch: 0004-keyboard-Get-default-input-sources-from-gnome-deskto.patch
|
||||
Patch: 0005-driver-Specify-mode-via-flags-instead-of-boolean.patch
|
||||
Patch: 0006-keyboard-Don-t-require-localed-for-non-system-modes.patch
|
||||
Patch: 0007-keyboard-Get-default-input-sources-from-gnome-deskto.patch
|
||||
Patch: 0008-gnome-initial-setup-Add-live-user-mode.patch
|
||||
Patch: 0009-initial-setup-Don-t-show-duplicated-pages-between-mo.patch
|
||||
Patch: 0010-gnome-initial-setup-Add-OEM-mode.patch
|
||||
Patch: 0011-polkit-Add-fedora-specfic-rules.patch
|
||||
Patch: 0012-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch
|
||||
Patch: 0006-gnome-initial-setup-Add-live-user-mode.patch
|
||||
Patch: 0007-initial-setup-Don-t-show-duplicated-pages-between-mo.patch
|
||||
Patch: 0008-polkit-Add-fedora-specfic-rules.patch
|
||||
Patch: 0009-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch
|
||||
|
||||
|
||||
BuildRequires: desktop-file-utils
|
||||
|
Loading…
Reference in New Issue
Block a user