[gdm] greeter: don't show empty names in user list



commit f7978ec4dd39d3c4aecb462bfc6d0657c7ed6f0d
Author: Ray Strode <rstrode redhat com>
Date:   Mon Mar 7 16:28:40 2011 -0500

    greeter: don't show empty names in user list
    
    If a user doesn't have a name in gecos, fall back to username.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=644156

 gui/simple-greeter/gdm-user-chooser-widget.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
index be756a6..59fee40 100644
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
@@ -443,6 +443,7 @@ update_item_for_user (GdmUserChooserWidget *widget,
         char         *tooltip;
         gboolean      is_logged_in;
         char         *escaped_username;
+        const char   *real_name;
         char         *escaped_real_name;
 
         if (!act_user_is_loaded (user)) {
@@ -466,7 +467,13 @@ update_item_for_user (GdmUserChooserWidget *widget,
                  pixbuf);
 
         escaped_username = g_markup_escape_text (act_user_get_user_name (user), -1);
-        escaped_real_name = g_markup_escape_text (act_user_get_real_name (user), -1);
+
+        real_name = act_user_get_real_name (user);
+        if (real_name == NULL || real_name == '\0') {
+                real_name = act_user_get_user_name (user);
+        }
+        escaped_real_name = g_markup_escape_text (real_name, -1);
+
         gdm_chooser_widget_update_item (GDM_CHOOSER_WIDGET (widget),
                                         escaped_username,
                                         pixbuf,
@@ -737,6 +744,7 @@ add_user (GdmUserChooserWidget *widget,
         char         *tooltip;
         gboolean      is_logged_in;
         char         *escaped_username;
+        const char   *real_name;
         char         *escaped_real_name;
 
         if (!widget->priv->show_normal_users) {
@@ -764,7 +772,12 @@ add_user (GdmUserChooserWidget *widget,
         is_logged_in = act_user_is_logged_in (user);
 
         escaped_username = g_markup_escape_text (act_user_get_user_name (user), -1);
-        escaped_real_name = g_markup_escape_text (act_user_get_real_name (user), -1);
+        real_name = act_user_get_real_name (user);
+        if (real_name == NULL || real_name == '\0') {
+                real_name = act_user_get_user_name (user);
+        }
+        escaped_real_name = g_markup_escape_text (real_name, -1);
+
         gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
                                      escaped_username,
                                      pixbuf,



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