diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-18 17:41:34 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-18 17:41:34 (GMT) |
commit | 6c375a20f3e08f28d3a9fa6d020f71aca9b9bcd3 (patch) | |
tree | 3941622b56e741d77ff12537fa91f41e438ba5ad | |
parent | ea8d801ad8881a46fdfd05a9aa57ef44e5eaf059 (diff) |
Center the icon in the allocation space
-rw-r--r-- | shell/view/home/FriendView.py | 2 | ||||
-rw-r--r-- | sugar/graphics/canvasicon.py | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/shell/view/home/FriendView.py b/shell/view/home/FriendView.py index 5b54cce..52bc26e 100644 --- a/shell/view/home/FriendView.py +++ b/shell/view/home/FriendView.py @@ -75,7 +75,7 @@ class FriendView(hippo.CanvasBox): self._activity_icon.props.icon_name = name self._activity_icon.props.color = buddy.get_color() if not self._activity_icon_visible: - self.append(self._activity_icon) + self.append(self._activity_icon, hippo.PACK_EXPAND) self._activity_icon_visible = True else: self._remove_activity_icon() diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 01e4c0b..2d983ae 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -143,7 +143,11 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): icon_name, self._color, self._size) buf = self._get_buffer(cr, handle, self._size) - cr.set_source_surface(buf, 0.0, 0.0) + [width, height] = self.get_allocation() + x = (width - self._size) / 2 + y = (height - self._size) / 2 + + cr.set_source_surface(buf, x, y) cr.paint() def do_get_width_request(self): |