gnome-games r7997 - trunk/libgames-support



Author: thomashpa
Date: Fri Oct 10 14:42:17 2008
New Revision: 7997
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7997&view=rev

Log:
use g_get_user_name when g_get_real_name returns empty. Patch by Morita Sho in bug #544376

Modified:
   trunk/libgames-support/games-score.c

Modified: trunk/libgames-support/games-score.c
==============================================================================
--- trunk/libgames-support/games-score.c	(original)
+++ trunk/libgames-support/games-score.c	Fri Oct 10 14:42:17 2008
@@ -29,11 +29,19 @@
 games_score_new (void)
 {
   GamesScore *newscore;
+  const gchar* name;
 
   newscore = g_slice_new0 (GamesScore);
   newscore->time = time (NULL);
   /* FIXME: We don't handle the "Unknown" case. */
-  newscore->name = g_strdup (g_get_real_name ());
+  name = g_get_real_name ();
+  if (name[0] == '\0' || g_utf8_validate (name, -1, NULL) != TRUE) {
+    name = g_get_user_name ();
+    if (g_utf8_validate (name, -1, NULL) != TRUE) {
+      name = "";
+    }
+  }
+  newscore->name = g_strdup (name);
 
   return newscore;
 }



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