Index: gnome-session/gsm-manager.c
===================================================================
--- gnome-session/gsm-manager.c	(Revision 5144)
+++ gnome-session/gsm-manager.c	(Arbeitskopie)
@@ -1435,6 +1435,29 @@
         }
 }
 
+static void
+on_xsmp_client_name_changed (GsmXSMPClient *client,
+                             const char    *new_name,
+                             GsmManager    *manager)
+{
+        GsmApp *app;
+
+        gsm_client_set_app_id (GSM_CLIENT (client), new_name);
+
+        if (manager->priv->phase >= GSM_MANAGER_PHASE_QUERY_END_SESSION) {
+                return;
+        }
+
+        if (manager->priv->pending_apps == NULL) {
+                return;
+        }
+
+        app = find_app_for_app_id (manager, new_name);
+        if (app) {
+                gsm_app_registered (app);
+        }
+}
+
 static gboolean
 on_xsmp_client_register_request (GsmXSMPClient *client,
                                  char         **id,
@@ -1473,6 +1496,10 @@
                           "disconnected",
                           G_CALLBACK (on_client_disconnected),
                           manager);
+        g_signal_connect (client,
+                          "name-changed",
+                          G_CALLBACK (on_xsmp_client_name_changed),
+                          manager);
 
         /* If it's a brand new client id, we just accept the client*/
         if (IS_STRING_EMPTY (*id)) {
Index: gnome-session/gsm-xsmp-client.c
===================================================================
--- gnome-session/gsm-xsmp-client.c	(Revision 5144)
+++ gnome-session/gsm-xsmp-client.c	(Arbeitskopie)
@@ -66,6 +66,7 @@
 enum {
         REGISTER_REQUEST,
         LOGOUT_REQUEST,
+        NAME_CHANGED,
         LAST_SIGNAL
 };
 
@@ -303,8 +304,11 @@
 
                 debug_print_property (props[i]);
 
-                if (!strcmp (props[i]->name, SmProgram))
+                if (!strcmp (props[i]->name, SmProgram)) {
+                        const char *name = (const char *) props[i]->vals[0].value;
                         set_description (client);
+                        g_signal_emit (client, signals[NAME_CHANGED], 0, name);
+                }
         }
 
         free (props);
@@ -798,6 +802,16 @@
                               g_cclosure_marshal_VOID__BOOLEAN,
                               G_TYPE_NONE,
                               1, G_TYPE_BOOLEAN);
+        signals[NAME_CHANGED] =
+                g_signal_new ("name-changed",
+                              G_OBJECT_CLASS_TYPE (object_class),
+                              G_SIGNAL_RUN_LAST,
+                              G_STRUCT_OFFSET (GsmXSMPClientClass, name_changed),
+                              NULL,
+                              NULL,
+                              g_cclosure_marshal_VOID__STRING,
+                              G_TYPE_NONE,
+                              1, G_TYPE_STRING);
 
         g_object_class_install_property (object_class,
                                          PROP_ICE_CONNECTION,
Index: gnome-session/gsm-xsmp-client.h
===================================================================
--- gnome-session/gsm-xsmp-client.h	(Revision 5144)
+++ gnome-session/gsm-xsmp-client.h	(Arbeitskopie)
@@ -54,8 +54,9 @@
                                           char          **client_id);
         gboolean (*logout_request)       (GsmXSMPClient  *client,
                                           gboolean        prompt);
+        void     (*name_changed)         (GsmXSMPClient  *client,
+                                          const char     *name);
 
-
         void     (*saved_state)          (GsmXSMPClient  *client);
 
         void     (*request_phase2)       (GsmXSMPClient  *client);
Index: gnome-session/gsm-autostart-app.c
===================================================================
--- gnome-session/gsm-autostart-app.c	(Revision 5144)
+++ gnome-session/gsm-autostart-app.c	(Arbeitskopie)
@@ -461,11 +461,13 @@
                                         const char      *desktop_filename)
 {
         GError *error;
+        const char *extension;
 
         if (app->priv->desktop_file != NULL) {
                 egg_desktop_file_free (app->priv->desktop_file);
                 app->priv->desktop_file = NULL;
                 g_free (app->priv->desktop_id);
+                g_free (app->priv->desktop_filename);
         }
 
         if (desktop_filename == NULL) {
@@ -473,6 +475,13 @@
         }
 
         app->priv->desktop_id = g_path_get_basename (desktop_filename);
+        extension = strstr (app->priv->desktop_id, ".desktop");
+        if (extension != NULL) {
+                app->priv->desktop_filename = g_strndup (app->priv->desktop_id,
+                                                         extension - app->priv->desktop_id);
+        } else {
+                app->priv->desktop_filename = g_strdup (app->priv->desktop_id);
+        }
 
         error = NULL;
         app->priv->desktop_file = egg_desktop_file_new (desktop_filename, &error);
@@ -556,6 +565,11 @@
                 priv->desktop_id = NULL;
         }
 
+        if (priv->desktop_filename) {
+                g_free (priv->desktop_filename);
+                priv->desktop_filename = NULL;
+        }
+
         if (priv->child_watch_id > 0) {
                 g_source_remove (priv->child_watch_id);
                 priv->child_watch_id = 0;
@@ -1045,21 +1059,11 @@
 static const char *
 gsm_autostart_app_get_app_id (GsmApp *app)
 {
-        const char *location;
-        const char *slash;
-
         if (GSM_AUTOSTART_APP (app)->priv->desktop_file == NULL) {
                 return NULL;
         }
 
-        location = egg_desktop_file_get_source (GSM_AUTOSTART_APP (app)->priv->desktop_file);
-
-        slash = strrchr (location, '/');
-        if (slash != NULL) {
-                return slash + 1;
-        } else {
-                return location;
-        }
+        return GSM_AUTOSTART_APP (app)->priv->desktop_filename;
 }
 
 static GObject *
