[gdm] gdm-session: support XDG_CURRENT_DESKTOP



commit af384da3c72efee40dcba48bb0e3e2ad6a08f6e4
Author: Lars Uebernickel <lars uebernickel canonical com>
Date:   Thu Apr 3 15:58:53 2014 +0200

    gdm-session: support XDG_CURRENT_DESKTOP
    
    Set XDG_CURRENT_DESKTOP when DesktopNames is set in the session file.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727546

 daemon/gdm-session.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index e210678..723aecd 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -2242,6 +2242,32 @@ get_session_command (GdmSession *self)
         return command;
 }
 
+static gchar *
+get_session_desktop_names (GdmSession *self)
+{
+        gchar *filename;
+        GKeyFile *keyfile;
+        gchar *desktop_names = NULL;
+
+        filename = g_strdup_printf ("%s.desktop", get_session_name (self));
+        keyfile = load_key_file_for_file (filename, NULL);
+        if (keyfile != NULL) {
+              gchar **names;
+
+              names = g_key_file_get_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP,
+                                                  "DesktopNames", NULL, NULL);
+              if (names != NULL) {
+                      desktop_names = g_strjoinv (":", names);
+
+                      g_strfreev (names);
+              }
+        }
+
+        g_key_file_free (keyfile);
+        g_free (filename);
+        return desktop_names;
+}
+
 void
 gdm_session_set_environment_variable (GdmSession *self,
                                       const char *key,
@@ -2282,6 +2308,8 @@ set_up_session_language (GdmSession *self)
 static void
 set_up_session_environment (GdmSession *self)
 {
+        gchar *desktop_names;
+
         gdm_session_set_environment_variable (self,
                                               "GDMSESSION",
                                               get_session_name (self));
@@ -2292,6 +2320,11 @@ set_up_session_environment (GdmSession *self)
                                               "XDG_SESSION_DESKTOP",
                                               get_session_name (self));
 
+        desktop_names = get_session_desktop_names (self);
+        if (desktop_names != NULL) {
+                gdm_session_set_environment_variable (self, "XDG_CURRENT_DESKTOP", desktop_names);
+        }
+
         set_up_session_language (self);
 
         gdm_session_set_environment_variable (self,
@@ -2309,6 +2342,8 @@ set_up_session_environment (GdmSession *self)
                                                       "WINDOWPATH",
                                                       g_getenv ("WINDOWPATH"));
         }
+
+        g_free (desktop_names);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]