[gnome-control-center] user-accounts: move strength meter below in the password dialog



commit e42be5dfff0f5cb2d13fd3a5208a999947a84426
Author: Ondrej Holy <oholy redhat com>
Date:   Tue Jul 23 14:52:49 2013 +0200

    user-accounts: move strength meter below in the password dialog
    
    Remove strenght hint, add verify hint and change labels also.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704407

 panels/user-accounts/data/password-dialog.ui |   73 ++++++++++++++------------
 panels/user-accounts/um-password-dialog.c    |   35 ++----------
 2 files changed, 45 insertions(+), 63 deletions(-)
---
diff --git a/panels/user-accounts/data/password-dialog.ui b/panels/user-accounts/data/password-dialog.ui
index 47ca93e..0faf3c2 100644
--- a/panels/user-accounts/data/password-dialog.ui
+++ b/panels/user-accounts/data/password-dialog.ui
@@ -39,7 +39,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
-                    <property name="top_attach">5</property>
+                    <property name="top_attach">7</property>
                   </packing>
                 </child>
                 <child>
@@ -49,6 +49,9 @@
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="label" translatable="yes"></property>
+                    <property name="width-chars">35</property>
+                    <property name="max-width-chars">35</property>
+                    <property name="height-request">50</property>
                     <property name="wrap">True</property>
                     <property name="hexpand">True</property>
                     <property name="wrap_mode">word-char</property>
@@ -65,10 +68,34 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkLabel" id="verify-hint">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
+                    <property name="label" translatable="yes"></property>
+                    <property name="width-chars">35</property>
+                    <property name="max-width-chars">35</property>
+                    <property name="wrap">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="wrap_mode">word-char</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                    <attributes>
+                      <attribute name="scale" value="0.83"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">8</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkLabel" id="password-normal-verify-label">
                     <property name="visible">True</property>
                     <property name="xalign">1</property>
-                    <property name="label" translatable="yes">C_onfirm New Password</property>
+                    <property name="label" translatable="yes">_Verify New Password</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">verify-entry</property>
                     <property name="margin_left">25</property>
@@ -78,7 +105,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">5</property>
+                    <property name="top_attach">7</property>
                   </packing>
                 </child>
                 <child>
@@ -112,40 +139,18 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="box13">
-                    <property name="orientation">vertical</property>
+                  <object class="GtkLevelBar" id="strength-indicator">
                     <property name="visible">True</property>
-                    <child>
-                      <object class="GtkLevelBar" id="strength-indicator">
-                        <property name="visible">True</property>
-                        <property name="mode">discrete</property>
-                        <property name="max-value">4</property>
-                        <offsets>
-                          <offset name="low" value="1"/>
-                          <offset name="high" value="3"/>
-                        </offsets>
-                      </object>
-                      <packing>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="strength-indicator-label">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes"></property>
-                        <attributes>
-                          <attribute name="scale" value="0.83"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
+                    <property name="mode">discrete</property>
+                    <property name="max-value">4</property>
+                    <offsets>
+                      <offset name="low" value="1"/>
+                      <offset name="high" value="3"/>
+                    </offsets>
                   </object>
                   <packing>
-                    <property name="left_attach">2</property>
-                    <property name="top_attach">4</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">5</property>
                   </packing>
                 </child>
                 <child>
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index 905c8b9..8bf699d 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -47,9 +47,9 @@ struct _UmPasswordDialog {
         GtkWidget *verify_entry;
         gint       password_entry_timeout_id;
         GtkWidget *strength_indicator;
-        GtkWidget *strength_indicator_label;
         GtkWidget *ok_button;
         GtkWidget *password_hint;
+        GtkWidget *verify_hint;
 
         ActUser *user;
         ActUserPasswordMode password_mode;
@@ -84,14 +84,7 @@ update_password_strength (UmPasswordDialog *um)
         pw_strength (password, old_password, username,
                      &hint, &long_hint, &strength_level);
 
-        if (strlen (password) == 0) {
-                strength_hint = "";
-        } else {
-                strength_hint = hint;
-        }
-
         gtk_level_bar_set_value (GTK_LEVEL_BAR (um->strength_indicator), strength_level);
-        gtk_label_set_label (GTK_LABEL (um->strength_indicator_label), strength_hint);
         gtk_label_set_label (GTK_LABEL (um->password_hint), long_hint);
 
         if (strength_level > 0) {
@@ -258,7 +251,6 @@ mode_change (UmPasswordDialog *um,
         gtk_widget_set_sensitive (um->password_entry, active);
         gtk_widget_set_sensitive (um->verify_entry, active);
         gtk_widget_set_sensitive (um->old_password_entry, active);
-        gtk_widget_set_sensitive (um->strength_indicator_label, active);
         gtk_widget_set_sensitive (um->password_hint, active);
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (um->action_now_radio), active);
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (um->action_login_radio), !active);
@@ -290,10 +282,11 @@ update_password_match (UmPasswordDialog *um)
 
         if (strlen (password) > 0 && strlen (verify) > 0) {
                 if (strcmp (password, verify) != 0) {
-                        gtk_label_set_label (GTK_LABEL (um->password_hint),
+                        gtk_label_set_label (GTK_LABEL (um->verify_hint),
                                              _("The passwords do not match."));
                 }
                 else {
+                        gtk_label_set_label (GTK_LABEL (um->verify_hint), "");
                         set_entry_validation_checkmark (GTK_ENTRY (um->verify_entry));
                 }
         }
@@ -412,18 +405,6 @@ old_password_entry_changed (GtkEntry         *entry,
                                                            um);
 }
 
-static void
-hint_allocate (GtkWidget        *label,
-               GtkAllocation    *allocation,
-               UmPasswordDialog *um)
-{
-        gint height;
-
-        /* Allocate enought space for hint and don't change */
-        height = gtk_widget_get_allocated_height (um->strength_indicator_label);
-        gtk_widget_set_size_request (label, allocation->width, height * 3);
-}
-
 UmPasswordDialog *
 um_password_dialog_new (void)
 {
@@ -431,7 +412,6 @@ um_password_dialog_new (void)
         GError *error;
         UmPasswordDialog *um;
         GtkWidget *widget;
-        gint len;
 
         builder = gtk_builder_new ();
 
@@ -493,17 +473,14 @@ um_password_dialog_new (void)
         g_signal_connect_swapped (widget, "activate", G_CALLBACK (password_entry_timeout), um);
         um->verify_entry = widget;
 
-        widget = (GtkWidget *) gtk_builder_get_object (builder, "strength-indicator-label");
-        len = pw_strength_hint_get_width_chars ();
-        gtk_label_set_width_chars (GTK_LABEL (widget), len);
-        um->strength_indicator_label = widget;
-
         um->strength_indicator = (GtkWidget *) gtk_builder_get_object (builder, "strength-indicator");
 
         widget = (GtkWidget *)gtk_builder_get_object (builder, "password-hint");
-        g_signal_connect (widget, "size-allocate", G_CALLBACK (hint_allocate), um);
         um->password_hint = widget;
 
+        widget = (GtkWidget *)gtk_builder_get_object (builder, "verify-hint");
+        um->verify_hint = widget;
+
         g_object_unref (builder);
 
         return um;


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