|
|
f83012 |
From c673a7dd781da5ae0d64e13eb83c17e130231931 Mon Sep 17 00:00:00 2001
|
|
|
f83012 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
f83012 |
Date: Mon, 20 Aug 2018 14:30:59 -0400
|
|
|
f83012 |
Subject: [PATCH 4/4] daemon: handle upgrades from RHEL 7
|
|
|
f83012 |
|
|
|
f83012 |
RHEL 7 users need to stay on X if they were using X,
|
|
|
f83012 |
and they need to stay on gnome-classic if they were using
|
|
|
f83012 |
gnome-classic.
|
|
|
f83012 |
|
|
|
f83012 |
This commit examines the user's config to deduce whether
|
|
|
f83012 |
or not they were using RHEL 7 and in the event they were
|
|
|
f83012 |
try to get the right settings.
|
|
|
f83012 |
---
|
|
|
f83012 |
daemon/gdm-session-settings.c | 19 +++++++++++++++++++
|
|
|
f83012 |
1 file changed, 19 insertions(+)
|
|
|
f83012 |
|
|
|
f83012 |
diff --git a/daemon/gdm-session-settings.c b/daemon/gdm-session-settings.c
|
|
|
f83012 |
index 921e4d501..0ce2e7de2 100644
|
|
|
f83012 |
--- a/daemon/gdm-session-settings.c
|
|
|
f83012 |
+++ b/daemon/gdm-session-settings.c
|
|
|
f83012 |
@@ -270,95 +270,114 @@ gdm_session_settings_get_property (GObject *object,
|
|
|
f83012 |
|
|
|
f83012 |
default:
|
|
|
f83012 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
f83012 |
}
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
GdmSessionSettings *
|
|
|
f83012 |
gdm_session_settings_new (void)
|
|
|
f83012 |
{
|
|
|
f83012 |
GdmSessionSettings *settings;
|
|
|
f83012 |
|
|
|
f83012 |
settings = g_object_new (GDM_TYPE_SESSION_SETTINGS,
|
|
|
f83012 |
NULL);
|
|
|
f83012 |
|
|
|
f83012 |
return settings;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
gboolean
|
|
|
f83012 |
gdm_session_settings_is_loaded (GdmSessionSettings *settings)
|
|
|
f83012 |
{
|
|
|
f83012 |
if (settings->priv->user == NULL) {
|
|
|
f83012 |
return FALSE;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
return act_user_is_loaded (settings->priv->user);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
load_settings_from_user (GdmSessionSettings *settings)
|
|
|
f83012 |
{
|
|
|
f83012 |
+ const char *system_id = NULL, *system_version_id = NULL;
|
|
|
f83012 |
const char *object_path;
|
|
|
f83012 |
const char *session_name;
|
|
|
f83012 |
const char *session_type;
|
|
|
f83012 |
const char *language_name;
|
|
|
f83012 |
|
|
|
f83012 |
if (!act_user_is_loaded (settings->priv->user)) {
|
|
|
f83012 |
g_warning ("GdmSessionSettings: trying to load user settings from unloaded user");
|
|
|
f83012 |
return;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
object_path = act_user_get_object_path (settings->priv->user);
|
|
|
f83012 |
|
|
|
f83012 |
if (object_path != NULL) {
|
|
|
f83012 |
g_autoptr (GError) error = NULL;
|
|
|
f83012 |
settings->priv->user_system_proxy = gdm_accounts_service_user_system_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
|
|
f83012 |
G_DBUS_PROXY_FLAGS_NONE,
|
|
|
f83012 |
"org.freedesktop.Accounts",
|
|
|
f83012 |
object_path,
|
|
|
f83012 |
NULL,
|
|
|
f83012 |
&error);
|
|
|
f83012 |
if (error != NULL) {
|
|
|
f83012 |
g_debug ("GdmSessionSettings: couldn't retrieve user system proxy from accountsservice: %s",
|
|
|
f83012 |
error->message);
|
|
|
f83012 |
+ } else {
|
|
|
f83012 |
+ system_id = gdm_accounts_service_user_system_get_id (settings->priv->user_system_proxy);
|
|
|
f83012 |
+ system_version_id = gdm_accounts_service_user_system_get_version_id (settings->priv->user_system_proxy);
|
|
|
f83012 |
}
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
/* if the user doesn't have saved state, they don't have any settings worth reading */
|
|
|
f83012 |
if (!act_user_get_saved (settings->priv->user))
|
|
|
f83012 |
goto out;
|
|
|
f83012 |
|
|
|
f83012 |
session_type = act_user_get_session_type (settings->priv->user);
|
|
|
f83012 |
session_name = act_user_get_session (settings->priv->user);
|
|
|
f83012 |
|
|
|
f83012 |
g_debug ("GdmSessionSettings: saved session is %s (type %s)", session_name, session_type);
|
|
|
f83012 |
|
|
|
f83012 |
+ if (system_id == NULL || (g_strcmp0 (system_id, "rhel") == 0 && g_str_has_prefix (system_version_id, "7."))) {
|
|
|
f83012 |
+ /* if there's also no session name in the file and we're coming from RHEL 7,
|
|
|
f83012 |
+ * then we should assume classic session
|
|
|
f83012 |
+ */
|
|
|
f83012 |
+ if (session_name == NULL || session_name[0] == '\0')
|
|
|
f83012 |
+ session_name = "gnome-classic";
|
|
|
f83012 |
+
|
|
|
f83012 |
+ /* only presume wayland if the user specifically picked it in RHEL 7
|
|
|
f83012 |
+ */
|
|
|
f83012 |
+ if (g_strcmp0 (session_name, "gnome-wayland") == 0)
|
|
|
f83012 |
+ session_type = "wayland";
|
|
|
f83012 |
+ else
|
|
|
f83012 |
+ session_type = "x11";
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+
|
|
|
f83012 |
if (session_type != NULL && session_type[0] != '\0') {
|
|
|
f83012 |
gdm_session_settings_set_session_type (settings, session_type);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
if (session_name != NULL && session_name[0] != '\0') {
|
|
|
f83012 |
gdm_session_settings_set_session_name (settings, session_name);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
language_name = act_user_get_language (settings->priv->user);
|
|
|
f83012 |
|
|
|
f83012 |
g_debug ("GdmSessionSettings: saved language is %s", language_name);
|
|
|
f83012 |
if (language_name != NULL && language_name[0] != '\0') {
|
|
|
f83012 |
gdm_session_settings_set_language_name (settings, language_name);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
out:
|
|
|
f83012 |
g_object_notify (G_OBJECT (settings), "is-loaded");
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
on_user_is_loaded_changed (ActUser *user,
|
|
|
f83012 |
GParamSpec *pspec,
|
|
|
f83012 |
GdmSessionSettings *settings)
|
|
|
f83012 |
{
|
|
|
f83012 |
if (act_user_is_loaded (settings->priv->user)) {
|
|
|
f83012 |
load_settings_from_user (settings);
|
|
|
f83012 |
g_signal_handlers_disconnect_by_func (G_OBJECT (settings->priv->user),
|
|
|
f83012 |
G_CALLBACK (on_user_is_loaded_changed),
|
|
|
f83012 |
settings);
|
|
|
f83012 |
}
|
|
|
f83012 |
--
|
|
|
f83012 |
2.17.1
|
|
|
f83012 |
|