diff options
author | Simon Schampijer <simon@laptop.org> | 2012-10-08 13:31:15 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2012-10-09 17:55:39 (GMT) |
commit | ccf1f88699be252029802881a6bee58b3cd5f7fe (patch) | |
tree | 4d12cc0d20ac82c365bc8a8ee62760b1b00be894 | |
parent | e731544ff72377bdfb64212e9ab048fe101113b8 (diff) |
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>
Acked-by: Manuel QuiƱones <manuq@laptop.org>
-rw-r--r-- | src/jarabe/desktop/favoriteslayout.py | 8 | ||||
-rw-r--r-- | src/jarabe/desktop/viewcontainer.py | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py index e9f614e..3c9be8b 100644 --- a/src/jarabe/desktop/favoriteslayout.py +++ b/src/jarabe/desktop/favoriteslayout.py @@ -55,10 +55,16 @@ class Layout(object): class ViewLayout(Layout): def __init__(self): self._grid = None + self._width = 0 + self._height = 0 def setup(self, allocation, owner_icon, activity_icon=None): if self._grid is not None: - return + if self._width == allocation.width and \ + self._height == allocation.height: + return + self._width = allocation.width + self._height = allocation.height self._grid = Grid(int(allocation.width / _CELL_SIZE), int(allocation.height / _CELL_SIZE)) 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/src/jarabe/desktop/viewcontainer.py +++ b/src/jarabe/desktop/viewcontainer.py @@ -17,6 +17,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import logging + from gi.repository import Gtk @@ -62,6 +64,7 @@ class ViewContainer(Gtk.Container): self.queue_resize() def do_size_allocate(self, allocation): + logging.debug('==> Viewcontainer: w=%s h=%s', allocation.width, allocation.height) self.set_allocation(allocation) if self._owner_icon: self._layout.setup(allocation, self._owner_icon, |