Use gtkmozembed

This commit is contained in:
Marco Pesenti Gritti 2006-09-21 01:27:47 +02:00
parent 7539de476e
commit 4977b44037
2 changed files with 7 additions and 17 deletions

View File

@ -1,7 +1,7 @@
import os import os
import gtk import gtk
import geckoembed import gtkmozembed
from sugar.activity.Activity import Activity from sugar.activity.Activity import Activity
from sugar.presence.PresenceService import PresenceService from sugar.presence.PresenceService import PresenceService
@ -16,8 +16,7 @@ class BrowserActivity(Activity):
def __init__(self): def __init__(self):
Activity.__init__(self) Activity.__init__(self)
path = os.path.join(env.get_profile_path(), 'gecko') gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko')
geckoembed.set_profile_path(path)
self._share_service = None self._share_service = None
self._model_service = None self._model_service = None
@ -33,12 +32,12 @@ class BrowserActivity(Activity):
vbox.pack_start(self._notif_bar, False) vbox.pack_start(self._notif_bar, False)
self._notif_bar.connect('action', self.__notif_bar_action_cb) self._notif_bar.connect('action', self.__notif_bar_action_cb)
self._embed = geckoembed.Browser() self._embed = gtkmozembed.MozEmbed()
self._embed.connect("title", self.__title_cb) self._embed.connect("title", self.__title_cb)
vbox.pack_start(self._embed) vbox.pack_start(self._embed)
self._embed.show() self._embed.show()
self._embed.load_address('http://www.google.com') self._embed.load_url('http://www.google.com')
nav_toolbar = NavigationToolbar(self) nav_toolbar = NavigationToolbar(self)
vbox.pack_start(nav_toolbar, False) vbox.pack_start(nav_toolbar, False)
@ -78,7 +77,7 @@ class BrowserActivity(Activity):
self._go_to_shared_location() self._go_to_shared_location()
def _update_shared_location(self): def _update_shared_location(self):
address = self._embed.get_address() address = self._embed.get_location()
self._model.set_value('address', address) self._model.set_value('address', address)
title = self._embed.get_title() title = self._embed.get_title()
self._model.set_value('title', title) self._model.set_value('title', title)
@ -91,7 +90,7 @@ class BrowserActivity(Activity):
def _go_to_shared_location(self): def _go_to_shared_location(self):
address = self._model.get_value("address") address = self._model.get_value("address")
self._embed.load_address(address) self._embed.load_url(address)
self._notif_bar.hide() self._notif_bar.hide()
def get_embed(self): def get_embed(self):

View File

@ -24,12 +24,6 @@ class NavigationToolbar(gtk.Toolbar):
self.insert(self.forward, -1) self.insert(self.forward, -1)
self.forward.show() self.forward.show()
self.reload = gtk.ToolButton(None, _('Reload'))
self.reload.set_icon_name('reload')
self.reload.connect("clicked", self.__reload_cb)
self.insert(self.reload, -1)
self.reload.show()
separator = gtk.SeparatorToolItem() separator = gtk.SeparatorToolItem()
self.insert(separator, -1) self.insert(separator, -1)
separator.show() separator.show()
@ -52,11 +46,8 @@ class NavigationToolbar(gtk.Toolbar):
def __go_forward_cb(self, button): def __go_forward_cb(self, button):
self._embed.go_forward() self._embed.go_forward()
def __reload_cb(self, button):
self._embed.reload()
def __location_changed(self, embed): def __location_changed(self, embed):
self._update_sensitivity() self._update_sensitivity()
def __open_address_cb(self, address): def __open_address_cb(self, address):
self._embed.load_address(address) self._embed.load_url(address)