aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ephy-window.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index a54ee25ff..f6ce48d1b 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2606,6 +2606,45 @@ policy_decision_required_cb (WebKitWebView *web_view,
return TRUE;
}
+ if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED &&
+ ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION)
+ {
+ /* The only thing we allow here is to either navigate
+ * in the same window and tab to the current domain,
+ * or launch a new (non app mode) epiphany instance
+ * for all the other cases. */
+ gboolean return_value;
+ SoupURI *soup_uri = soup_uri_new (uri);
+ SoupURI *current_soup_uri = soup_uri_new (webkit_web_view_get_uri (web_view));
+
+ if (g_str_equal (soup_uri->host, current_soup_uri->host))
+ {
+ return_value = FALSE;
+ }
+ else
+ {
+ char *command_line;
+ GError *error = NULL;
+
+ return_value = TRUE;
+ command_line = g_strdup_printf ("gvfs-open %s", uri);
+ g_spawn_command_line_async (command_line, &error);
+
+ if (error)
+ {
+ g_debug ("Error opening %s: %s", uri, error->message);
+ g_error_free (error);
+ }
+
+ g_free (command_line);
+ }
+
+ soup_uri_free (soup_uri);
+ soup_uri_free (current_soup_uri);
+
+ return return_value;
+ }
+
if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
EphyEmbed *embed;
EphyNewTabFlags flags;