[gnome-control-center/gnome-3-8] user-accounts: Avoid a warning on startup



commit f5509c6b2b16254e5b5b8f04691e28b3906823d7
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 20 18:01:43 2013 +0100

    user-accounts: Avoid a warning on startup
    
    As a user was not set on the password dialog yet. Also make
    sure that we do not try to update the password strength label
    before anyone has entered anything in the dialogue itself.

 panels/user-accounts/data/password-dialog.ui |    2 +-
 panels/user-accounts/um-password-dialog.c    |    7 +++++++
 panels/user-accounts/um-user-panel.c         |    1 +
 3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/panels/user-accounts/data/password-dialog.ui b/panels/user-accounts/data/password-dialog.ui
index c4767c6..81de04f 100644
--- a/panels/user-accounts/data/password-dialog.ui
+++ b/panels/user-accounts/data/password-dialog.ui
@@ -184,7 +184,7 @@
                           <object class="GtkLabel" id="strength-indicator-label">
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Fair</property>
+                            <property name="label"></property>
                           </object>
                           <packing>
                             <property name="position">1</property>
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index 439bdf9..041f85f 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -286,6 +286,13 @@ update_sensitivity (UmPasswordDialog *um)
         password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));
         verify = gtk_entry_get_text (GTK_ENTRY (um->verify_entry));
         old_password = gtk_entry_get_text (GTK_ENTRY (um->old_password_entry));
+
+        /* Don't update the password strength if we didn't enter anything */
+        if (password && *password == '\0' &&
+            verify && *verify == '\0' &&
+            old_password && *old_password == '\0')
+                return;
+
         strength_level = update_password_strength (um);
 
         if (strength_level < 1) {
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index d14de73..60abdca 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -1117,6 +1117,7 @@ on_permission_changed (GPermission *permission,
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, 
"account-fingerprint-notebook")), 0);
         }
 
+        um_password_dialog_set_user (d->password_dialog, user);
         um_password_dialog_set_privileged (d->password_dialog, is_authorized);
 
         g_object_unref (user);


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