diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-09-30 11:18:02 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-10-03 16:54:22 +0200 |
commit | f70c827eba60b3a6b240672048c6956487df3a8f (patch) | |
tree | a945b8fe536d0630ba8fb44d8b7ae7ed1220c43e | |
parent | dee77447f8b0697a5ef37be94782e0bd9d31dea8 (diff) | |
download | network-manager-applet-f70c827eba60b3a6b240672048c6956487df3a8f.tar.gz |
libnma: focus first empty field in the VPN dialog
Previously the secondary field would be focused even if the first was
empty.
-rw-r--r-- | src/libnma/nma-vpn-password-dialog.c | 19 |
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 |