diff options
-rw-r--r-- | NEWS | 3 | ||||
-rwxr-xr-x | control-center | 21 |
2 files changed, 16 insertions, 8 deletions
@@ -1,3 +1,6 @@ +- port to WebKit2 (mga#15031) + (as a side effect, resident memory is lower :-) ) + Version 13.2 - 24 February 2016, Thierry Vignaud - adapt to draktools library changes diff --git a/control-center b/control-center index 1fa9f1d9..2cc98a0d 100755 --- a/control-center +++ b/control-center @@ -38,7 +38,7 @@ POSIX::sigprocmask(SIG_BLOCK, POSIX::SigSet->new(SIGCHLD)); BEGIN { unshift @::textdomains, 'drakconf' } use mygtk3 qw(gtknew); use ugtk3 qw(:create :dialogs :helpers :wrappers); -use Gtk3::WebKit; +use Gtk3::WebKit2; use MDV::Control_Center; @@ -686,10 +686,12 @@ my $menu = $ui->get_widget('/MenuBar'); my @buttons; my $offset = 15; -$view = gtknew('WebKit_WebView', no_popup_menu => 1); -$view->signal_connect('load-finished' => sub { +$view = gtknew('WebKit2_WebView', no_popup_menu => 1); +$view->signal_connect('load-changed' => sub { + my (undef, $msg) = @_; state $done; return if $done; + return if $msg ne 'finished'; $done = 1; load_program() if $program; }); @@ -845,7 +847,7 @@ sub build_widget_element { my (@strings, $current_string_idx); sub load_view() { - $view->load_html_string($strings[$current_string_idx], 'file:///'); + $view->load_html($strings[$current_string_idx], 'file:///'); } sub build_list() { @@ -980,17 +982,18 @@ foreach (@tree) { } } -$view->signal_connect('navigation-requested' => +$view->signal_connect('decide-policy' => sub { - my (undef, undef, $request) = @_; - my $res = 'ignore'; + my (undef, $decision, $type) = @_; + my $res = 'true'; + my $request = $decision->get_request; # get the actual program ID: my $url = eval { Glib::filename_from_uri($request->get_uri) }; $url =~ s!^/*!!; # not a path # workaround wekbit calling navigation-requested with "/": - return 'accept' if !$url; + return if !$url; # url can be a translated UTF-8 string (eg: for CD/DVD entries): c::set_tagged_utf8($url); @@ -1000,6 +1003,8 @@ $view->signal_connect('navigation-requested' => warn "Warning: invalid tool name: $url\n"; return $res; } + # prevent WebKit2 to try to load 'app' page: + $decision->ignore; $tool_callbacks{$url}->(); # FIXME: the following code is currently useless: # should we provide a way to kill buggy embedded programs ? |