Fix browser initialization
This commit is contained in:
parent
84a2dfac31
commit
96867a37bf
@ -19,6 +19,7 @@ import gtk
|
|||||||
import gtkmozembed
|
import gtkmozembed
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import _sugar
|
||||||
from sugar.activity.Activity import Activity
|
from sugar.activity.Activity import Activity
|
||||||
from sugar import env
|
from sugar import env
|
||||||
from sugar.graphics import style
|
from sugar.graphics import style
|
||||||
@ -92,4 +93,11 @@ class WebActivity(Activity):
|
|||||||
|
|
||||||
def start():
|
def start():
|
||||||
gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko')
|
gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko')
|
||||||
|
|
||||||
|
gtkmozembed.push_startup()
|
||||||
|
_sugar.startup_browser()
|
||||||
|
|
||||||
style.load_stylesheet(web.stylesheet)
|
style.load_stylesheet(web.stylesheet)
|
||||||
|
|
||||||
|
def stop():
|
||||||
|
gtkmozembed.pop_startup()
|
||||||
|
@ -51,7 +51,8 @@ class ActivityFactory(dbus.service.Object):
|
|||||||
if hasattr(module, 'start'):
|
if hasattr(module, 'start'):
|
||||||
module.start()
|
module.start()
|
||||||
|
|
||||||
self._class = getattr(module, class_name)
|
self._module = module
|
||||||
|
self._constructor = getattr(module, class_name)
|
||||||
|
|
||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
factory = _get_factory(activity_type)
|
factory = _get_factory(activity_type)
|
||||||
@ -60,7 +61,7 @@ class ActivityFactory(dbus.service.Object):
|
|||||||
|
|
||||||
@dbus.service.method("com.redhat.Sugar.ActivityFactory")
|
@dbus.service.method("com.redhat.Sugar.ActivityFactory")
|
||||||
def create(self):
|
def create(self):
|
||||||
activity = self._class()
|
activity = self._constructor()
|
||||||
activity.set_type(self._activity_type)
|
activity.set_type(self._activity_type)
|
||||||
|
|
||||||
self._activities.append(activity)
|
self._activities.append(activity)
|
||||||
@ -70,6 +71,10 @@ class ActivityFactory(dbus.service.Object):
|
|||||||
|
|
||||||
def _activity_destroy_cb(self, activity):
|
def _activity_destroy_cb(self, activity):
|
||||||
self._activities.remove(activity)
|
self._activities.remove(activity)
|
||||||
|
|
||||||
|
if hasattr(self._module, 'stop'):
|
||||||
|
self._module.stop()
|
||||||
|
|
||||||
if len(self._activities) == 0:
|
if len(self._activities) == 0:
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user