[gnome-initial-setup] um-utils: Don't allow duplicates of the same suggestion



commit bb073d15d191dbaa6570d2e9d8770b82504700d8
Author: Michael Wood <michael g wood intel com>
Date:   Fri May 17 19:24:37 2013 +0100

    um-utils: Don't allow duplicates of the same suggestion
    
    The initial value for the suggested login name can be added twice if
    there is only one word.

 gnome-initial-setup/pages/account/um-utils.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/um-utils.c b/gnome-initial-setup/pages/account/um-utils.c
index d8fa435..7d9fafe 100644
--- a/gnome-initial-setup/pages/account/um-utils.c
+++ b/gnome-initial-setup/pages/account/um-utils.c
@@ -153,7 +153,7 @@ void
 generate_username_choices (const gchar  *name,
                            GtkListStore *store)
 {
-        gboolean in_use;
+        gboolean in_use, same_as_initial;
         char *lc_name, *ascii_name, *stripped_name;
         char **words1;
         char **words2 = NULL;
@@ -301,12 +301,12 @@ generate_username_choices (const gchar  *name,
         }
 
         in_use = is_username_used (item1->str);
-        if (nwords2 > 0 && !in_use && !g_ascii_isdigit (item1->str[0])) {
+        same_as_initial = (g_strcmp0 (item0->str, item1->str) == 0);
+        if (!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);
         }
-
         /* if there's only one word, would be the same as item1 */
         if (nwords2 > 1) {
                 /* add other items */


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