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



commit 654f4bb2ec468db6d4052266f9d27961b3980be7
Author: Michael Wood <michael g wood intel com>
Date:   Mon May 20 10:13:22 2013 +0100

    um-utils: Don't allow duplicates of the same suggestion
    
    Fix the initial value for the suggested login name can be added twice if
    there is only one word.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698234

 panels/user-accounts/um-utils.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/panels/user-accounts/um-utils.c b/panels/user-accounts/um-utils.c
index e21c62e..6918a2d 100644
--- a/panels/user-accounts/um-utils.c
+++ b/panels/user-accounts/um-utils.c
@@ -559,7 +559,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;
@@ -707,7 +707,8 @@ 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);


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