[krb5-auth-dialog] pwdialog: Use a main loop
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] pwdialog: Use a main loop
- Date: Tue, 18 Oct 2022 10:16:21 +0000 (UTC)
commit 1c468a57c6ffd6025bf2f2e68bf9229d1ab1fc01
Author: Guido Günther <agx sigxcpu org>
Date: Mon Oct 17 10:13:56 2022 +0200
pwdialog: Use a main loop
There's no gtk_dialog_run (for good reason) in GTK4. Work around
that by spawning a new main loop for the moment as the Kerberos function
expects a blocking call. We'll improve that past the GTK4 transition.
src/ka-pwdialog.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/src/ka-pwdialog.c b/src/ka-pwdialog.c
index 54d64d8..26cd7f5 100644
--- a/src/ka-pwdialog.c
+++ b/src/ka-pwdialog.c
@@ -155,18 +155,43 @@ ka_pwdialog_new (void)
return pwdialog;
}
+int response;
+
+
+static void
+on_response (GtkDialog *dialog, int response_id, GMainLoop *main_loop)
+{
+ response = response_id;
+ g_main_loop_quit (main_loop);
+}
+
gint
ka_pwdialog_run (KaPwDialog *self)
{
+ int id;
+ g_autoptr (GMainLoop) dialog_main_loop = NULL;
+
/* cleanup old error dialog, if present (e.g. user didn't acknowledge
* the error but clicked the tray icon again) */
if (self->priv->error_dialog)
gtk_widget_hide (self->priv->error_dialog);
gtk_widget_grab_focus (self->priv->pw_entry);
+
+ /* FIXME: we use a separate main loop as the Kerberos code wants
+ us to return a response. This is not worse than it was before -
+ it's just that gtk_dialog_run() going a way in GTK4 makes this
+ more obvious. */
+ dialog_main_loop = g_main_loop_new (NULL, FALSE);
+ id = g_signal_connect (self, "response", G_CALLBACK (on_response), dialog_main_loop);
+
gtk_widget_show (GTK_WIDGET (self));
- return gtk_dialog_run (GTK_DIALOG (self));
+ g_main_loop_run (dialog_main_loop);
+
+ g_signal_handler_disconnect (self, id);
+
+ return response;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]