Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Marco Pesenti Gritti 2007-01-08 23:42:39 +01:00
commit 9bcb18a18f
2 changed files with 15 additions and 7 deletions

View File

@ -183,6 +183,8 @@ class Shell(gobject.GObject):
self._hosts[activity_host.get_xid()] = activity_host self._hosts[activity_host.get_xid()] = activity_host
def _activity_removed_cb(self, home_model, home_activity): def _activity_removed_cb(self, home_model, home_activity):
if not home_activity.get_launched():
return
xid = home_activity.get_xid() xid = home_activity.get_xid()
if self._hosts.has_key(xid): if self._hosts.has_key(xid):
self._hosts[xid].destroy() self._hosts[xid].destroy()
@ -277,7 +279,7 @@ class Shell(gobject.GObject):
def _start_error_cb(self, handler, err, home_model, activity_id, activity_type): def _start_error_cb(self, handler, err, home_model, activity_id, activity_type):
logging.error("Couldn't launch activity %s (%s):\n%s" % (activity_id, activity_type, err)) logging.error("Couldn't launch activity %s (%s):\n%s" % (activity_id, activity_type, err))
home_mode.notify_activity_launch_failed(activity_id) home_model.notify_activity_launch_failed(activity_id)
def start_activity(self, activity_type): def start_activity(self, activity_type):
logging.debug('Shell.start_activity') logging.debug('Shell.start_activity')
@ -294,6 +296,9 @@ class Shell(gobject.GObject):
handler.connect('success', self._start_success_cb, act_id, activity_type) handler.connect('success', self._start_success_cb, act_id, activity_type)
handler.connect('error', self._start_error_cb, home_model, act_id, activity_type) handler.connect('error', self._start_error_cb, home_model, act_id, activity_type)
# Zoom to Home for launch feedback
self.set_zoom_level(sugar.ZOOM_HOME)
def set_zoom_level(self, level): def set_zoom_level(self, level):
if level == sugar.ZOOM_ACTIVITY: if level == sugar.ZOOM_ACTIVITY:
self._screen.toggle_showing_desktop(False) self._screen.toggle_showing_desktop(False)

View File

@ -82,27 +82,31 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
_cache = _IconCache() _cache = _IconCache()
def __init__(self, **kwargs): def __init__(self, **kwargs):
self._buffer = None
self._size = 24 self._size = 24
self._color = None self._color = None
self._icon_name = None self._icon_name = None
hippo.CanvasBox.__init__(self, **kwargs) hippo.CanvasBox.__init__(self, **kwargs)
self._buffer = None
self.connect('button-press-event', self._button_press_event_cb) self.connect('button-press-event', self._button_press_event_cb)
def _invalidate_buffer(self, new_buffer):
if self._buffer:
del self._buffer
self._buffer = new_buffer
def do_set_property(self, pspec, value): def do_set_property(self, pspec, value):
if pspec.name == 'icon-name': if pspec.name == 'icon-name':
self._icon_name = value self._icon_name = value
self._buffer = None self._invalidate_buffer(None)
self.emit_paint_needed(0, 0, -1, -1) self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'color': elif pspec.name == 'color':
self._buffer = None self._invalidate_buffer(None)
self._color = value self._color = value
self.emit_paint_needed(0, 0, -1, -1) self.emit_paint_needed(0, 0, -1, -1)
elif pspec.name == 'size': elif pspec.name == 'size':
self._buffer = None self._invalidate_buffer(None)
self._size = value self._size = value
self.emit_request_changed() self.emit_request_changed()
@ -129,7 +133,6 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
del ctx del ctx
self._buffer = surface self._buffer = surface
self._buffer_scale = scale
return self._buffer return self._buffer