From 7d114399693b70de5c1e5c7d8fc72d486881c819 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 22 Mar 2016 11:18:23 +0100 Subject: port to webkit2 --- usr/share/mageiawelcome/webgui.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/usr/share/mageiawelcome/webgui.py b/usr/share/mageiawelcome/webgui.py index 41bacad..e0b2c4b 100644 --- a/usr/share/mageiawelcome/webgui.py +++ b/usr/share/mageiawelcome/webgui.py @@ -9,8 +9,8 @@ from gi.repository import Gtk from gi.repository import GLib try: - gi.require_version('WebKit', '3.0') - from gi.repository import WebKit + gi.require_version('WebKit2', '4.0') + from gi.repository import WebKit2 have_webkit = True except: have_webkit = False @@ -25,7 +25,7 @@ class WebKitMethods(object): @staticmethod def create_browser(): - return WebKit.WebView() + return WebKit2.WebView() @staticmethod def inject_javascript(browser, script): @@ -34,11 +34,11 @@ class WebKitMethods(object): @staticmethod def connect_title_changed(browser, callback): def callback_wrapper(widget, frame, title): callback(title) - browser.connect('title-changed', callback_wrapper) + browser.connect('notify::title', callback_wrapper) @staticmethod def open_uri(browser, html): - browser.load_html_string(html, 'file:///usr/share/mageiawelcome/') + browser.load_html(html, 'file:///usr/share/mageiawelcome/') if use is UseWebKit: @@ -75,10 +75,12 @@ def synchronous_gtk_message(fun): def launch_browser(html, quit_function=None, echo=True): + def no_menu(*args): return True + window = Gtk.Window() browser = implementation.create_browser() settings = browser.get_settings() - settings.set_property('enable-default-context-menu', False) + browser.connect('context-menu', no_menu) box = Gtk.VBox(homogeneous=False, spacing=0) window.add(box) -- cgit v1.2.1