logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 2a4e981821edcf340d1324560e95c08a4674bc22
parent: d55586e83772238fd1adf9ca9370f37697b29e33
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 13 Dec 2019 03:48:36 +0100

Add GtkMessageDialog on load-failed-with-tls-errors

Diffstat:

Mbadwolf.c26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -354,6 +354,28 @@ WebViewCb_decide_policy(WebKitWebView *web_view, return TRUE; } +static gboolean +WebViewCb_load_failed_with_tls_errors(WebKitWebView *web_view, + gchar *failing_uri, + GTlsCertificate *certificate, + GTlsCertificateFlags errors, + gpointer user_data) +{ + (void)web_view; + (void)certificate; + (void)errors; + struct Client *browser = (struct Client *)user_data; + + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(browser->window->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "TLS Error for: %s", + failing_uri); + + return FALSE; /* propagate the event further */ +} + static void web_contextCb_download_started(WebKitWebContext *web_context, WebKitDownload *download, @@ -606,6 +628,10 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web g_signal_connect( browser->webView, "permission-request", G_CALLBACK(WebViewCb_permission_request), NULL); g_signal_connect(browser->webView, "decide-policy", G_CALLBACK(WebViewCb_decide_policy), NULL); + g_signal_connect(browser->webView, + "load-failed-with-tls-errors", + G_CALLBACK(WebViewCb_load_failed_with_tls_errors), + browser); /* signals for WebView's WebContext */ g_signal_connect(G_OBJECT(web_context),