Skip to content

Commit

Permalink
Get rid of deprecated NavigationPolicyDecision props
Browse files Browse the repository at this point in the history
Signed-off-by: Jiří Janoušek <janousek.jiri@gmail.com>
  • Loading branch information
jiri-janousek committed Sep 12, 2016
1 parent 010917d commit b871671
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/nuvolakit-runner/gui/WelcomeWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public class WelcomeWindow : Diorite.ApplicationWindow

private bool decide_navigation_policy(bool new_window, WebKit.NavigationPolicyDecision decision)
{
var uri = decision.request.uri;
var uri = decision.navigation_action.get_request().uri;
if (!uri.has_prefix("http://") && !uri.has_prefix("https://") || uri == PATRONS_BOX_URI)
return false;

Expand Down
14 changes: 9 additions & 5 deletions src/nuvolakit-runner/webkit/WebEngine.vala
Original file line number Diff line number Diff line change
Expand Up @@ -551,18 +551,22 @@ public class WebEngine : GLib.Object, JSExecutor

private bool decide_navigation_policy(bool new_window, WebKit.NavigationPolicyDecision decision)
{
var uri = decision.request.uri;
var action = decision.navigation_action;
var uri = action.get_request().uri;
if (!uri.has_prefix("http://") && !uri.has_prefix("https://"))
return false;

var new_window_override = new_window;
var result = navigation_request(uri, ref new_window_override);
var type = decision.navigation_type;
debug("Navigation, %s window: uri = %s, result = %s, frame = %s, type = %s",
new_window_override ? "new" : "current", uri, result.to_string(), decision.frame_name, type.to_string());

var type = action.get_navigation_type();
var user_gesture = action.is_user_gesture();
debug("Navigation, %s window: uri = %s, result = %s, frame = %s, type = %s, user gesture %s",
new_window_override ? "new" : "current", uri, result.to_string(), decision.frame_name, type.to_string(),
user_gesture.to_string());

// We care only about user clicks
if (type != WebKit.NavigationType.LINK_CLICKED)
if (type != WebKit.NavigationType.LINK_CLICKED || user_gesture)
return false;

if (result)
Expand Down

0 comments on commit b871671

Please sign in to comment.