gdm/SOURCES/0004-daemon-handle-upgrades-from-RHEL-7.patch

139 lines
5.6 KiB
Diff
Raw Normal View History

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