diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/web-view.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/web-view.c b/src/web-view.c index 5b649a7..0b8a26a 100644 --- a/src/web-view.c +++ b/src/web-view.c @@ -599,6 +599,16 @@ decide_policy_cb(MqWebView *web_view, WebKitPolicyDecision *decision, } } +static gchar * +rewrite_uri(const gchar *uri) +{ + if (g_str_has_prefix(uri, "about:")) { + return g_strconcat("mq-about:", uri + strlen("about:"), NULL); + } else { + return g_strdup(uri); + } +} + static void constructed(GObject *object) { @@ -620,16 +630,9 @@ constructed(GObject *object) mq_tab_page_get_application(web_view->tab_page))); if (web_view->uri) { - if (g_str_has_prefix(web_view->uri, "about:")) { - rw_uri = g_strconcat("mq-about:", - web_view->uri + strlen("about:"), NULL); - webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), - rw_uri); - g_free(rw_uri); - } else { - webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), - web_view->uri); - } + rw_uri = rewrite_uri(web_view->uri); + webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), rw_uri); + g_free(rw_uri); } else { new_tab_page = mq_config_get_string(web_view->config, "tabs.new"); @@ -788,7 +791,7 @@ mq_web_view_load_uri(MqWebView *web_view, const gchar *uri) web_view->uri = g_strdup(uri); if (g_str_has_prefix(uri, "about:")) { - rw_uri = g_strconcat("mq-about:", uri + strlen("about:"), NULL); + rw_uri = rewrite_uri(web_view->uri); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), rw_uri); g_free(rw_uri); } else { |