user-accounts: move strength meter below in the add user dialog
Remove strength hint, add verify hint, change labels and replace domain spinner by dialog spinner. https://bugzilla.gnome.org/show_bug.cgi?id=704407
This commit is contained in:
parent
e42be5dfff
commit
a4bac32271
3 changed files with 119 additions and 199 deletions
|
@ -64,8 +64,10 @@
|
|||
<property name="yalign">0</property>
|
||||
<property name="xalign">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>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
|
@ -86,7 +88,7 @@
|
|||
<property name="label" translatable="yes">_Username</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">local-username</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -115,7 +117,7 @@
|
|||
<property name="label" translatable="yes">_Full Name</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">local-name</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -149,7 +151,7 @@
|
|||
<property name="label" translatable="yes">Account _Type</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">local-account-type</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -224,7 +226,7 @@
|
|||
<property name="label" translatable="yes">_Password</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">local-password</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -255,26 +257,64 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<object class="GtkLevelBar" id="local-strength-indicator">
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="column_spacing">6</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="left_attach">1</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="local-hint">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="xalign">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="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>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">_Confirm Password</property>
|
||||
<property name="label" translatable="yes">_Verify</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">local-verify</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
|
@ -287,24 +327,24 @@
|
|||
<property name="invisible_char">●</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="activates_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="local-hint">
|
||||
<object class="GtkLabel" id="local-verify-hint">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="xalign">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"/>
|
||||
|
@ -315,54 +355,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box17">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="local-strength">
|
||||
<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>
|
||||
<child>
|
||||
<object class="GtkLevelBar" id="local-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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
|
@ -384,6 +377,7 @@
|
|||
<property name="wrap">True</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="max_width_chars">55</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -391,7 +385,7 @@
|
|||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">3</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -403,7 +397,7 @@
|
|||
<property name="label" translatable="yes">_Domain</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">enterprise-domain</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -420,10 +414,10 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">_Login Name</property>
|
||||
<property name="label" translatable="yes">_Username</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">enterprise-login</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -440,10 +434,10 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Login _Password</property>
|
||||
<property name="label" translatable="yes">_Password</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">enterprise-password</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -469,7 +463,7 @@
|
|||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">3</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -493,33 +487,6 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box18">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="enterprise-spinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="enterprise-login">
|
||||
<property name="visible">True</property>
|
||||
|
@ -573,6 +540,7 @@
|
|||
<property name="wrap">True</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="max_width_chars">55</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
|
@ -580,7 +548,7 @@
|
|||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">3</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -598,7 +566,7 @@
|
|||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">3</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -619,7 +587,7 @@ enterprise login accounts.</property>
|
|||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">3</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -732,7 +700,7 @@ type their domain password here.</property>
|
|||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">25</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
|
@ -796,6 +764,7 @@ type their domain password here.</property>
|
|||
<property name="hexpand">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="activates_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -885,10 +854,4 @@ type their domain password here.</property>
|
|||
<widget name="enterprise-password"/>
|
||||
</widgets>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="sizegroup1">
|
||||
<widgets>
|
||||
<widget name="box18"/>
|
||||
<widget name="box17"/>
|
||||
</widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -84,9 +84,9 @@ struct _UmAccountDialog {
|
|||
GtkWidget *local_password;
|
||||
GtkWidget *local_verify;
|
||||
gint local_password_timeout_id;
|
||||
GtkWidget *local_strength;
|
||||
GtkWidget *local_strength_indicator;
|
||||
GtkWidget *local_hint;
|
||||
GtkWidget *local_verify_hint;
|
||||
|
||||
/* Enterprise widgets */
|
||||
guint realmd_watch;
|
||||
|
@ -99,7 +99,6 @@ struct _UmAccountDialog {
|
|||
UmRealmManager *realm_manager;
|
||||
UmRealmObject *selected_realm;
|
||||
gboolean enterprise_check_credentials;
|
||||
GtkSpinner *enterprise_spinner;
|
||||
GtkWidget *enterprise_hint;
|
||||
gint enterprise_domain_timeout_id;
|
||||
|
||||
|
@ -143,8 +142,6 @@ show_error_dialog (UmAccountDialog *self,
|
|||
static void
|
||||
begin_action (UmAccountDialog *self)
|
||||
{
|
||||
GtkSpinner *spinner;
|
||||
|
||||
g_debug ("Beginning action, disabling dialog controls");
|
||||
|
||||
if (self->enterprise_check_credentials) {
|
||||
|
@ -153,16 +150,13 @@ begin_action (UmAccountDialog *self)
|
|||
gtk_widget_set_sensitive (self->enterprise_button, FALSE);
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
|
||||
|
||||
spinner = self->enterprise_check_credentials ? self->spinner : self->enterprise_spinner;
|
||||
gtk_widget_show (GTK_WIDGET (spinner));
|
||||
gtk_spinner_start (spinner);
|
||||
gtk_widget_show (GTK_WIDGET (self->spinner));
|
||||
gtk_spinner_start (self->spinner);
|
||||
}
|
||||
|
||||
static void
|
||||
finish_action (UmAccountDialog *self)
|
||||
{
|
||||
GtkSpinner *spinner;
|
||||
|
||||
g_debug ("Completed domain action");
|
||||
|
||||
if (self->enterprise_check_credentials) {
|
||||
|
@ -171,9 +165,8 @@ finish_action (UmAccountDialog *self)
|
|||
gtk_widget_set_sensitive (self->enterprise_button, TRUE);
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, TRUE);
|
||||
|
||||
spinner = self->enterprise_check_credentials ? self->spinner : self->enterprise_spinner;
|
||||
gtk_widget_hide (GTK_WIDGET (spinner));
|
||||
gtk_spinner_stop (spinner);
|
||||
gtk_widget_hide (GTK_WIDGET (self->spinner));
|
||||
gtk_spinner_stop (self->spinner);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -276,7 +269,6 @@ update_password_strength (UmAccountDialog *self)
|
|||
const gchar *username;
|
||||
const gchar *hint;
|
||||
const gchar *long_hint;
|
||||
const gchar *strength_hint;
|
||||
gint strength_level;
|
||||
|
||||
password = gtk_entry_get_text (GTK_ENTRY (self->local_password));
|
||||
|
@ -284,13 +276,6 @@ update_password_strength (UmAccountDialog *self)
|
|||
|
||||
pw_strength (password, NULL, username, &hint, &long_hint, &strength_level);
|
||||
|
||||
if (strlen (password) == 0) {
|
||||
strength_hint = "";
|
||||
} else {
|
||||
strength_hint = hint;
|
||||
}
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (self->local_strength), strength_hint);
|
||||
gtk_label_set_label (GTK_LABEL (self->local_hint), long_hint);
|
||||
gtk_level_bar_set_value (GTK_LEVEL_BAR (self->local_strength_indicator), strength_level);
|
||||
|
||||
|
@ -458,8 +443,9 @@ update_password_match (UmAccountDialog *self)
|
|||
verify = gtk_entry_get_text (GTK_ENTRY (self->local_verify));
|
||||
if (strlen (verify) != 0) {
|
||||
if (strcmp (password, verify) != 0) {
|
||||
gtk_label_set_label (GTK_LABEL (self->local_hint), _("Passwords do not match."));
|
||||
gtk_label_set_label (GTK_LABEL (self->local_verify_hint), _("Passwords do not match."));
|
||||
} else {
|
||||
gtk_label_set_label (GTK_LABEL (self->local_verify_hint), "");
|
||||
set_entry_validation_checkmark (GTK_ENTRY (self->local_verify));
|
||||
}
|
||||
}
|
||||
|
@ -522,25 +508,12 @@ on_password_radio_changed (GtkRadioButton *radio,
|
|||
|
||||
gtk_widget_set_sensitive (self->local_password, active);
|
||||
gtk_widget_set_sensitive (self->local_verify, active);
|
||||
gtk_widget_set_sensitive (self->local_strength, active);
|
||||
gtk_widget_set_sensitive (self->local_strength_indicator, active);
|
||||
gtk_widget_set_sensitive (self->local_hint, active);
|
||||
|
||||
dialog_validate (self);
|
||||
}
|
||||
|
||||
static void
|
||||
hint_allocate (GtkWidget *label,
|
||||
GtkAllocation *allocation,
|
||||
UmAccountDialog *self)
|
||||
{
|
||||
gint height;
|
||||
|
||||
/* Allocate enought space for hint and don't change */
|
||||
height = gtk_widget_get_allocated_height (self->local_strength);
|
||||
gtk_widget_set_size_request (label, allocation->width, height * 3);
|
||||
}
|
||||
|
||||
static void
|
||||
local_init (UmAccountDialog *self,
|
||||
GtkBuilder *builder)
|
||||
|
@ -586,10 +559,6 @@ local_init (UmAccountDialog *self,
|
|||
g_signal_connect_swapped (widget, "activate", G_CALLBACK (dialog_validate), self);
|
||||
self->local_verify = widget;
|
||||
|
||||
widget = (GtkWidget *) gtk_builder_get_object (builder, "local-strength");
|
||||
gtk_widget_set_sensitive (widget, FALSE);
|
||||
self->local_strength = widget;
|
||||
|
||||
widget = (GtkWidget *) gtk_builder_get_object (builder, "local-strength-indicator");
|
||||
gtk_widget_set_sensitive (widget, FALSE);
|
||||
self->local_strength_indicator = widget;
|
||||
|
@ -598,6 +567,9 @@ local_init (UmAccountDialog *self,
|
|||
gtk_widget_set_sensitive (widget, FALSE);
|
||||
self->local_hint = widget;
|
||||
|
||||
widget = (GtkWidget *) gtk_builder_get_object (builder, "local-verify-hint");
|
||||
self->local_verify_hint = widget;
|
||||
|
||||
dialog_validate (self);
|
||||
update_password_strength (self);
|
||||
}
|
||||
|
@ -1322,10 +1294,6 @@ enterprise_init (UmAccountDialog *self,
|
|||
GTK_TREE_MODEL (self->enterprise_realms));
|
||||
self->enterprise_domain_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget)));
|
||||
|
||||
widget = (GtkWidget *) gtk_builder_get_object (builder, "enterprise-spinner");
|
||||
gtk_widget_hide (widget);
|
||||
self->enterprise_spinner = GTK_SPINNER (widget);
|
||||
|
||||
widget = (GtkWidget *) gtk_builder_get_object (builder, "enterprise-login");
|
||||
g_signal_connect (widget, "changed", G_CALLBACK (on_entry_changed), self);
|
||||
self->enterprise_login = GTK_ENTRY (widget);
|
||||
|
@ -1628,8 +1596,6 @@ um_account_dialog_show (UmAccountDialog *self,
|
|||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint len;
|
||||
|
||||
g_return_if_fail (UM_IS_ACCOUNT_DIALOG (self));
|
||||
|
||||
/* Make sure not already doing an operation */
|
||||
|
@ -1654,14 +1620,6 @@ um_account_dialog_show (UmAccountDialog *self,
|
|||
gtk_window_set_transient_for (GTK_WINDOW (self), parent);
|
||||
gtk_window_present (GTK_WINDOW (self));
|
||||
gtk_widget_grab_focus (self->local_name);
|
||||
|
||||
/* Allocate enought width for strength hint */
|
||||
len = pw_strength_hint_get_width_chars ();
|
||||
gtk_label_set_width_chars (GTK_LABEL (self->local_strength), len);
|
||||
|
||||
/* Allocate enought space for password and username hints and do not change */
|
||||
g_signal_connect (self->local_username_hint, "size-allocate", G_CALLBACK (hint_allocate), self);
|
||||
g_signal_connect (self->local_hint, "size-allocate", G_CALLBACK (hint_allocate), self);
|
||||
}
|
||||
|
||||
ActUser *
|
||||
|
|
|
@ -71,7 +71,6 @@ update_password_strength (UmPasswordDialog *um)
|
|||
gint strength_level;
|
||||
const gchar *hint;
|
||||
const gchar *long_hint;
|
||||
const gchar *strength_hint;
|
||||
|
||||
if (um->user == NULL) {
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue