[gnome-control-center/T20771: 24/44] user-accounts: Allow account creation when name contains no ASCII



commit 84a8ec9cac36171d79d73847dbe824b22b696899
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Mon May 16 14:40:01 2016 -0500

    user-accounts: Allow account creation when name contains no ASCII
    
    Again, copied from Juan's changes to gnome-initial-setup.
    
    Do not upstream; this code only makes sense for Endless because we do
    not give the user control over the username anymore.
    
    https://phabricator.endlessm.com/T3597

 panels/user-accounts/um-utils.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/panels/user-accounts/um-utils.c b/panels/user-accounts/um-utils.c
index 3763285..173062e 100644
--- a/panels/user-accounts/um-utils.c
+++ b/panels/user-accounts/um-utils.c
@@ -669,7 +669,7 @@ generate_username_choices (const gchar  *name,
 
         /* add the first word */
         in_use = is_username_used (first_word->str);
-        if (!in_use && !g_ascii_isdigit (first_word->str[0]) &&
+        if (*first_word->str && !in_use && !g_ascii_isdigit (first_word->str[0]) &&
             !g_hash_table_lookup (items, first_word->str)) {
                 gtk_list_store_append (store, &iter);
                 gtk_list_store_set (store, &iter, 0, first_word->str, -1);
@@ -678,7 +678,7 @@ generate_username_choices (const gchar  *name,
 
         /* add the last word */
         in_use = is_username_used (last_word->str);
-        if (!in_use && !g_ascii_isdigit (last_word->str[0]) &&
+        if (*last_word->str && !in_use && !g_ascii_isdigit (last_word->str[0]) &&
             !g_hash_table_lookup (items, last_word->str)) {
                 gtk_list_store_append (store, &iter);
                 gtk_list_store_set (store, &iter, 0, last_word->str, -1);
@@ -689,7 +689,7 @@ generate_username_choices (const gchar  *name,
         if (nwords2 > 1) {
                 /* add other items */
                 in_use = is_username_used (item0->str);
-                if (!in_use && !g_ascii_isdigit (item0->str[0])) {
+                if (*item0->str && !in_use && !g_ascii_isdigit (item0->str[0])) {
                         gtk_list_store_append (store, &iter);
                         gtk_list_store_set (store, &iter, 0, item0->str, -1);
                         g_hash_table_insert (items, item0->str, item0->str);
@@ -697,14 +697,14 @@ generate_username_choices (const gchar  *name,
 
                 in_use = is_username_used (item1->str);
                 same_as_initial = (g_strcmp0 (item0->str, item1->str) == 0);
-                if (!same_as_initial && nwords2 > 0 && !in_use && !g_ascii_isdigit (item1->str[0])) {
+                if (*item1->str && !same_as_initial && nwords2 > 0 && !in_use && !g_ascii_isdigit 
(item1->str[0])) {
                         gtk_list_store_append (store, &iter);
                         gtk_list_store_set (store, &iter, 0, item1->str, -1);
                         g_hash_table_insert (items, item1->str, item1->str);
                 }
 
                 in_use = is_username_used (item2->str);
-                if (!in_use && !g_ascii_isdigit (item2->str[0]) &&
+                if (*item2->str && !in_use && !g_ascii_isdigit (item2->str[0]) &&
                     !g_hash_table_lookup (items, item2->str)) {
                         gtk_list_store_append (store, &iter);
                         gtk_list_store_set (store, &iter, 0, item2->str, -1);
@@ -712,7 +712,7 @@ generate_username_choices (const gchar  *name,
                 }
 
                 in_use = is_username_used (item3->str);
-                if (!in_use && !g_ascii_isdigit (item3->str[0]) &&
+                if (*item3->str && !in_use && !g_ascii_isdigit (item3->str[0]) &&
                     !g_hash_table_lookup (items, item3->str)) {
                         gtk_list_store_append (store, &iter);
                         gtk_list_store_set (store, &iter, 0, item3->str, -1);
@@ -720,7 +720,7 @@ generate_username_choices (const gchar  *name,
                 }
 
                 in_use = is_username_used (item4->str);
-                if (!in_use && !g_ascii_isdigit (item4->str[0]) &&
+                if (*item4->str && !in_use && !g_ascii_isdigit (item4->str[0]) &&
                     !g_hash_table_lookup (items, item4->str)) {
                         gtk_list_store_append (store, &iter);
                         gtk_list_store_set (store, &iter, 0, item4->str, -1);


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