diff --git a/data/gnome-session.schemas.in b/data/gnome-session.schemas.in
index 89e0e39..436816b 100644
--- a/data/gnome-session.schemas.in
+++ b/data/gnome-session.schemas.in
@@ -58,6 +58,30 @@
       </schema>
 
       <schema>
+         <key>/schemas/desktop/gnome/session/default-session</key>
+         <applyto>/desktop/gnome/session/default-session</applyto>
+         <owner>gnome</owner>
+         <type>list</type>
+         <list_type>string</list_type>
+         <default>[gnome-settings-daemon,metacity,gnome-panel,nautilus]</default>
+         <locale name="C">
+            <short>Default session</short>
+            <long>List of applications that are part of the default session.</long>
+         </locale>
+      </schema>
+      <schema>
+         <key>/schemas/desktop/gnome/session/failsafe-session</key>
+         <applyto>/desktop/gnome/session/failsafe-session</applyto>
+         <owner>gnome</owner>
+         <type>list</type>
+         <list_type>string</list_type>
+         <default>[gnome-settings-daemon,metacity,gnome-panel,nautilus]</default>
+         <locale name="C">
+            <short>Failsafe session</short>
+            <long>List of applications that are part of the failsafe session.</long>
+         </locale>
+      </schema>
+      <schema>
          <key>/schemas/desktop/gnome/session/required-components</key>
          <applyto>/desktop/gnome/session/required-components</applyto>
          <owner>gnome</owner>
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index 30c817e..9217a58 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -6,8 +6,7 @@ INCLUDES =					\
 	-I$(top_srcdir)/egg			\
 	-DDBUS_LAUNCH=\"dbus-launch\"		\
 	-DGCONF_SANITY_CHECK=\""$(GCONF_SANITY_CHECK)"\" \
-	-DGCONFTOOL_CMD=\"$(GCONFTOOL)\" \
-	-DGSM_DEFAULT_SESSION_DIR=\""$(default_sessiondir)"\"
+	-DGCONFTOOL_CMD=\"$(GCONFTOOL)\" 
 
 LDADD =						\
 	-lSM -lICE				\
@@ -16,8 +15,6 @@ LDADD =						\
 	$(GCONF_LIBS)				\
 	$(GTK_LIBS)
 
-default_sessiondir = $(datadir)/gnome/default-session
-
 bin_PROGRAMS =					\
 	gnome-session
 
diff --git a/gnome-session/gsm.h b/gnome-session/gsm.h
index 904aa43..aa4ee38 100644
--- a/gnome-session/gsm.h
+++ b/gnome-session/gsm.h
@@ -3,6 +3,8 @@
 
 void gsm_initialization_error (gboolean fatal, const char *format, ...);
 
+#define GSM_GCONF_DEFAULT_SESSION_KEY           "/desktop/gnome/session/default-session"
+#define GSM_GCONF_FAILSAFE_SESSION_KEY          "/desktop/gnome/session/failsafe-session"
 #define GSM_GCONF_REQUIRED_COMPONENTS_DIRECTORY "/desktop/gnome/session/required-components"
 
 extern GsmSession *global_session;
diff --git a/gnome-session/session.c b/gnome-session/session.c
index 7c20880..76e1d72 100644
--- a/gnome-session/session.c
+++ b/gnome-session/session.c
@@ -32,6 +32,9 @@
 #include "session.h"
 #include "xsmp.h"
 
+static void append_default_apps       (GsmSession *session,
+				       gboolean    failsafe);
+
 static void append_autostart_apps     (GsmSession *session,
 				       const char *dir);
 
@@ -123,7 +126,7 @@ gsm_session_new (gboolean failsafe)
 
   session->apps_by_name = g_hash_table_new (g_str_hash, g_str_equal);
 
-  append_autostart_apps (session, GSM_DEFAULT_SESSION_DIR);
+  append_default_apps (session, failsafe);
   if (failsafe)
     return session;
 
@@ -156,8 +159,7 @@ gsm_session_new (gboolean failsafe)
   append_saved_session_apps (session);
 
   /* We don't do this in the failsafe case, because the default
-   * session should include all requirements anyway.
-   */
+   * session should include all requirements anyway. */
   append_required_apps (session);
 
   return session;
@@ -181,6 +183,132 @@ append_app (GsmSession *session, GsmApp *app)
 }
 
 static void
+append_default_apps (GsmSession *session, gboolean failsafe)
+{
+  GSList *default_apps, *a;
+  const char * const *system_config_dirs;
+  const char * const *system_data_dirs;
+  char *app_path = NULL;
+
+  g_debug ("append_default_apps (%d)", failsafe);
+
+  default_apps = 
+    gconf_client_get_list (gsm_gconf_get_client (),
+			   (failsafe ? GSM_GCONF_DEFAULT_SESSION_KEY : 
+			               GSM_GCONF_FAILSAFE_SESSION_KEY),
+                           GCONF_VALUE_STRING,
+			   NULL);
+
+  for (a = default_apps; a; a = a->next)
+    {
+      char *desktop_file;
+      int i;
+
+      if (!a->data)
+        continue;
+
+      desktop_file = g_strdup_printf ("%s.desktop", (char *) a->data); 
+
+      g_debug ("Look for: %s", desktop_file);
+
+      system_data_dirs = g_get_system_data_dirs ();
+      for (i = 0; system_data_dirs[i]; i++)
+        {
+          app_path = g_build_filename (system_data_dirs[i], "applications", 
+                                       desktop_file, 
+                                       NULL);
+
+	  if (g_file_test (app_path, G_FILE_TEST_EXISTS))
+            goto found;
+
+          g_free (app_path);
+          app_path = NULL;
+
+          app_path = g_build_filename (system_data_dirs[i], "gnome", "autostart", 
+                                       desktop_file, 
+                                       NULL);
+
+	  if (g_file_test (app_path, G_FILE_TEST_EXISTS))
+            goto found;
+
+          g_free (app_path);
+          app_path = NULL;
+
+          app_path = g_build_filename (system_data_dirs[i], "autostart", 
+                                       desktop_file, 
+                                       NULL);
+
+	  if (g_file_test (app_path, G_FILE_TEST_EXISTS))
+            goto found;
+
+          g_free (app_path);
+          app_path = NULL;
+
+          app_path = g_build_filename (system_data_dirs[i], "gnome", "wm-properties", 
+                                       desktop_file, 
+                                       NULL);
+
+	  if (g_file_test (app_path, G_FILE_TEST_EXISTS))
+            goto found;
+
+          g_free (app_path);
+          app_path = NULL;
+        }
+
+      system_config_dirs = g_get_system_config_dirs ();
+      for (i = 0; system_config_dirs[i]; i++)
+        {
+          app_path = g_build_filename (system_config_dirs[i], "autostart", 
+                                       desktop_file, 
+                                       NULL);
+
+	  if (g_file_test (app_path, G_FILE_TEST_EXISTS))
+            goto found;
+
+          g_free (app_path);
+          app_path = NULL;
+        }
+
+      app_path = g_build_filename (g_get_user_config_dir (), "autostart", 
+                                   desktop_file, 
+                                   NULL);
+
+      if (g_file_test (app_path, G_FILE_TEST_EXISTS))
+        goto found;
+
+      g_free (app_path);
+      app_path = NULL;
+
+found:
+      if (app_path)
+        {
+          GsmApp *app;
+	  char *client_id;
+
+          g_debug ("Found in: %s", app_path);
+
+	  client_id = gsm_xsmp_generate_client_id ();
+	  app = gsm_app_autostart_new (app_path, client_id);
+	  g_free (client_id);
+	  g_free (app_path);
+
+	  if (app)
+            {
+              g_debug ("read %s\n", desktop_file);
+              append_app (session, app);
+            }
+          else
+            g_warning ("could not read %s\n", desktop_file);
+        }
+
+      g_free (desktop_file);
+    }
+
+  g_slist_foreach (default_apps, (GFunc) g_free, NULL);
+  g_slist_free (default_apps);
+}
+
+static void
 append_autostart_apps (GsmSession *session, const char *path)
 {
   GDir *dir;
@@ -330,7 +458,7 @@ append_required_apps (GsmSession *session)
 
   for (r = required_components; r; r = r->next)
     {
-      entry = r->data;
+      entry = (GConfEntry *) r->data;
 
       service = strrchr (entry->key, '/');
       if (!service)
