epiphany r8639 - trunk/src
- From: xan svn gnome org
- To: svn-commits-list gnome org
- Subject: epiphany r8639 - trunk/src
- Date: Sun, 21 Dec 2008 15:54:49 +0000 (UTC)
Author: xan
Date: Sun Dec 21 15:54:49 2008
New Revision: 8639
URL: http://svn.gnome.org/viewvc/epiphany?rev=8639&view=rev
Log:
Open links in new tab with middle click.
Bug #518338
Modified:
trunk/src/ephy-window.c
Modified: trunk/src/ephy-window.c
==============================================================================
--- trunk/src/ephy-window.c (original)
+++ trunk/src/ephy-window.c Sun Dec 21 15:54:49 2008
@@ -2481,6 +2481,42 @@
return new_web_view;
}
+static gboolean
+navigation_policy_decision_required_cb (WebKitWebView *web_view,
+ WebKitWebFrame *web_frame,
+ WebKitNetworkRequest *request,
+ WebKitWebNavigationAction *action,
+ WebKitWebPolicyDecision *decision,
+ EphyWindow *window)
+{
+ WebKitWebNavigationReason reason;
+ gint button;
+
+ reason = webkit_web_navigation_action_get_reason (action);
+ button = webkit_web_navigation_action_get_button (action);
+
+ if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED &&
+ button == 2 /* middle button */) {
+ const char *uri;
+ EphyEmbed *embed;
+
+ uri = webkit_network_request_get_uri (request);
+ embed = ephy_embed_container_get_active_child
+ (EPHY_EMBED_CONTAINER (window));
+
+ ephy_shell_new_tab (ephy_shell_get_default (),
+ window,
+ embed,
+ uri,
+ EPHY_NEW_TAB_IN_EXISTING_WINDOW |
+ EPHY_NEW_TAB_OPEN_PAGE);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
{
@@ -2510,6 +2546,9 @@
g_signal_handlers_disconnect_by_func (web_view,
G_CALLBACK (create_web_view_cb),
window);
+ g_signal_handlers_disconnect_by_func (web_view,
+ G_CALLBACK (navigation_policy_decision_required_cb),
+ window);
g_signal_handlers_disconnect_by_func (embed,
G_CALLBACK (sync_tab_popup_windows),
@@ -2594,6 +2633,9 @@
g_signal_connect_object (web_view, "create-web-view",
G_CALLBACK (create_web_view_cb),
window, 0);
+ g_signal_connect_object (web_view, "navigation-policy-decision-requested",
+ G_CALLBACK (navigation_policy_decision_required_cb),
+ window, 0);
g_signal_connect_object (embed, "notify::hidden-popup-count",
G_CALLBACK (sync_tab_popup_windows),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]