LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gdm-desktop-session-env-pam.patch of Package gdm (Project GNOME:Factory)

Index: gdm-3.5.91/daemon/gdm-session-worker.c
===================================================================
--- gdm-3.5.91.orig/daemon/gdm-session-worker.c
+++ gdm-3.5.91/daemon/gdm-session-worker.c
@@ -159,6 +159,8 @@ struct GdmSessionWorkerPrivate
         GdmSessionSettings *user_settings;
 
         GDBusMethodInvocation *pending_invocation;
+
+        char               *suse_session_name;
 };
 
 enum {
@@ -1115,6 +1117,9 @@ gdm_session_worker_initialize_pam (GdmSe
         }
 #endif
 
+        if (worker->priv->suse_session_name)
+                gdm_session_worker_set_environment_variable (worker, "DESKTOP_SESSION", worker->priv->suse_session_name);
+
         g_debug ("GdmSessionWorker: state SETUP_COMPLETE");
         worker->priv->state = GDM_SESSION_WORKER_STATE_SETUP_COMPLETE;
 
@@ -2035,12 +2040,36 @@ gdm_session_worker_handle_set_session_na
 {
         GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
         g_debug ("GdmSessionWorker: session name set to %s", session_name);
+
+        if (worker->priv->pam_handle != NULL)
+                gdm_session_worker_set_environment_variable (worker, "DESKTOP_SESSION", session_name);
+        g_free (worker->priv->suse_session_name);
+        worker->priv->suse_session_name = g_strdup (session_name);
+
         gdm_session_settings_set_session_name (worker->priv->user_settings,
                                                session_name);
         gdm_dbus_worker_complete_set_session_name (object, invocation);
         return TRUE;
 }
 
+static gboolean
+gdm_session_worker_handle_set_default_session_name (GdmDBusWorker         *object,
+                                                    GDBusMethodInvocation *invocation,
+                                                    const char            *session_name)
+{
+        GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
+        g_debug ("GdmSessionWorker: default session name set to %s", session_name);
+
+        if (worker->priv->pam_handle != NULL)
+                gdm_session_worker_set_environment_variable (worker, "DESKTOP_SESSION", session_name);
+        g_free (worker->priv->suse_session_name);
+        worker->priv->suse_session_name = g_strdup (session_name);
+
+        gdm_dbus_worker_complete_set_default_session_name (object, invocation);
+        return TRUE;
+}
+
+
 static gboolean
 gdm_session_worker_handle_set_session_type (GdmDBusWorker         *object,
                                             GDBusMethodInvocation *invocation,
@@ -2831,6 +2860,7 @@ worker_interface_init (GdmDBusWorkerIfac
         interface->handle_open = gdm_session_worker_handle_open;
         interface->handle_set_language_name = gdm_session_worker_handle_set_language_name;
         interface->handle_set_session_name = gdm_session_worker_handle_set_session_name;
+        interface->handle_set_default_session_name = gdm_session_worker_handle_set_default_session_name;
         interface->handle_set_session_type = gdm_session_worker_handle_set_session_type;
         interface->handle_set_environment_variable = gdm_session_worker_handle_set_environment_variable;
         interface->handle_start_program = gdm_session_worker_handle_start_program;
@@ -2943,6 +2973,8 @@ gdm_session_worker_finalize (GObject *ob
 
         g_hash_table_unref (worker->priv->reauthentication_requests);
 
+        g_free (worker->priv->suse_session_name);
+
         G_OBJECT_CLASS (gdm_session_worker_parent_class)->finalize (object);
 }
 
Index: gdm-3.5.91/daemon/gdm-session-worker.xml
===================================================================
--- gdm-3.5.91.orig/daemon/gdm-session-worker.xml
+++ gdm-3.5.91/daemon/gdm-session-worker.xml
@@ -13,6 +13,9 @@
     <method name="SetSessionName">
       <arg name="session_name" direction="in" type="s" />
     </method>
+    <method name="SetDefaultSessionName">
+      <arg name="default_session_name" direction="in" type="s"/>
+    </method>
     <method name="SetSessionType">
       <arg name="session_type" direction="in" type="s"/>
     </method>
Index: gdm-3.5.91/daemon/gdm-session.c
===================================================================
--- gdm-3.5.91.orig/daemon/gdm-session.c
+++ gdm-3.5.91/daemon/gdm-session.c
@@ -162,6 +162,8 @@ G_DEFINE_TYPE (GdmSession,
                gdm_session,
                G_TYPE_OBJECT);
 
+static const char *get_session_name (GdmSession *self);
+
 static GdmSessionConversation *
 find_conversation_by_name (GdmSession *self,
                            const char *service_name)
@@ -598,6 +600,9 @@ get_default_session_name (GdmSession *se
 static void
 gdm_session_defaults_changed (GdmSession *self)
 {
+        GHashTableIter iter;
+        gpointer key, value;
+        const char *text;
 
         if (self->priv->greeter_interface != NULL) {
                 gdm_dbus_greeter_emit_default_language_name_changed (self->priv->greeter_interface,
@@ -605,6 +610,19 @@ gdm_session_defaults_changed (GdmSession
                 gdm_dbus_greeter_emit_default_session_name_changed (self->priv->greeter_interface,
                                                                     get_default_session_name (self));
         }
+
+        text = get_session_name (self);
+
+        g_hash_table_iter_init (&iter, self->priv->conversations);
+        while (g_hash_table_iter_next (&iter, &key, &value)) {
+                GdmSessionConversation *conversation;
+
+                conversation = (GdmSessionConversation *) value;
+
+                gdm_dbus_worker_call_set_default_session_name (conversation->worker_proxy,
+                                                               text,
+                                                               NULL, NULL, NULL);
+        }
 }
 
 void
@@ -910,6 +928,10 @@ worker_on_saved_session_name_read (GdmDB
 
         if (strcmp (session_name,
                     get_default_session_name (self)) != 0) {
+                GHashTableIter iter;
+                gpointer key, value;
+                const char *text;
+
                 g_free (self->priv->saved_session);
                 self->priv->saved_session = g_strdup (session_name);
 
@@ -917,6 +939,19 @@ worker_on_saved_session_name_read (GdmDB
                         gdm_dbus_greeter_emit_default_session_name_changed (self->priv->greeter_interface,
                                                                             session_name);
                 }
+
+                text = get_session_name (self);
+
+                g_hash_table_iter_init (&iter, self->priv->conversations);
+                while (g_hash_table_iter_next (&iter, &key, &value)) {
+                        GdmSessionConversation *conversation;
+
+                        conversation = (GdmSessionConversation *) value;
+
+                        gdm_dbus_worker_call_set_default_session_name (conversation->worker_proxy,
+                                                                       text,
+                                                                       NULL, NULL, NULL);
+                }
         }
 }