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

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