diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2015-03-25 17:25:41 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2015-03-25 17:25:41 -0500 |
commit | 572cdb85a58bc0fb7632333ef8c390649d28714f (patch) | |
tree | 0ff60fd6ca7889affc0547630d961f7b9ea346a5 | |
parent | 1ef3f462a3cfde20fafdda7e53610a9858f88350 (diff) | |
download | ayatana-indicator-session-572cdb85a58bc0fb7632333ef8c390649d28714f.tar.gz ayatana-indicator-session-572cdb85a58bc0fb7632333ef8c390649d28714f.tar.bz2 ayatana-indicator-session-572cdb85a58bc0fb7632333ef8c390649d28714f.zip |
use unichar rather than ascii
-rw-r--r-- | src/service.c | 15 |
1 files changed, 9 insertions, 6 deletions
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 */ |