diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2010-08-13 18:32:43 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2010-08-13 22:22:25 +0800 |
commit | c61bb1765e65369933a571b6dccb07ec338cb515 (patch) | |
tree | cbba30cae7b9f66931c003f025a909bff3d445a1 | |
parent | ae9cd01797616138fc16931e558fa1b65d9301eb (diff) | |
download | gsoc2013-empathy-c61bb1765e65369933a571b6dccb07ec338cb515.tar gsoc2013-empathy-c61bb1765e65369933a571b6dccb07ec338cb515.tar.gz gsoc2013-empathy-c61bb1765e65369933a571b6dccb07ec338cb515.tar.bz2 gsoc2013-empathy-c61bb1765e65369933a571b6dccb07ec338cb515.tar.lz gsoc2013-empathy-c61bb1765e65369933a571b6dccb07ec338cb515.tar.xz gsoc2013-empathy-c61bb1765e65369933a571b6dccb07ec338cb515.tar.zst gsoc2013-empathy-c61bb1765e65369933a571b6dccb07ec338cb515.zip |
Integrate the dialog into the auth helper
-rw-r--r-- | src/empathy-auth-helper.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/empathy-auth-helper.c b/src/empathy-auth-helper.c index 6cbffea94..065fc8ded 100644 --- a/src/empathy-auth-helper.c +++ b/src/empathy-auth-helper.c @@ -32,6 +32,7 @@ #include <libempathy/empathy-server-tls-handler.h> #include <libempathy/empathy-tls-verifier.h> +#include <libempathy-gtk/empathy-tls-dialog.h> #include <libempathy-gtk/empathy-ui-utils.h> #include <gnutls/gnutls.h> @@ -39,6 +40,45 @@ #include <extensions/extensions.h> static void +tls_dialog_response_cb (GtkDialog *dialog, + gint response_id, + gpointer user_data) +{ + EmpathyTLSCertificate *certificate = NULL; + EmpTLSCertificateRejectReason reason = 0; + EmpathyTLSDialog *tls_dialog = EMPATHY_TLS_DIALOG (dialog); + + DEBUG ("Response %d", response_id); + + g_object_get (tls_dialog, + "certificate", &certificate, + "reason", &reason, + NULL); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + + if (response_id == GTK_RESPONSE_YES) + empathy_tls_certificate_accept (certificate); + else + empathy_tls_certificate_reject (certificate, reason, TRUE); + + g_object_unref (certificate); +} + +static void +display_interactive_dialog (EmpathyTLSCertificate *certificate, + EmpTLSCertificateRejectReason reason) +{ + GtkWidget *tls_dialog; + + tls_dialog = empathy_tls_dialog_new (certificate, reason); + g_signal_connect (tls_dialog, "response", + G_CALLBACK (tls_dialog_response_cb), NULL); + + gtk_widget_show (tls_dialog); +} + +static void verifier_verify_cb (GObject *source, GAsyncResult *result, gpointer user_data) @@ -58,7 +98,7 @@ verifier_verify_cb (GObject *source, if (error != NULL) { DEBUG ("Error: %s", error->message); - empathy_tls_certificate_reject (certificate, reason, FALSE); + display_interactive_dialog (certificate, reason); g_error_free (error); } |