summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-09-30 11:18:02 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-09-30 11:35:40 +0200
commit81ff159bf70325f3184e933338db1415cd0a9f89 (patch)
tree033d6fe68e9cd7abed4266d8a4b2a8cf44b8cedb
parent6d79edef2fedf016815e03fcbdbbf898a00ecc0b (diff)
downloadnetwork-manager-applet-bg/external-ui-mode-fix.tar.gz
libnma: focus first empty field in the VPN dialogbg/external-ui-mode-fix
Previously the secondary field would be focused even if the first was empty.
-rw-r--r--src/libnma/nma-vpn-password-dialog.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libnma/nma-vpn-password-dialog.c b/src/libnma/nma-vpn-password-dialog.c
index a6738146..adc67971 100644
--- a/src/libnma/nma-vpn-password-dialog.c
+++ b/src/libnma/nma-vpn-password-dialog.c
@@ -101,19 +101,18 @@ dialog_show_callback (GtkWidget *widget, gpointer callback_data)
NMAVpnPasswordDialogPrivate *priv = NMA_VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
GtkWidget *to_focus = NULL;
- if ( gtk_widget_get_visible (priv->password_entry_tertiary)
- && gtk_entry_get_text_length (GTK_ENTRY (priv->password_entry_tertiary)) == 0) {
- to_focus = priv->password_entry_tertiary;
- }
- if ( gtk_widget_get_visible (priv->password_entry_secondary)
- && gtk_entry_get_text_length (GTK_ENTRY (priv->password_entry_secondary)) == 0) {
+ if ( gtk_widget_get_visible (priv->password_entry)
+ && gtk_entry_get_text_length (GTK_ENTRY (priv->password_entry)) == 0)
+ to_focus = priv->password_entry;
+ else if ( gtk_widget_get_visible (priv->password_entry_secondary)
+ && gtk_entry_get_text_length (GTK_ENTRY (priv->password_entry_secondary)) == 0)
to_focus = priv->password_entry_secondary;
- }
+ else if ( gtk_widget_get_visible (priv->password_entry_tertiary)
+ && gtk_entry_get_text_length (GTK_ENTRY (priv->password_entry_tertiary)) == 0)
+ to_focus = priv->password_entry_tertiary;
- if (to_focus == NULL)
- to_focus = priv->password_entry;
- gtk_widget_grab_focus (to_focus);
+ gtk_widget_grab_focus (to_focus ?: priv->password_entry);
}
static void