diff options
Diffstat (limited to 'usr')
-rw-r--r-- | usr/share/mageiawelcome/webgui.py | 14 |
1 files 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) |