[gnome-shell] gdm: fix empty real name check
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] gdm: fix empty real name check
- Date: Tue, 15 Mar 2011 19:50:53 +0000 (UTC)
commit 735397aa896fe91e54b8210d535e9fa28a8d9109
Author: Ray Strode <rstrode redhat com>
Date: Tue Mar 15 15:19:58 2011 -0400
gdm: fix empty real name check
gdm_user_get_real_name() checks for an empty real
name and automatically falls back to username if
real name is NULL. It doesn't automatically fall
back to username if real name is empty, however.
This commit makes it fall back for both cases.
https://bugzilla.gnome.org/show_bug.cgi?id=644765
src/gdmuser/gdm-user.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gdmuser/gdm-user.c b/src/gdmuser/gdm-user.c
index 735c2cb..0a592cc 100644
--- a/src/gdmuser/gdm-user.c
+++ b/src/gdmuser/gdm-user.c
@@ -407,7 +407,9 @@ gdm_user_get_uid (GdmUser *user)
* gdm_user_get_real_name:
* @user: the user object to examine.
*
- * Retrieves the display name of @user.
+ * Retrieves a displayable name for @user. By default this is the real name
+ * of the user, but will fall back to the user name if there is no real name
+ * defined.
*
* Returns: (transfer none): a pointer to an array of characters which must not be modified or
* freed, or %NULL.
@@ -417,7 +419,12 @@ gdm_user_get_real_name (GdmUser *user)
{
g_return_val_if_fail (GDM_IS_USER (user), NULL);
- return (user->real_name ? user->real_name : user->user_name);
+ if (user->real_name == NULL ||
+ user->real_name[0] == '\0') {
+ return user->user_name;
+ }
+
+ return user->real_name;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]