[empathy] Open URI when they are clicked in webkit
- From: Xavier Claessens <xclaesse src gnome org>
- To: svn-commits-list gnome org
- Subject: [empathy] Open URI when they are clicked in webkit
- Date: Thu, 11 Jun 2009 14:54:38 -0400 (EDT)
commit 7655246b73cf1eedb8ede01e8d0c156f197dcae7
Author: Xavier Claessens <xclaesse gmail com>
Date: Thu Jul 17 15:10:28 2008 +0200
Open URI when they are clicked in webkit
libempathy-gtk/empathy-theme-adium.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index 4bf561e..2b2adda 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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]