aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-theme-adium.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2008-07-17 21:10:28 +0800
committerXavier Claessens <xclaesse@gmail.com>2009-06-12 00:06:29 +0800
commit7655246b73cf1eedb8ede01e8d0c156f197dcae7 (patch)
tree056c480283ae2be55432e3739f0fa8794d9b1567 /libempathy-gtk/empathy-theme-adium.c
parent2ff2dc404fe65778b6c7451aae580e455766de89 (diff)
downloadgsoc2013-empathy-7655246b73cf1eedb8ede01e8d0c156f197dcae7.tar
gsoc2013-empathy-7655246b73cf1eedb8ede01e8d0c156f197dcae7.tar.gz
gsoc2013-empathy-7655246b73cf1eedb8ede01e8d0c156f197dcae7.tar.bz2
gsoc2013-empathy-7655246b73cf1eedb8ede01e8d0c156f197dcae7.tar.lz
gsoc2013-empathy-7655246b73cf1eedb8ede01e8d0c156f197dcae7.tar.xz
gsoc2013-empathy-7655246b73cf1eedb8ede01e8d0c156f197dcae7.tar.zst
gsoc2013-empathy-7655246b73cf1eedb8ede01e8d0c156f197dcae7.zip
Open URI when they are clicked in webkit
Diffstat (limited to 'libempathy-gtk/empathy-theme-adium.c')
-rw-r--r--libempathy-gtk/empathy-theme-adium.c24
1 files changed, 23 insertions, 1 deletions
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 <string.h>
+#include <webkit/webkitnetworkrequest.h>
+
#include <libempathy/empathy-time.h>
#include <libempathy/empathy-utils.h>
@@ -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 <a href></a> 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 *