[gdm] Fix Other... user visibility check



commit d56eaae13ba731ff9837ee37cac9165fff99f350
Author: Ray Strode <rstrode redhat com>
Date:   Fri Oct 9 11:26:06 2009 -0400

    Fix Other... user visibility check
    
    Before we'd only add the Other item if the number of users
    was 1, when we should have been adding it if the number of
    users is greater than or equal to 1.  This is because in some
    cases more than one item can get added to the user list before
    the visibility function is run.

 gui/simple-greeter/gdm-user-chooser-widget.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
index 4410a02..167e324 100644
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
@@ -130,6 +130,8 @@ get_icon_height_for_widget (GtkWidget *widget)
 static void
 update_other_user_visibility (GdmUserChooserWidget *widget)
 {
+        int number_of_users;
+
         if (!widget->priv->show_user_other) {
                 if (widget->priv->has_user_other) {
                         remove_user_other (widget);
@@ -138,14 +140,14 @@ update_other_user_visibility (GdmUserChooserWidget *widget)
                 return;
         }
 
-        if (gdm_chooser_widget_get_number_of_items (GDM_CHOOSER_WIDGET (widget)) == 1) {
-                /* we hide the Other user if it's the last one, and we show it
-                 * if there's another user */
-                if (widget->priv->has_user_other) {
-                        remove_user_other (widget);
-                } else {
-                        add_user_other (widget);
-                }
+        number_of_users = gdm_chooser_widget_get_number_of_items (GDM_CHOOSER_WIDGET (widget));
+
+        /* we hide the Other user if it's the last one, and we show it
+         * if there's another user */
+        if (number_of_users == 1 && widget->priv->has_user_other) {
+                remove_user_other (widget);
+        } if (number_of_users >= 1 && !widget->priv->has_user_other) {
+                add_user_other (widget);
         }
 }
 



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