commit 4c4aa9ed1911331565e108d6ee1aeceae682f855
Author: Halton Huo <halton.huo@sun.com>
Date:   Tue Jan 12 18:46:31 2010 +0800

    Remove display from XDMCP factory store when the display is finished or failed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=606724

diff --git a/daemon/gdm-xdmcp-display-factory.c b/daemon/gdm-xdmcp-display-factory.c
index 3b94bf8..d17a584 100644
--- a/daemon/gdm-xdmcp-display-factory.c
+++ b/daemon/gdm-xdmcp-display-factory.c
@@ -2005,6 +2005,38 @@ on_hostname_selected (GdmXdmcpChooserDisplay *display,
         freeaddrinfo (ai_list);
 }
 
+static void
+on_display_status_changed (GdmDisplay             *display,
+                           GParamSpec             *arg1,
+                           GdmXdmcpDisplayFactory *factory)
+{
+        int              status;
+        GdmDisplayStore *store;
+
+        store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
+
+        status = gdm_display_get_status (display);
+
+        g_debug ("GdmXdmcpDisplayFactory: xdmcp display status changed: %d", status);
+        switch (status) {
+        case GDM_DISPLAY_FINISHED:
+                gdm_display_store_remove (store, display);
+                break;
+        case GDM_DISPLAY_FAILED:
+                gdm_display_store_remove (store, display);
+                break;
+        case GDM_DISPLAY_UNMANAGED:
+                break;
+        case GDM_DISPLAY_PREPARED:
+                break;
+        case GDM_DISPLAY_MANAGED:
+                break;
+        default:
+                g_assert_not_reached ();
+                break;
+        }
+}
+
 static GdmDisplay *
 gdm_xdmcp_display_create (GdmXdmcpDisplayFactory *factory,
                           const char             *hostname,
@@ -2054,6 +2086,11 @@ gdm_xdmcp_display_create (GdmXdmcpDisplayFactory *factory,
                 goto out;
         }
 
+        g_signal_connect (display,
+                          "notify::status",
+                          G_CALLBACK (on_display_status_changed),
+                          factory);
+
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
         gdm_display_store_add (store, display);
 
