From 7655246b73cf1eedb8ede01e8d0c156f197dcae7 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 17 Jul 2008 15:10:28 +0200 Subject: Open URI when they are clicked in webkit --- libempathy-gtk/empathy-theme-adium.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 4bf561e2a..2b2adda5f 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -22,6 +22,8 @@ #include "config.h" #include +#include + #include #include @@ -122,6 +124,20 @@ theme_adium_load (EmpathyThemeAdium *theme) g_strfreev (strv); } +static WebKitNavigationResponse +theme_adium_navigation_requested_cb (WebKitWebView *view, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + gpointer user_data) +{ + const gchar *uri; + + uri = webkit_network_request_get_uri (request); + empathy_url_show (GTK_WIDGET (view), uri); + + return WEBKIT_NAVIGATION_RESPONSE_IGNORE; +} + static gchar * theme_adium_escape_script (const gchar *text) { @@ -194,6 +210,7 @@ theme_adium_parse_body (EmpathyThemeAdium *theme, cur = ret = g_string_free (string, FALSE); } + /* Add arround links */ uri_regex = empathy_uri_regex_dup_singleton (); match = g_regex_match (uri_regex, cur, 0, &match_info); if (match) { @@ -545,11 +562,16 @@ empathy_theme_adium_init (EmpathyThemeAdium *theme) theme->priv = priv; priv->smiley_manager = empathy_smiley_manager_new (); - theme_adium_load (theme); g_signal_connect (theme, "load-finished", G_CALLBACK (theme_adium_load_finished_cb), NULL); + g_signal_connect (theme, "navigation-requested", + G_CALLBACK (theme_adium_navigation_requested_cb), + NULL); + + + theme_adium_load (theme); } EmpathyThemeAdium * -- cgit v1.2.3