[PolicyKit-gnome] Bug 541945 – Parse gecos field (i.e. don't show username commas)
- From: David Zeuthen <davidz src gnome org>
- To: svn-commits-list gnome org
- Subject: [PolicyKit-gnome] Bug 541945 – Parse gecos field (i.e. don't show username commas)
- Date: Tue, 26 May 2009 15:52:08 -0400 (EDT)
commit e758975e8b429f5aa1d80cd9e928236ddcf9380f
Author: David Zeuthen <davidz redhat com>
Date: Tue May 26 15:49:20 2009 -0400
Bug 541945 â?? Parse gecos field (i.e. don't show username commas)
---
src/polkitgnomeauthenticationdialog.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/polkitgnomeauthenticationdialog.c b/src/polkitgnomeauthenticationdialog.c
index 99c1ff3..ca0eda9 100644
--- a/src/polkitgnomeauthenticationdialog.c
+++ b/src/polkitgnomeauthenticationdialog.c
@@ -166,6 +166,7 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
/* For each user */
for (n = 0; dialog->priv->users[n] != NULL; n++)
{
+ gchar *gecos;
gchar *real_name;
GdkPixbuf *pixbuf;
struct passwd *passwd;
@@ -179,11 +180,23 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
continue;
}
- /* Real name */
- if (passwd->pw_gecos != NULL && strlen (passwd->pw_gecos) > 0)
- real_name = g_strdup_printf (_("%s (%s)"), passwd->pw_gecos, dialog->priv->users[n]);
+ if (passwd->pw_gecos != NULL)
+ gecos = g_locale_to_utf8 (passwd->pw_gecos, -1, NULL, NULL, NULL);
else
- real_name = g_strdup (dialog->priv->users[n]);
+ gecos = NULL;
+
+ if (gecos != NULL && strlen (gecos) > 0)
+ {
+ gchar *first_comma;
+ first_comma = strchr (gecos, ',');
+ if (first_comma != NULL)
+ *first_comma = '\0';
+ }
+ if (gecos != NULL && strlen (gecos) > 0 && strcmp (gecos, dialog->priv->users[n]) != 0)
+ real_name = g_strdup_printf (_("%s (%s)"), gecos, dialog->priv->users[n]);
+ else
+ real_name = g_strdup (dialog->priv->users[n]);
+ g_free (gecos);
/* Load users face */
pixbuf = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]