First implementation of the totems ui
This commit is contained in:
parent
11d54d71a9
commit
835bb66852
@ -1,4 +1,4 @@
|
|||||||
AC_INIT([Sugar],[0.3],[],[sugar])
|
AC_INIT([Sugar],[0.4],[],[sugar])
|
||||||
|
|
||||||
AC_PREREQ([2.59])
|
AC_PREREQ([2.59])
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import geckoembed
|
|||||||
from sugar.session.LogWriter import LogWriter
|
from sugar.session.LogWriter import LogWriter
|
||||||
from sugar.shell import activity
|
from sugar.shell import activity
|
||||||
from sugar.p2p.Group import LocalGroup
|
from sugar.p2p.Group import LocalGroup
|
||||||
|
from sugar.browser.NotificationBar import NotificationBar
|
||||||
import sugar.env
|
import sugar.env
|
||||||
|
|
||||||
class AddressToolbar(gtk.Toolbar):
|
class AddressToolbar(gtk.Toolbar):
|
||||||
@ -171,12 +172,27 @@ class BrowserActivity(activity.Activity):
|
|||||||
self._group = group
|
self._group = group
|
||||||
self._mode = BrowserActivity.SOLO
|
self._mode = BrowserActivity.SOLO
|
||||||
|
|
||||||
|
def __notif_bar_action_cb(self, bar, action_id):
|
||||||
|
if action_id == 'set_shared_address':
|
||||||
|
address = self.embed.get_address()
|
||||||
|
self._model.set_value('current_address', address)
|
||||||
|
elif action_id == 'goto_shared_address':
|
||||||
|
address = self._model.get_value("current_address")
|
||||||
|
self.embed.load_address(address)
|
||||||
|
self._notif_bar.hide()
|
||||||
|
|
||||||
|
def set_mode(self, mode):
|
||||||
|
self._mode = mode
|
||||||
|
if mode == BrowserActivity.LEADING:
|
||||||
|
self._notif_bar.set_text("You are leading the browsing.")
|
||||||
|
self._notif_bar.set_action("set_shared_address", "Move Here")
|
||||||
|
self._notif_bar.show()
|
||||||
|
|
||||||
def _setup_shared(self, uri):
|
def _setup_shared(self, uri):
|
||||||
self._model = self._group.get_store().get_model(uri)
|
self._model = self._group.get_store().get_model(uri)
|
||||||
if self._model:
|
if self._model:
|
||||||
self._mode = BrowserActivity.FOLLOWING
|
self.set_mode(BrowserActivity.FOLLOWING)
|
||||||
self._load_shared_address()
|
self._model.add_listener(self.__shared_location_changed_cb)
|
||||||
self._model.add_listener(self.__shared_address_changed_cb)
|
|
||||||
|
|
||||||
def activity_on_connected_to_shell(self):
|
def activity_on_connected_to_shell(self):
|
||||||
self.activity_set_ellipsize_tab(True)
|
self.activity_set_ellipsize_tab(True)
|
||||||
@ -187,6 +203,10 @@ class BrowserActivity(activity.Activity):
|
|||||||
|
|
||||||
vbox = gtk.VBox()
|
vbox = gtk.VBox()
|
||||||
|
|
||||||
|
self._notif_bar = NotificationBar()
|
||||||
|
vbox.pack_start(self._notif_bar, False)
|
||||||
|
self._notif_bar.connect('action', self.__notif_bar_action_cb)
|
||||||
|
|
||||||
self.embed = geckoembed.Embed()
|
self.embed = geckoembed.Embed()
|
||||||
self.embed.connect("title", self.__title_cb)
|
self.embed.connect("title", self.__title_cb)
|
||||||
vbox.pack_start(self.embed)
|
vbox.pack_start(self.embed)
|
||||||
@ -213,8 +233,7 @@ class BrowserActivity(activity.Activity):
|
|||||||
address = self.embed.get_address()
|
address = self.embed.get_address()
|
||||||
self._model = self._group.get_store().create_model(address)
|
self._model = self._group.get_store().create_model(address)
|
||||||
self._model.set_value('current_address', address)
|
self._model.set_value('current_address', address)
|
||||||
self._model.add_listener(self.__shared_address_changed_cb)
|
self.set_mode(BrowserActivity.LEADING)
|
||||||
self._mode = BrowserActivity.LEADING
|
|
||||||
|
|
||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
proxy_obj = bus.get_object('com.redhat.Sugar.Chat', '/com/redhat/Sugar/Chat')
|
proxy_obj = bus.get_object('com.redhat.Sugar.Chat', '/com/redhat/Sugar/Chat')
|
||||||
@ -224,17 +243,14 @@ class BrowserActivity(activity.Activity):
|
|||||||
|
|
||||||
def __title_cb(self, embed):
|
def __title_cb(self, embed):
|
||||||
self.activity_set_tab_text(embed.get_title())
|
self.activity_set_tab_text(embed.get_title())
|
||||||
# Temporary hack, we need an UI
|
|
||||||
if self._mode == BrowserActivity.LEADING:
|
|
||||||
self._model.set_value('current_address', self.embed.get_address())
|
|
||||||
|
|
||||||
def _load_shared_address(self):
|
def __shared_location_changed_cb(self, model, key):
|
||||||
address = self._model.get_value("current_address")
|
self._notify_shared_location_change()
|
||||||
if address != self.embed.get_address():
|
|
||||||
self.embed.load_address(address)
|
|
||||||
|
|
||||||
def __shared_address_changed_cb(self, model, key):
|
def _notify_shared_location_change(self):
|
||||||
self._load_shared_address()
|
self._notif_bar.set_text("The lead moved to a new location.")
|
||||||
|
self._notif_bar.set_action("goto_shared_location", "Move There")
|
||||||
|
self._notif_bar.show()
|
||||||
|
|
||||||
def activity_on_close_from_user(self):
|
def activity_on_close_from_user(self):
|
||||||
self.activity_shutdown()
|
self.activity_shutdown()
|
||||||
|
Loading…
Reference in New Issue
Block a user