[gdm/wip/multi-seat-2-30] If the user's .dmrc file specifies the "custom" session, then accept it even if there is no correspo



commit c520c357e9940ea3b0a599fd22883fe573ad24b2
Author: Brian Cameron <brian cameron oracle com>
Date:   Thu Jun 21 20:47:25 2012 -0500

    If the user's .dmrc file specifies the "custom" session, then accept it
    even if there is no corresponding desktop file since it has special meaning to the /etc/gdm/Xsession script for launching $HOME/.xsession. Fixes bug 619129.
    
    http://git.gnome.org/browse/gdm/commit/?h=gnome-2-32&id=9d895d874b815d800df32da6e7fde4fe31fc7fd3

 common/gdm-common.h                    |    2 ++
 daemon/gdm-session-direct.c            |   24 +++++++++++++++---------
 gui/simple-greeter/gdm-greeter-panel.c |   13 +++++++++++--
 3 files changed, 28 insertions(+), 11 deletions(-)
---
diff --git a/common/gdm-common.h b/common/gdm-common.h
index ae7469e..8faeda5 100644
--- a/common/gdm-common.h
+++ b/common/gdm-common.h
@@ -26,6 +26,8 @@
 
 #include "gdm-common-unknown-origin.h"
 
+#define GDM_CUSTOM_SESSION  "custom"
+
 G_BEGIN_DECLS
 
 gboolean       gdm_is_version_unstable            (void);
diff --git a/daemon/gdm-session-direct.c b/daemon/gdm-session-direct.c
index 3b28d84..7ab0562 100644
--- a/daemon/gdm-session-direct.c
+++ b/daemon/gdm-session-direct.c
@@ -592,11 +592,22 @@ get_session_command_for_name (const char *name,
         char    *filename;
 
         filename = g_strdup_printf ("%s.desktop", name);
-
-        command = NULL;
         res = get_session_command_for_file (filename, command);
         g_free (filename);
 
+        /*
+         * The GDM Xsession script honors "custom" as a valid session.  If the
+         * session is one of these, no file is needed, then just run the
+         * command as "custom".
+         */
+        if (!res && strcmp (name, GDM_CUSTOM_SESSION) == 0) {
+                g_debug ("No custom desktop file, but accepting it anyway.");
+                if (command != NULL) {
+                        *command = g_strdup (GDM_CUSTOM_SESSION);
+                }
+                res = TRUE;
+        }
+
         return res;
 }
 
@@ -2084,18 +2095,13 @@ get_session_command (GdmSessionDirect *session)
 {
         gboolean res;
         char    *command;
-        char    *filename;
-
-        filename = g_strdup_printf ("%s.desktop", get_session_name (session));
 
         command = NULL;
-        res = get_session_command_for_file (filename, &command);
+        res = get_session_command_for_name (get_session_name (session), &command);
         if (! res) {
-                g_critical ("Cannot read specified session file: %s", filename);
-                g_free (filename);
+                g_critical ("Cannot read specified session file: %s.desktop", session);
                 exit (1);
         }
-        g_free (filename);
 
         return command;
 }
diff --git a/gui/simple-greeter/gdm-greeter-panel.c b/gui/simple-greeter/gdm-greeter-panel.c
index e10500e..93c3d8e 100644
--- a/gui/simple-greeter/gdm-greeter-panel.c
+++ b/gui/simple-greeter/gdm-greeter-panel.c
@@ -53,6 +53,7 @@
 #include "gdm-session-option-widget.h"
 #include "gdm-timer.h"
 #include "gdm-profile.h"
+#include "gdm-common.h"
 
 #include "na-tray.h"
 
@@ -1106,8 +1107,16 @@ gdm_greeter_panel_set_default_session_name (GdmGreeterPanel *panel,
         if (session_name != NULL &&
             !gdm_option_widget_lookup_item (GDM_OPTION_WIDGET (panel->priv->session_option_widget),
                                             session_name, NULL, NULL, NULL)) {
-                g_warning ("Default session is not available");
-                return;
+                if (strcmp (session_name, GDM_CUSTOM_SESSION) == 0) {
+                        gdm_option_widget_add_item (GDM_OPTION_WIDGET (panel->priv->session_option_widget),
+                                                    GDM_CUSTOM_SESSION,
+                                                    C_("customsession", "Custom"),
+                                                    _("Custom session"),
+                                                    GDM_OPTION_WIDGET_POSITION_TOP);
+                } else {
+                        g_warning ("Default session is not available");
+                        return;
+                }
         }
 
         gdm_option_widget_set_default_item (GDM_OPTION_WIDGET (panel->priv->session_option_widget),



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