From 3bc58cbad6e9ae2ff1a3b762653654572508571f Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Fri, 29 Sep 2017 04:28:58 -0400 Subject: MqTabBody: Try again to rewrite "about:" URIs --- diff --git a/src/tab-body.c b/src/tab-body.c index 46d655c..04ffcd7 100644 --- a/src/tab-body.c +++ b/src/tab-body.c @@ -489,6 +489,25 @@ resource_load_started_cb(WebKitWebView *web_view, } } +static void +load_changed_cb(WebKitWebView *web_view, + WebKitLoadEvent __attribute__((unused)) load_event) +{ + const gchar *uri; + gchar *rw_uri; + WebKitURIRequest *request; + + uri = webkit_web_view_get_uri(web_view); + g_print("load-changed, uri = %s\n", uri); + + if (g_str_has_prefix(uri, "about:")) { + rw_uri = g_strconcat("mq-about:", uri + strlen("about:"), NULL); + request = webkit_uri_request_new(rw_uri); + g_free(rw_uri); + webkit_web_view_load_request(web_view, request); + } +} + MqTabBody * mq_tab_body_new(MqTab *tab, const gchar *uri) { @@ -514,8 +533,10 @@ mq_tab_body_new(MqTab *tab, const gchar *uri) G_CALLBACK(mouse_target_changed_cb), body); g_signal_connect(body->web_view, "button-press-event", G_CALLBACK(button_press_cb), body); - g_signal_connect(body->web_view, "resource-load-started", - G_CALLBACK(resource_load_started_cb), NULL); + //g_signal_connect(body->web_view, "resource-load-started", + // G_CALLBACK(resource_load_started_cb), NULL); + g_signal_connect(body->web_view, "load-changed", + G_CALLBACK(load_changed_cb), NULL); return body; } -- cgit v0.9.1