[libnma/lr/gtk-4.0: 7/33] vpn-password-dialog: don't respond to activation with activate_default()
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libnma/lr/gtk-4.0: 7/33] vpn-password-dialog: don't respond to activation with activate_default()
- Date: Fri, 15 Oct 2021 12:24:12 +0000 (UTC)
commit 76654c95d4a57d9736498b6229306cf074884ce1
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Oct 13 11:45:33 2021 +0200
vpn-password-dialog: don't respond to activation with activate_default()
In absence of an widget that receives the default activations this
results in activation of the currently focused widget. This results in
infinite recursion if we're responding to its activation in the first
place.
Even though this would be a programming error, it's difficult to spot
and can be caused just with an ommission of a single property in the
GtkBuilder side.
Let's be on the safe side and just invoke the response directly.
src/nma-vpn-password-dialog.c | 12 ++++++++++--
src/nma-vpn-password-dialog.ui | 6 +++---
2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/nma-vpn-password-dialog.c b/src/nma-vpn-password-dialog.c
index 08511cdd..a755f4f7 100644
--- a/src/nma-vpn-password-dialog.c
+++ b/src/nma-vpn-password-dialog.c
@@ -11,7 +11,7 @@
* Library General Public License for more details.
*
* Copyright (C) 1999, 2000 Eazel, Inc.
- * Copyright (C) 2011 - 2018 Red Hat, Inc.
+ * Copyright (C) 2011 - 2021 Red Hat, Inc.
*
* Authors: Ramiro Estrugo <ramiro eazel com>
* Dan Williams <dcbw redhat com>
@@ -63,6 +63,14 @@ show_passwords_toggled_cb (GtkWidget *widget, gpointer user_data)
gtk_entry_set_visibility (GTK_ENTRY (priv->password_entry_tertiary), visible);
}
+static void
+entry_activate_cb (GtkButton *button, gpointer user_data)
+{
+ GtkDialog *dialog = GTK_DIALOG (user_data);
+
+ gtk_dialog_response (dialog, GTK_RESPONSE_OK);
+}
+
static void
nma_vpn_password_dialog_class_init (NMAVpnPasswordDialogClass *klass)
{
@@ -83,7 +91,7 @@ nma_vpn_password_dialog_class_init (NMAVpnPasswordDialogClass *klass)
gtk_widget_class_bind_template_callback (widget_class, dialog_close_callback);
gtk_widget_class_bind_template_callback (widget_class, dialog_show_callback);
- gtk_widget_class_bind_template_callback (widget_class, nma_gtk_widget_activate_default);
+ gtk_widget_class_bind_template_callback (widget_class, entry_activate_cb);
gtk_widget_class_bind_template_callback (widget_class, show_passwords_toggled_cb);
}
diff --git a/src/nma-vpn-password-dialog.ui b/src/nma-vpn-password-dialog.ui
index 5f299e84..8a3138a6 100644
--- a/src/nma-vpn-password-dialog.ui
+++ b/src/nma-vpn-password-dialog.ui
@@ -90,7 +90,7 @@
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="width_chars">20</property>
- <signal name="activate" handler="nma_gtk_widget_activate_default" swapped="yes"/>
+ <signal name="activate" handler="entry_activate_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
@@ -103,7 +103,7 @@
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="width_chars">20</property>
- <signal name="activate" handler="nma_gtk_widget_activate_default" swapped="yes"/>
+ <signal name="activate" handler="entry_activate_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
@@ -116,7 +116,7 @@
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="width_chars">20</property>
- <signal name="activate" handler="nma_gtk_widget_activate_default" swapped="yes"/>
+ <signal name="activate" handler="entry_activate_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]