Skip to content

Commit

Permalink
Snowflake layout: fix the requisition and allocation - SL #4157
Browse files Browse the repository at this point in the history
Same as commit c558285, size_request is deprecated and the
get_preferred* should be used instead.  So we need to implement
do_get_preferred_size instead of do_size_request.

Signed-off-by: Manuel Quiñones <[email protected]>
Acked-by: Simon Schampijer <[email protected]>
  • Loading branch information
Manuel Quiñones committed Nov 9, 2012
1 parent 7f46bb3 commit 780a2b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/jarabe/desktop/favoriteslayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def allocate_children(self, allocation, children):
width, height = self._get_child_grid_size(child)
self._grid.add(child, width, height, None, None, locked=False)

requisition = child.size_request()
requisition = child.get_preferred_size()[0]
rect = self._grid.get_child_rect(child)
child_allocation = Gdk.Rectangle()
child_allocation.x = int(round(rect.x * _CELL_SIZE))
Expand Down
12 changes: 11 additions & 1 deletion src/jarabe/desktop/snowflakelayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,20 @@ def remove(self, child):
del self._children[child]
self.remove(child)

def do_size_request(self, requisition):
def do_get_preferred_size(self):
size = self._calculate_size()
requisition = Gtk.Requisition()
requisition.width = size
requisition.height = size
return (requisition, requisition)

def do_get_preferred_width(self):
size = self._calculate_size()
return (size, size)

def do_get_preferred_height(self):
size = self._calculate_size()
return (size, size)

def do_size_allocate(self, allocation):
self.set_allocation(allocation)
Expand Down

0 comments on commit 780a2b5

Please sign in to comment.