From 37a27aef664c82e6d5ff3a20e45c7699c045c545 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
Date: Fri, 9 Nov 2012 10:21:11 -0300
Subject: [PATCH shell] Snowflake layout: fix the requisition and allocation -
SL #4157
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
Same as commit c5582856, size_request is deprecated and the
get_preferred* should be used instead. So we need to implement
do_get_preferred* instead of do_size_request.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
---
src/jarabe/desktop/favoriteslayout.py | 7 ++++---
src/jarabe/desktop/snowflakelayout.py | 9 ++++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
index 5f3b560..b4c83c3 100644
a
|
b
|
class SpreadLayout(ViewLayout): |
175 | 175 | width, height = self._get_child_grid_size(child) |
176 | 176 | self._grid.add(child, width, height, None, None, locked=False) |
177 | 177 | |
178 | | requisition = child.size_request() |
| 178 | new_width = child.get_preferred_width()[0] |
| 179 | new_height = child.get_preferred_height()[1] |
179 | 180 | rect = self._grid.get_child_rect(child) |
180 | 181 | child_allocation = Gdk.Rectangle() |
181 | 182 | child_allocation.x = int(round(rect.x * _CELL_SIZE)) |
182 | 183 | child_allocation.y = int(round(rect.y * _CELL_SIZE)) + allocation.y |
183 | | child_allocation.width = requisition.width |
184 | | child_allocation.height = requisition.height |
| 184 | child_allocation.width = new_width |
| 185 | child_allocation.height = new_height |
185 | 186 | child.size_allocate(child_allocation) |
186 | 187 | |
187 | 188 | |
diff --git a/src/jarabe/desktop/snowflakelayout.py b/src/jarabe/desktop/snowflakelayout.py
index 5ad5f26..cf195fa 100644
a
|
b
|
class SnowflakeLayout(Gtk.Container): |
71 | 71 | del self._children[child] |
72 | 72 | self.remove(child) |
73 | 73 | |
74 | | def do_size_request(self, requisition): |
| 74 | def do_get_preferred_width(self): |
75 | 75 | size = self._calculate_size() |
76 | | requisition.width = size |
77 | | requisition.height = size |
| 76 | return (size, size) |
| 77 | |
| 78 | def do_get_preferred_height(self): |
| 79 | size = self._calculate_size() |
| 80 | return (size, size) |
78 | 81 | |
79 | 82 | def do_size_allocate(self, allocation): |
80 | 83 | self.set_allocation(allocation) |