[empathy: 6/28] Handle links via external browser



commit 0f84b8fa5a7f061cb5f82ed489e22f15ae2bc7cc
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Mon Aug 1 15:51:23 2011 +1000

    Handle links via external browser

 libempathy-gtk/empathy-log-window.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index ef6450f..f81ea4c 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -482,6 +482,21 @@ store_events_rows_reordered (GtkTreeModel *model,
   g_strfreev (new_order_strv);
 }
 
+static gboolean
+events_webview_handle_navigation (WebKitWebView *webview,
+    WebKitWebFrame *frame,
+    WebKitNetworkRequest *request,
+    WebKitWebNavigationAction *navigation_action,
+    WebKitWebPolicyDecision *policy_decision,
+    EmpathyLogWindow *window)
+{
+  empathy_url_show (GTK_WIDGET (webview),
+      webkit_network_request_get_uri (request));
+
+  webkit_web_policy_decision_ignore (policy_decision);
+  return TRUE;
+}
+
 static GObject *
 empathy_log_window_constructor (GType type,
     guint n_props,
@@ -703,6 +718,10 @@ empathy_log_window_init (EmpathyLogWindow *self)
       g_file_get_uri (gfile));
   g_object_unref (gfile);
 
+  /* handle all navigation externally */
+  g_signal_connect (self->priv->webview, "navigation-policy-decision-requested",
+      G_CALLBACK (events_webview_handle_navigation), self);
+
   gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
       sw, gtk_label_new ("webview"));
   gtk_widget_show_all (sw);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]