Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-07-05 23:14:52 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-07-05 23:14:52 (GMT)
commit4024ef1d0b097fb2a3cd43736004fbfcf324f6c8 (patch)
tree1c59027477ead865124a88a65db19da8a6b28131
parentf1ecb99207f00887ba51cc3d1303247dabc335b2 (diff)
Use a custom layout to center the icon
-rw-r--r--shell/view/home/transitionbox.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/shell/view/home/transitionbox.py b/shell/view/home/transitionbox.py
index 1dd1d4d..3c5dfe8 100644
--- a/shell/view/home/transitionbox.py
+++ b/shell/view/home/transitionbox.py
@@ -35,6 +35,30 @@ class _Animation(animator.Animation):
d = (self.end_scale - self.start_scale) * current
self._icon.props.scale = self.start_scale + d
+class _Layout(gobject.GObject,hippo.CanvasLayout):
+ __gtype_name__ = 'SugarTransitionBoxLayout'
+ def __init__(self):
+ gobject.GObject.__init__(self)
+
+ def do_set_box(self, box):
+ self._box = box
+
+ def do_get_height_request(self, for_width):
+ return 0, 0
+
+ def do_get_width_request(self):
+ return 0, 0
+
+ def do_allocate(self, x, y, width, height,
+ req_width, req_height, origin_changed):
+ for child in self._box.get_layout_children():
+ min_width, child_width = child.get_width_request()
+ min_height, child_height = child.get_height_request(child_width)
+
+ child.allocate(x + (width - child_width) / 2,
+ y + (height - child_height) / 2,
+ child_width, child_height, origin_changed)
+
class TransitionBox(hippo.CanvasBox):
__gtype_name__ = 'SugarTransitionBox'
@@ -48,11 +72,11 @@ class TransitionBox(hippo.CanvasBox):
self._scale = units.XLARGE_ICON_SCALE
- self._layout = SpreadLayout()
+ self._layout = _Layout()
self.set_layout(self._layout)
self._my_icon = MyIcon(self._scale)
- self._layout.add_center(self._my_icon)
+ self.append(self._my_icon)
self._animator = animator.Animator(0.3)
self._animator.connect('completed', self._animation_completed_cb)