Fix browser initialization

This commit is contained in:
Marco Pesenti Gritti 2006-10-17 14:51:20 +02:00
parent 84a2dfac31
commit 96867a37bf
2 changed files with 15 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import gtk
import gtkmozembed
import logging
import _sugar
from sugar.activity.Activity import Activity
from sugar import env
from sugar.graphics import style
@ -92,4 +93,11 @@ class WebActivity(Activity):
def start():
gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko')
gtkmozembed.push_startup()
_sugar.startup_browser()
style.load_stylesheet(web.stylesheet)
def stop():
gtkmozembed.pop_startup()

View File

@ -51,7 +51,8 @@ class ActivityFactory(dbus.service.Object):
if hasattr(module, 'start'):
module.start()
self._class = getattr(module, class_name)
self._module = module
self._constructor = getattr(module, class_name)
bus = dbus.SessionBus()
factory = _get_factory(activity_type)
@ -60,7 +61,7 @@ class ActivityFactory(dbus.service.Object):
@dbus.service.method("com.redhat.Sugar.ActivityFactory")
def create(self):
activity = self._class()
activity = self._constructor()
activity.set_type(self._activity_type)
self._activities.append(activity)
@ -70,6 +71,10 @@ class ActivityFactory(dbus.service.Object):
def _activity_destroy_cb(self, activity):
self._activities.remove(activity)
if hasattr(self._module, 'stop'):
self._module.stop()
if len(self._activities) == 0:
gtk.main_quit()