Blame SOURCES/0002-daemon-Don-t-update-session-type-if-no-saved-session.patch

4e44f9
From b09ab8a73d5a4133f72846d529bbbfb7802ca535 Mon Sep 17 00:00:00 2001
4e44f9
From: Ray Strode <rstrode@redhat.com>
4e44f9
Date: Mon, 6 Sep 2021 08:40:46 -0400
4e44f9
Subject: [PATCH 2/5] daemon: Don't update session type if no saved session
4e44f9
4e44f9
At the moment we always set the session type when the session name
4e44f9
is read. But users don't always have a session type specified.
4e44f9
4e44f9
If they don't, then don't set the session type.
4e44f9
4e44f9
https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/153
4e44f9
---
4e44f9
 daemon/gdm-session.c | 23 +++++++++++++----------
4e44f9
 1 file changed, 13 insertions(+), 10 deletions(-)
4e44f9
4e44f9
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
4e44f9
index 2b941e5e..b54687d5 100644
4e44f9
--- a/daemon/gdm-session.c
4e44f9
+++ b/daemon/gdm-session.c
4e44f9
@@ -995,73 +995,76 @@ worker_on_reauthenticated (GdmDBusWorker          *worker,
4e44f9
 static void
4e44f9
 worker_on_saved_language_name_read (GdmDBusWorker          *worker,
4e44f9
                                     const char             *language_name,
4e44f9
                                     GdmSessionConversation *conversation)
4e44f9
 {
4e44f9
         GdmSession *self = conversation->session;
4e44f9
 
4e44f9
         if (strlen (language_name) > 0) {
4e44f9
                 g_free (self->saved_language);
4e44f9
                 self->saved_language = g_strdup (language_name);
4e44f9
 
4e44f9
                 if (self->greeter_interface != NULL) {
4e44f9
                         gdm_dbus_greeter_emit_default_language_name_changed (self->greeter_interface,
4e44f9
                                                                              language_name);
4e44f9
                 }
4e44f9
         }
4e44f9
 }
4e44f9
 
4e44f9
 static void
4e44f9
 worker_on_saved_session_name_read (GdmDBusWorker          *worker,
4e44f9
                                    const char             *session_name,
4e44f9
                                    GdmSessionConversation *conversation)
4e44f9
 {
4e44f9
         GdmSession *self = conversation->session;
4e44f9
 
4e44f9
         if (! get_session_command_for_name (self, session_name, self->saved_session_type, NULL)) {
4e44f9
                 /* ignore sessions that don't exist */
4e44f9
                 g_debug ("GdmSession: not using invalid .dmrc session: %s", session_name);
4e44f9
                 g_free (self->saved_session);
4e44f9
                 self->saved_session = NULL;
4e44f9
-        } else if (strcmp (session_name,
4e44f9
-                   get_default_session_name (self)) != 0) {
4e44f9
-                g_free (self->saved_session);
4e44f9
-                self->saved_session = g_strdup (session_name);
4e44f9
-
4e44f9
-                if (self->greeter_interface != NULL) {
4e44f9
-                        gdm_dbus_greeter_emit_default_session_name_changed (self->greeter_interface,
4e44f9
-                                                                            session_name);
4e44f9
+                update_session_type (self);
4e44f9
+        } else {
4e44f9
+                if (strcmp (session_name,
4e44f9
+                            get_default_session_name (self)) != 0) {
4e44f9
+                        g_free (self->saved_session);
4e44f9
+                        self->saved_session = g_strdup (session_name);
4e44f9
+
4e44f9
+                        if (self->greeter_interface != NULL) {
4e44f9
+                                gdm_dbus_greeter_emit_default_session_name_changed (self->greeter_interface,
4e44f9
+                                                                                    session_name);
4e44f9
+                        }
4e44f9
                 }
4e44f9
+                if (self->saved_session_type != NULL)
4e44f9
+                        set_session_type (self, self->saved_session_type);
4e44f9
         }
4e44f9
 
4e44f9
-        update_session_type (self);
4e44f9
-
4e44f9
 }
4e44f9
 
4e44f9
 static void
4e44f9
 worker_on_saved_session_type_read (GdmDBusWorker          *worker,
4e44f9
                                    const char             *session_type,
4e44f9
                                    GdmSessionConversation *conversation)
4e44f9
 {
4e44f9
         GdmSession *self = conversation->session;
4e44f9
 
4e44f9
         g_free (self->saved_session_type);
4e44f9
         self->saved_session_type = g_strdup (session_type);
4e44f9
 }
4e44f9
 
4e44f9
 static GdmSessionConversation *
4e44f9
 find_conversation_by_pid (GdmSession *self,
4e44f9
                           GPid        pid)
4e44f9
 {
4e44f9
         GHashTableIter iter;
4e44f9
         gpointer key, value;
4e44f9
 
4e44f9
         g_hash_table_iter_init (&iter, self->conversations);
4e44f9
         while (g_hash_table_iter_next (&iter, &key, &value)) {
4e44f9
                 GdmSessionConversation *conversation;
4e44f9
 
4e44f9
                 conversation = (GdmSessionConversation *) value;
4e44f9
 
4e44f9
                 if (conversation->worker_pid == pid) {
4e44f9
                         return conversation;
4e44f9
                 }
4e44f9
         }
4e44f9
-- 
4e44f9
2.34.1
4e44f9