[gnome-initial-setup/shell/4765: 200/362] Skip empty words when generating suggested usernames



commit 5ba23261105d9bb8c58d297decb6a6ef918b8a7c
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Sep 5 07:29:29 2014 +0000

    Skip empty words when generating suggested usernames
    
    When creating the list of potential login names from the full user name we
    could obtain empty words.
    
    Just skip then in the algorithm.
    
    [endlessm/eos-shell#3534]

 gnome-initial-setup/pages/account/um-utils.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/um-utils.c b/gnome-initial-setup/pages/account/um-utils.c
index 0ee5920..6853455 100644
--- a/gnome-initial-setup/pages/account/um-utils.c
+++ b/gnome-initial-setup/pages/account/um-utils.c
@@ -313,7 +313,7 @@ generate_username_choices (const gchar  *name,
         items = g_hash_table_new (g_str_hash, g_str_equal);
 
         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);
@@ -321,7 +321,7 @@ 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);
@@ -331,7 +331,7 @@ generate_username_choices (const gchar  *name,
         if (nwords2 > 1) {
                 /* add other items */
                 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);
@@ -339,7 +339,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);
@@ -347,7 +347,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);
@@ -356,7 +356,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);
@@ -365,7 +365,7 @@ generate_username_choices (const gchar  *name,
 
                 /* ...and the first one */
                 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);


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