From: Christian Dywan Date: Sun, 20 Sep 2009 18:56:52 +0000 (+0200) Subject: Forward mailto: links to external default application X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d73ccf2c3f671870ec092a5cac05e3fda7d1e612;p=midori Forward mailto: links to external default application --- diff --git a/midori/midori-view.c b/midori/midori-view.c index d51e0f85..c9491222 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -701,6 +701,26 @@ midori_view_update_load_status (MidoriView* view, view->load_status != MIDORI_LOAD_FINISHED); } +static gboolean +midori_view_web_view_navigation_decision_cb (WebKitWebView* web_view, + WebKitWebFrame* web_frame, + WebKitNetworkRequest* request, + WebKitWebNavigationAction* action, + WebKitWebPolicyDecision* decision, + MidoriView* view) +{ + const gchar* uri = webkit_network_request_get_uri (request); + if (g_str_has_prefix (uri, "mailto:")) + { + webkit_web_policy_decision_ignore (decision); + sokoke_show_uri (gtk_widget_get_screen (GTK_WIDGET (web_view)), + uri, GDK_CURRENT_TIME, NULL); + return TRUE; + } + /* TODO: Handle more external protocols */ + return FALSE; +} + static void webkit_web_view_load_started_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, @@ -2388,6 +2408,8 @@ midori_view_construct_web_view (MidoriView* view) web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)); g_object_connect (view->web_view, + "signal::navigation-policy-decision-requested", + midori_view_web_view_navigation_decision_cb, view, "signal::load-started", webkit_web_view_load_started_cb, view, "signal::load-committed",