From 572cdb85a58bc0fb7632333ef8c390649d28714f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 25 Mar 2015 17:25:41 -0500 Subject: use unichar rather than ascii --- src/service.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/service.c') diff --git a/src/service.c b/src/service.c index 5d2449e..6fddd7a 100644 --- a/src/service.c +++ b/src/service.c @@ -295,14 +295,17 @@ get_user_label (const IndicatorSessionUser * user) { const char * c; - /* if real_name exists and isn't empty or whitespace, use it */ + /* if real_name exists and is printable, use it */ c = user->real_name; - if (c != NULL) + if ((c != NULL) && g_utf8_validate(c, -1, NULL)) { - while ((*c != '\0') && g_ascii_isspace(*c)) /* walk past whitespace */ - ++c; - if (*c != '\0') - return user->real_name; + while (*c != '\0') + { + if (g_unichar_isgraph(g_utf8_get_char(c))) + return c; + + c = g_utf8_next_char(c); + } } /* otherwise, use this as a fallback */ -- cgit v1.2.3