[libnma/lr/pkcs11-fixes: 11/12] cert-chooser-dialog: respond successfully to a double-click
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libnma/lr/pkcs11-fixes: 11/12] cert-chooser-dialog: respond successfully to a double-click
- Date: Mon, 21 Mar 2022 13:03:57 +0000 (UTC)
commit 2a7de7305c6594d5127f2c3457ec16e30b8e1537
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Jan 19 10:15:44 2022 +0100
cert-chooser-dialog: respond successfully to a double-click
For some reason, gtk_dialog_set_default_response() doesn't do the right
thing after gtk_dialog_set_response_sensitive() was invoked. Let's make
sure we explicitly return an GTK_RESPONSE_ACCEPT once the user
double-clicks the chosen certificate object.
src/nma-pkcs11-cert-chooser-dialog.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/nma-pkcs11-cert-chooser-dialog.c b/src/nma-pkcs11-cert-chooser-dialog.c
index f77a3886..93500e88 100644
--- a/src/nma-pkcs11-cert-chooser-dialog.c
+++ b/src/nma-pkcs11-cert-chooser-dialog.c
@@ -50,6 +50,8 @@ struct _NMAPkcs11CertChooserDialogPrivate {
GtkCellRenderer *list_name_renderer;
GtkTreeViewColumn *list_issued_by_column;
GtkCellRenderer *list_issued_by_renderer;
+
+ gboolean object_selected;
};
#define NMA_PKCS11_CERT_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
@@ -283,18 +285,23 @@ static void
row_activated (GtkTreeView *tree_view, GtkTreePath *path,
GtkTreeViewColumn *column, gpointer user_data)
{
- if (gtk_window_activate_default (GTK_WINDOW (user_data)))
- return;
+ NMAPkcs11CertChooserDialog *self = user_data;
+ NMAPkcs11CertChooserDialogPrivate *priv = self->priv;
+
+ if (priv->object_selected)
+ gtk_dialog_response(GTK_DIALOG (user_data), GTK_RESPONSE_ACCEPT);
}
static void
cursor_changed (GtkTreeView *tree_view, gpointer user_data)
{
NMAPkcs11CertChooserDialog *self = NMA_PKCS11_CERT_CHOOSER_DIALOG (user_data);
+ NMAPkcs11CertChooserDialogPrivate *priv = self->priv;
gchar *uri;
uri = nma_pkcs11_cert_chooser_dialog_get_uri (self);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_ACCEPT, uri != NULL);
+ priv->object_selected = uri != NULL;
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_ACCEPT, priv->object_selected);
g_free (uri);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]