[gdm/accounts-service-split: 12/22] Rename users hashtable to user_by_name



commit 70232fcc80fa1007efe6061f0e83425ca99879e2
Author: Ray Strode <rstrode redhat com>
Date:   Mon Mar 15 23:51:22 2010 -0400

    Rename users hashtable to user_by_name
    
    This will lend us the flexibility to index
    users by other criteria later.

 gui/simple-greeter/gdm-user-manager.c |   34 ++++++++++++++++----------------
 1 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
index f2b4332..9f88e99 100644
--- a/gui/simple-greeter/gdm-user-manager.c
+++ b/gui/simple-greeter/gdm-user-manager.c
@@ -81,7 +81,7 @@
 
 struct GdmUserManagerPrivate
 {
-        GHashTable            *users;
+        GHashTable            *users_by_name;
         GHashTable            *sessions;
         GHashTable            *shells;
         DBusGConnection       *connection;
@@ -454,7 +454,7 @@ on_user_changed (GdmUser        *user,
 
         g_debug ("GdmUserManager: user changed");
 
-        dup = g_hash_table_find (manager->priv->users,
+        dup = g_hash_table_find (manager->priv->users_by_name,
                                  match_real_name_hrfunc,
                                  user);
         if (dup != NULL) {
@@ -746,14 +746,14 @@ add_user (GdmUserManager *manager,
         GdmUser *dup;
 
         add_sessions_for_user (manager, user);
-        dup = g_hash_table_find (manager->priv->users,
+        dup = g_hash_table_find (manager->priv->users_by_name,
                                  match_real_name_hrfunc,
                                  user);
         if (dup != NULL) {
                 _gdm_user_show_full_display_name (user);
                 _gdm_user_show_full_display_name (dup);
         }
-        g_hash_table_insert (manager->priv->users,
+        g_hash_table_insert (manager->priv->users_by_name,
                              g_strdup (gdm_user_get_user_name (user)),
                              g_object_ref (user));
 
@@ -904,7 +904,7 @@ seat_session_added (DBusGProxy     *seat_proxy,
                 return;
         }
 
-        user = g_hash_table_lookup (manager->priv->users, pwent->pw_name);
+        user = g_hash_table_lookup (manager->priv->users_by_name, pwent->pw_name);
         if (user == NULL) {
                 g_debug ("Creating new user");
 
@@ -945,7 +945,7 @@ seat_session_removed (DBusGProxy     *seat_proxy,
                 return;
         }
 
-        user = g_hash_table_lookup (manager->priv->users, username);
+        user = g_hash_table_lookup (manager->priv->users_by_name, username);
         if (user == NULL) {
                 /* nothing to do */
                 return;
@@ -1052,7 +1052,7 @@ gdm_user_manager_get_user (GdmUserManager *manager,
         g_return_val_if_fail (GDM_IS_USER_MANAGER (manager), NULL);
         g_return_val_if_fail (username != NULL && username[0] != '\0', NULL);
 
-        user = g_hash_table_lookup (manager->priv->users, username);
+        user = g_hash_table_lookup (manager->priv->users_by_name, username);
 
         if (user == NULL) {
                 struct passwd *pwent;
@@ -1082,7 +1082,7 @@ gdm_user_manager_get_user_by_uid (GdmUserManager *manager,
                 return NULL;
         }
 
-        user = g_hash_table_lookup (manager->priv->users, pwent->pw_name);
+        user = g_hash_table_lookup (manager->priv->users_by_name, pwent->pw_name);
 
         if (user == NULL) {
                 user = add_new_user_for_pwent (manager, pwent);
@@ -1109,7 +1109,7 @@ gdm_user_manager_list_users (GdmUserManager *manager)
         g_return_val_if_fail (GDM_IS_USER_MANAGER (manager), NULL);
 
         retval = NULL;
-        g_hash_table_foreach (manager->priv->users, listify_hash_values_hfunc, &retval);
+        g_hash_table_foreach (manager->priv->users_by_name, listify_hash_values_hfunc, &retval);
 
         return g_slist_sort (retval, (GCompareFunc) gdm_user_collate);
 }
@@ -1399,7 +1399,7 @@ reload_passwd (GdmUserManager *manager)
                 goto out;
         }
 
-        g_hash_table_foreach (manager->priv->users, listify_hash_values_hfunc, &old_users);
+        g_hash_table_foreach (manager->priv->users_by_name, listify_hash_values_hfunc, &old_users);
         g_slist_foreach (old_users, (GFunc) g_object_ref, NULL);
 
         /* Make sure we keep users who are logged in no matter what. */
@@ -1442,7 +1442,7 @@ reload_passwd (GdmUserManager *manager)
                                 continue;
                         }
 
-                        user = g_hash_table_lookup (manager->priv->users,
+                        user = g_hash_table_lookup (manager->priv->users_by_name,
                                                     pwent->pw_name);
 
                         /* Update users already in the *new* list */
@@ -1469,7 +1469,7 @@ reload_passwd (GdmUserManager *manager)
         for (list = old_users; list; list = list->next) {
                 if (! g_slist_find (new_users, list->data)) {
                         g_signal_emit (manager, signals[USER_REMOVED], 0, list->data);
-                        g_hash_table_remove (manager->priv->users,
+                        g_hash_table_remove (manager->priv->users_by_name,
                                              gdm_user_get_user_name (list->data));
                 }
         }
@@ -1693,10 +1693,10 @@ gdm_user_manager_init (GdmUserManager *manager)
                                                          g_free);
 
         /* users */
-        manager->priv->users = g_hash_table_new_full (g_str_hash,
-                                                      g_str_equal,
-                                                      g_free,
-                                                      (GDestroyNotify) g_object_run_dispose);
+        manager->priv->users_by_name = g_hash_table_new_full (g_str_hash,
+                                                              g_str_equal,
+                                                              g_free,
+                                                              (GDestroyNotify) g_object_run_dispose);
 
         if (manager->priv->include_all == TRUE) {
                 /* /etc/shells */
@@ -1784,7 +1784,7 @@ gdm_user_manager_finalize (GObject *object)
         g_hash_table_destroy (manager->priv->sessions);
 
         g_file_monitor_cancel (manager->priv->passwd_monitor);
-        g_hash_table_destroy (manager->priv->users);
+        g_hash_table_destroy (manager->priv->users_by_name);
 
         g_file_monitor_cancel (manager->priv->shells_monitor);
         g_hash_table_destroy (manager->priv->shells);



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