From 40e9de99743b7d594b70ff638e78533fd28313c2 Mon Sep 17 00:00:00 2001
From: Simon Schampijer <simon@laptop.org>
Date: Mon, 8 Oct 2012 15:31:15 +0200
Subject: [PATCH shell] Reset Layout when the allocation changes, SL #3827
In the HomeWindow we listen to the size-changed signal and
resize the window in that case. This will be triggered by
the ViewContainer and the ViewLayout. In those cases we
have to recreate the grid with the new dimensions.
Signed-off-by: Simon Schampijer <simon@laptop.org>
---
src/jarabe/desktop/favoriteslayout.py | 8 +++++++-
src/jarabe/desktop/viewcontainer.py | 3 +++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
index e9f614e..3c9be8b 100644
a
|
b
|
class Layout(object): |
55 | 55 | class ViewLayout(Layout): |
56 | 56 | def __init__(self): |
57 | 57 | self._grid = None |
| 58 | self._width = 0 |
| 59 | self._height = 0 |
58 | 60 | |
59 | 61 | def setup(self, allocation, owner_icon, activity_icon=None): |
60 | 62 | if self._grid is not None: |
61 | | return |
| 63 | if self._width == allocation.width and \ |
| 64 | self._height == allocation.height: |
| 65 | return |
| 66 | self._width = allocation.width |
| 67 | self._height = allocation.height |
62 | 68 | self._grid = Grid(int(allocation.width / _CELL_SIZE), |
63 | 69 | int(allocation.height / _CELL_SIZE)) |
64 | 70 | self._grid.connect('child-changed', self.__grid_child_changed_cb) |
diff --git a/src/jarabe/desktop/viewcontainer.py b/src/jarabe/desktop/viewcontainer.py
index 76f5a69..5e39a80 100644
a
|
b
|
|
17 | 17 | # along with this program; if not, write to the Free Software |
18 | 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19 | 19 | |
| 20 | import logging |
| 21 | |
20 | 22 | from gi.repository import Gtk |
21 | 23 | |
22 | 24 | |
… |
… |
class ViewContainer(Gtk.Container): |
62 | 64 | self.queue_resize() |
63 | 65 | |
64 | 66 | def do_size_allocate(self, allocation): |
| 67 | logging.debug('==> Viewcontainer: w=%s h=%s', allocation.width, allocation.height) |
65 | 68 | self.set_allocation(allocation) |
66 | 69 | if self._owner_icon: |
67 | 70 | self._layout.setup(allocation, self._owner_icon, |