[gdm/display-configuration: 12/20] Store seat proxies in hashtable, not list



commit 355b8ba22d00f92a43144daf0d6feef52cf5ca38
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jun 29 20:13:02 2009 -0400

    Store seat proxies in hashtable, not list
    
    This way we'll easily be able to access to the
    proxies from their path.

 daemon/gdm-local-display-factory.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 6807103..3898cb1 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -73,7 +73,7 @@ struct GdmLocalDisplayFactoryPrivate
         DBusGProxy      *proxy_ck;
         GHashTable      *displays;
         GHashTable      *displays_by_session;
-        GSList          *lst_proxy;
+        GHashTable      *managed_seat_proxies;
 
         /* FIXME: this needs to be per seat? */
         guint            num_failures;
@@ -740,8 +740,9 @@ manage_static_sessions_per_seat (GdmLocalDisplayFactory *factory,
                                     G_TYPE_INVALID,
                                     G_TYPE_INVALID);
 
-        factory->priv->lst_proxy = g_slist_append (factory->priv->lst_proxy, proxy);
-
+        g_hash_table_insert (factory->priv->managed_seat_proxies,
+                             g_strdup (dbus_g_proxy_get_path (proxy)),
+                             proxy);
 }
 
 static void
@@ -1053,6 +1054,10 @@ gdm_local_display_factory_init (GdmLocalDisplayFactory *factory)
         factory->priv->displays_by_session = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                                     (GDestroyNotify) g_free,
                                                                     (GDestroyNotify) g_object_unref);
+
+        factory->priv->managed_seat_proxies = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                                    (GDestroyNotify) g_free,
+                                                                    (GDestroyNotify) g_object_unref);
 }
 
 static void
@@ -1069,8 +1074,7 @@ gdm_local_display_factory_finalize (GObject *object)
 
         g_hash_table_destroy (factory->priv->displays);
         g_hash_table_destroy (factory->priv->displays_by_session);
-
-        g_slist_foreach (factory->priv->lst_proxy, g_object_unref, NULL);
+        g_hash_table_destroy (factory->priv->managed_seat_proxies);
 
         disconnect_from_hal (factory);
         disconnect_from_ck (factory);



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