[network-manager-applet/bg/external-ui-mode-fix: 45/45] libnma: focus first empty field in the VPN dialog
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/bg/external-ui-mode-fix: 45/45] libnma: focus first empty field in the VPN dialog
- Date: Mon, 30 Sep 2019 09:41:30 +0000 (UTC)
commit 81ff159bf70325f3184e933338db1415cd0a9f89
Author: Beniamino Galvani <bgalvani redhat com>
Date: Mon Sep 30 11:18:02 2019 +0200
libnma: focus first empty field in the VPN dialog
Previously the secondary field would be focused even if the first was
empty.
src/libnma/nma-vpn-password-dialog.c | 19 +++++++++----------
1 file 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]