[gnome-initial-setup] account: Add a GtkLevelBar to show password strength



commit ba39610d4ac7657c07b9c09a7ba5f4ea17b8fd65
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Nov 25 21:40:31 2012 -0500

    account: Add a GtkLevelBar to show password strength

 .../pages/account/gis-account-page.c               |    8 ++++++--
 .../pages/account/gis-account-page.ui              |   14 ++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c b/gnome-initial-setup/pages/account/gis-account-page.c
index 0162311..573caa9 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -284,19 +284,23 @@ update_password_entries (GisAccountPage *page)
   GtkWidget *password_entry;
   GtkWidget *confirm_entry;
   GtkWidget *username_combo;
-  gdouble strength;
+  GtkLevelBar *password_strength;
+  gdouble strength, strength_level;
   const gchar *hint;
   const gchar *long_hint = NULL;
 
   password_entry = WID("account-password-entry");
   confirm_entry = WID("account-confirm-entry");
   username_combo = WID("account-username-combo");
+  password_strength = WID("account-password-strength");
 
   password = gtk_entry_get_text (GTK_ENTRY (password_entry));
   verify = gtk_entry_get_text (GTK_ENTRY (confirm_entry));
   username = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (username_combo));
 
-  strength = pw_strength (password, NULL, username, &hint, &long_hint, NULL);
+  strength = pw_strength (password, NULL, username, &hint, &long_hint, &strength_level);
+
+  gtk_level_bar_set_value (password_strength, strength_level);
 
   if (strength == 0.0) {
     priv->valid_password = FALSE;
diff --git a/gnome-initial-setup/pages/account/gis-account-page.ui b/gnome-initial-setup/pages/account/gis-account-page.ui
index 00b6a39..617e7f1 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.ui
+++ b/gnome-initial-setup/pages/account/gis-account-page.ui
@@ -209,6 +209,20 @@
               </packing>
             </child>
             <child>
+              <object class="GtkLevelBar" id="account-password-strength">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="halign">start</property>
+                <property name="min-value">0</property>
+                <property name="max-value">3</property>
+                <property name="mode">discrete</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkLabel" id="account-confirm-label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>



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