Use a relative path in the activities url
It's just a bit cleaner.
This commit is contained in:
parent
a30af509c2
commit
28fe9b757f
@ -21,9 +21,10 @@ from gi.repository import Gdk
|
|||||||
from gi.repository import Gio
|
from gi.repository import Gio
|
||||||
from gi.repository import WebKit2
|
from gi.repository import WebKit2
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GdkX11
|
||||||
|
assert GdkX11
|
||||||
|
|
||||||
from gi.repository import SugarExt
|
from gi.repository import SugarExt
|
||||||
from sugar3.activity import activity
|
|
||||||
|
|
||||||
|
|
||||||
class HTMLActivity(Gtk.Window):
|
class HTMLActivity(Gtk.Window):
|
||||||
@ -52,8 +53,7 @@ class HTMLActivity(Gtk.Window):
|
|||||||
settings = self._web_view.get_settings()
|
settings = self._web_view.get_settings()
|
||||||
settings.set_property("enable-developer-extras", True)
|
settings.set_property("enable-developer-extras", True)
|
||||||
|
|
||||||
self._web_view.load_uri("activity://%s/%s/index.html" %
|
self._web_view.load_uri("activity://%s/index.html" % self._bundle_id)
|
||||||
(self._bundle_id, self._bundle_path))
|
|
||||||
|
|
||||||
def run_main_loop(self):
|
def run_main_loop(self):
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
@ -90,7 +90,8 @@ class HTMLActivity(Gtk.Window):
|
|||||||
inspector.show()
|
inspector.show()
|
||||||
|
|
||||||
def _app_scheme_cb(self, request, user_data):
|
def _app_scheme_cb(self, request, user_data):
|
||||||
path = os.path.join(activity.get_bundle_path(), request.get_path())
|
path = os.path.join(self._bundle_path,
|
||||||
|
os.path.relpath(request.get_path(), "/"))
|
||||||
|
|
||||||
request.finish(Gio.File.new_for_path(path).read(None),
|
request.finish(Gio.File.new_for_path(path).read(None),
|
||||||
-1, Gio.content_type_guess(path, None)[0])
|
-1, Gio.content_type_guess(path, None)[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user