summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-03-22 11:18:23 +0100
committerPapoteur <papoteur@mageia.org>2018-11-01 20:06:23 +0100
commit7d114399693b70de5c1e5c7d8fc72d486881c819 (patch)
treef72c53fa8e9246a846875227095bdf521b2e4d78
parent2da3e2ae1a6e71c3c8c346b3831b320b239b8406 (diff)
downloadmageiawelcome-7d114399693b70de5c1e5c7d8fc72d486881c819.tar
mageiawelcome-7d114399693b70de5c1e5c7d8fc72d486881c819.tar.gz
mageiawelcome-7d114399693b70de5c1e5c7d8fc72d486881c819.tar.bz2
mageiawelcome-7d114399693b70de5c1e5c7d8fc72d486881c819.tar.xz
mageiawelcome-7d114399693b70de5c1e5c7d8fc72d486881c819.zip
port to webkit2
-rw-r--r--usr/share/mageiawelcome/webgui.py14
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)