Cleanup environment initialization
We are not setting up a single sugar.window.environment object.
This commit is contained in:
parent
a1b73ff527
commit
1f5e39f3a8
@ -69,12 +69,20 @@ class WebActivity(Gtk.Window):
|
|||||||
key = os.environ["SUGAR_APISOCKET_KEY"]
|
key = os.environ["SUGAR_APISOCKET_KEY"]
|
||||||
port = os.environ["SUGAR_APISOCKET_PORT"]
|
port = os.environ["SUGAR_APISOCKET_PORT"]
|
||||||
|
|
||||||
script = "window.sugarKey = '%s'; " \
|
script = """
|
||||||
"window.sugarPort = '%s'; " \
|
var environment = {apiSocketKey: "%s",
|
||||||
"window.sugarId = '%s'; " \
|
apiSocketPort: "%s",
|
||||||
"if (window.onSugarAuthSet) " \
|
activityId: "%s"};
|
||||||
"window.onSugarAuthSet();" % \
|
|
||||||
(key, port, self._activity_id)
|
if (window.sugar === undefined) {
|
||||||
|
window.sugar = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
window.sugar.environment = environment;
|
||||||
|
|
||||||
|
if (window.sugar.onEnvironmentSet)
|
||||||
|
window.sugar.onEnvironmentSet();
|
||||||
|
""" % (key, port, self._activity_id)
|
||||||
|
|
||||||
self._web_view.run_javascript(script, None, None, None)
|
self._web_view.run_javascript(script, None, None, None)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user