3e3a683
From d56eaae13ba731ff9837ee37cac9165fff99f350 Mon Sep 17 00:00:00 2001
3e3a683
From: Ray Strode <rstrode@redhat.com>
3e3a683
Date: Fri, 9 Oct 2009 11:26:06 -0400
3e3a683
Subject: [PATCH] Fix Other... user visibility check
3e3a683
3e3a683
Before we'd only add the Other item if the number of users
3e3a683
was 1, when we should have been adding it if the number of
3e3a683
users is greater than or equal to 1.  This is because in some
3e3a683
cases more than one item can get added to the user list before
3e3a683
the visibility function is run.
3e3a683
---
3e3a683
 gui/simple-greeter/gdm-user-chooser-widget.c |   18 ++++++++++--------
3e3a683
 1 files changed, 10 insertions(+), 8 deletions(-)
3e3a683
3e3a683
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
3e3a683
index 4410a02..167e324 100644
3e3a683
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
3e3a683
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
3e3a683
@@ -130,6 +130,8 @@ get_icon_height_for_widget (GtkWidget *widget)
3e3a683
 static void
3e3a683
 update_other_user_visibility (GdmUserChooserWidget *widget)
3e3a683
 {
3e3a683
+        int number_of_users;
3e3a683
+
3e3a683
         if (!widget->priv->show_user_other) {
3e3a683
                 if (widget->priv->has_user_other) {
3e3a683
                         remove_user_other (widget);
3e3a683
@@ -138,14 +140,14 @@ update_other_user_visibility (GdmUserChooserWidget *widget)
3e3a683
                 return;
3e3a683
         }
3e3a683
 
3e3a683
-        if (gdm_chooser_widget_get_number_of_items (GDM_CHOOSER_WIDGET (widget)) == 1) {
3e3a683
-                /* we hide the Other user if it's the last one, and we show it
3e3a683
-                 * if there's another user */
3e3a683
-                if (widget->priv->has_user_other) {
3e3a683
-                        remove_user_other (widget);
3e3a683
-                } else {
3e3a683
-                        add_user_other (widget);
3e3a683
-                }
3e3a683
+        number_of_users = gdm_chooser_widget_get_number_of_items (GDM_CHOOSER_WIDGET (widget));
3e3a683
+
3e3a683
+        /* we hide the Other user if it's the last one, and we show it
3e3a683
+         * if there's another user */
3e3a683
+        if (number_of_users == 1 && widget->priv->has_user_other) {
3e3a683
+                remove_user_other (widget);
3e3a683
+        } if (number_of_users >= 1 && !widget->priv->has_user_other) {
3e3a683
+                add_user_other (widget);
3e3a683
         }
3e3a683
 }
3e3a683
 
3e3a683
-- 
3e3a683
1.6.5.rc2
3e3a683