Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-11-05 11:04:15 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-11-05 11:04:15 (GMT)
commitee8712d1c4f6ffd614bf3f110bbebba1c2c8fe0c (patch)
tree16e42ffbd3c0d055c7f545f19702f4ec728db01e /shell
parent32fc5d3161e9327ba02bc62b525aa767795b3aaf (diff)
Cleanup center item offset API
Diffstat (limited to 'shell')
-rw-r--r--shell/view/home/MeshBox.py6
-rw-r--r--shell/view/home/spreadlayout.py10
2 files changed, 8 insertions, 8 deletions
diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py
index c579435..0a23020 100644
--- a/shell/view/home/MeshBox.py
+++ b/shell/view/home/MeshBox.py
@@ -382,8 +382,7 @@ class MeshBox(hippo.CanvasBox):
self._layout_box = hippo.CanvasBox(background_color=0xe2e2e2ff)
self.append(self._layout_box, hippo.PACK_EXPAND)
- center_vertical_offset = - style.GRID_CELL_SIZE
- self._layout = SpreadLayout(center_vertical_offset)
+ self._layout = SpreadLayout()
self._layout_box.set_layout(self._layout)
for buddy_model in self._model.get_buddies():
@@ -466,7 +465,8 @@ class MeshBox(hippo.CanvasBox):
def _add_alone_buddy(self, buddy_model):
icon = BuddyIcon(self._shell, buddy_model)
if buddy_model.is_owner():
- self._layout.add_center(icon)
+ vertical_offset = - style.GRID_CELL_SIZE
+ self._layout.add_center(icon, vertical_offset)
else:
self._layout.add(icon)
diff --git a/shell/view/home/spreadlayout.py b/shell/view/home/spreadlayout.py
index d7eae7d..91ebfef 100644
--- a/shell/view/home/spreadlayout.py
+++ b/shell/view/home/spreadlayout.py
@@ -169,18 +169,16 @@ class _Grid(gobject.GObject):
class SpreadLayout(gobject.GObject, hippo.CanvasLayout):
__gtype_name__ = 'SugarSpreadLayout'
- def __init__(self, center_vertical_offset=0):
+ def __init__(self):
gobject.GObject.__init__(self)
- self._center_vertical_offset = center_vertical_offset
-
min_width, width = self.do_get_width_request()
min_height, height = self.do_get_height_request(width)
self._grid = _Grid(width / _CELL_SIZE, height / _CELL_SIZE)
self._grid.connect('child-changed', self._grid_child_changed_cb)
- def add_center(self, child):
+ def add_center(self, child, vertical_offset=0):
self._box.append(child)
width, height = self._get_child_grid_size(child)
@@ -191,6 +189,7 @@ class SpreadLayout(gobject.GObject, hippo.CanvasLayout):
box_child = self._box.find_box_child(child)
box_child.grid_rect = None
+ box_child.vertical_offset = vertical_offset
def add(self, child):
self._box.append(child)
@@ -225,10 +224,11 @@ class SpreadLayout(gobject.GObject, hippo.CanvasLayout):
rect.height * _CELL_SIZE,
origin_changed)
else:
+ vertical_offset = child.vertical_offset
min_w, child_width = child.get_width_request()
min_h, child_height = child.get_height_request(child_width)
child_x = x + (width - child_width) / 2
- child_y = y + (height - child_height + self._center_vertical_offset) / 2
+ child_y = y + (height - child_height + vertical_offset) / 2
child.allocate(child_x, child_y, child_width, child_height,
origin_changed)