aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-09-22 00:44:51 +0800
committerCarlos Garcia Campos <cgarcia@igalia.com>2013-01-11 16:59:24 +0800
commitebe9853a9973d1bf07526089014ae4cabd17628d (patch)
tree09e105d8f947bc0f31f2fed9e99183ccbf1f5598
parentf256d7fc2dac4f1a3abbcc594be51f62b6f13496 (diff)
downloadgsoc2013-epiphany-ebe9853a9973d1bf07526089014ae4cabd17628d.tar
gsoc2013-epiphany-ebe9853a9973d1bf07526089014ae4cabd17628d.tar.gz
gsoc2013-epiphany-ebe9853a9973d1bf07526089014ae4cabd17628d.tar.bz2
gsoc2013-epiphany-ebe9853a9973d1bf07526089014ae4cabd17628d.tar.lz
gsoc2013-epiphany-ebe9853a9973d1bf07526089014ae4cabd17628d.tar.xz
gsoc2013-epiphany-ebe9853a9973d1bf07526089014ae4cabd17628d.tar.zst
gsoc2013-epiphany-ebe9853a9973d1bf07526089014ae4cabd17628d.zip
Port delete web application to WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=684448
-rw-r--r--src/ephy-window.c96
1 files changed, 55 insertions, 41 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 5b309a09c..1282bc1d3 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2577,58 +2577,72 @@ decide_policy_cb (WebKitWebView *web_view,
return return_value;
}
- if (navigation_type != WEBKIT_NAVIGATION_TYPE_LINK_CLICKED)
- return FALSE;
+ if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED)
+ {
+ gint button;
+ gint state;
+ EphyNewTabFlags flags;
+ button = webkit_navigation_policy_decision_get_mouse_button (navigation_decision);
+ state = webkit_navigation_policy_decision_get_modifiers (navigation_decision);
+ flags = EPHY_NEW_TAB_OPEN_PAGE;
- button = webkit_navigation_policy_decision_get_mouse_button (navigation_decision);
- state = webkit_navigation_policy_decision_get_modifiers (navigation_decision);
- flags = EPHY_NEW_TAB_OPEN_PAGE;
+ ephy_web_view_set_visit_type (EPHY_WEB_VIEW (web_view),
+ EPHY_PAGE_VISIT_LINK);
- ephy_web_view_set_visit_type (EPHY_WEB_VIEW (web_view),
- EPHY_PAGE_VISIT_LINK);
+ /* New tab in new window for control+shift+click */
+ if (button == 1 && state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
+ {
+ flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
+ }
+ /* New tab in existing window for middle click and
+ * control+click */
+ else if (button == 2 || (button == 1 && state == GDK_CONTROL_MASK))
+ {
+ flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_APPEND_AFTER;
+ }
+ /* Because we connect to button-press-event *after*
+ * (G_CONNECT_AFTER) we need to prevent WebKit from browsing to
+ * a link when you shift+click it. Otherwise when you
+ * shift+click a link to download it you would also be taken to
+ * the link destination. */
+ else if (button == 1 && state == GDK_SHIFT_MASK)
+ {
+ webkit_policy_decision_ignore (decision);
+
+ return TRUE;
+ }
+ /* Those were our special cases, we won't handle this */
+ else
+ {
+ return FALSE;
+ }
+
+ embed = ephy_embed_container_get_active_child
+ (EPHY_EMBED_CONTAINER (window));
+
+ ephy_shell_new_tab_full (ephy_shell_get_default (),
+ window,
+ embed,
+ request,
+ flags,
+ EPHY_WEB_VIEW_CHROME_ALL, FALSE, 0);
- /* New tab in new window for control+shift+click */
- if (button == 1 && state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
- {
- flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
- }
- /* New tab in existing window for middle click and
- * control+click */
- else if (button == 2 || (button == 1 && state == GDK_CONTROL_MASK))
- {
- flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_APPEND_AFTER;
- }
- /* Because we connect to button-press-event *after*
- * (G_CONNECT_AFTER) we need to prevent WebKit from browsing to
- * a link when you shift+click it. Otherwise when you
- * shift+click a link to download it you would also be taken to
- * the link destination. */
- else if (button == 1 && state == GDK_SHIFT_MASK)
- {
webkit_policy_decision_ignore (decision);
return TRUE;
}
- /* Those were our special cases, we won't handle this */
- else
- {
- return FALSE;
- }
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
- ephy_shell_new_tab_full (ephy_shell_get_default (),
- window,
- embed,
- request,
- flags,
- EPHY_WEB_VIEW_CHROME_ALL, FALSE, 0);
+ if (navigation_type == WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED && uri &&
+ g_str_has_prefix (uri, "ephy-about:applications"))
+ {
+ delete_web_app (uri);
+ webkit_policy_decision_use (decision);
- webkit_policy_decision_ignore (decision);
+ return TRUE;
+ }
- return TRUE;
+ return FALSE;
}
#else
static gboolean