From f5166d682f075a50d98c638f4375638c812d039b Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlos@lanedo.com>
Date: Fri, 4 May 2012 14:52:25 +0200
Subject: [PATCH] Tray: set a minimum size in the viewport so that it allows
scrolling
The minimum height/width requested by the GtkViewport still tries to cater
for all contained children, which makes the [VH]Tray widgets to grow as
new items are added. Instead, request a minimum width/height of 0 to avoid
the Tray from growing, and having scrolling kick in instead.
Also, fixed what seemed to be a typo in do_get_preferred_height(), where
the viewport width was requested instead.
http://bugs.sugarlabs.org/ticket/3522
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
---
src/sugar3/graphics/tray.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py
index f4bfb83..d1c0cfd 100644
a
|
b
|
class _TrayViewport(Gtk.Viewport): |
115 | 115 | |
116 | 116 | def do_get_preferred_width(self): |
117 | 117 | if self.orientation == Gtk.Orientation.HORIZONTAL: |
118 | | return Gtk.Viewport.do_get_preferred_width(self) |
| 118 | min_width, nat_width = Gtk.Viewport.do_get_preferred_width(self) |
| 119 | return 0, nat_width |
119 | 120 | child_minimum, child_natural = self.get_child().get_preferred_size() |
120 | 121 | return child_minimum.width, child_natural.width |
121 | 122 | |
122 | 123 | def do_get_preferred_height(self): |
123 | 124 | if self.orientation != Gtk.Orientation.HORIZONTAL: |
124 | | return Gtk.Viewport.do_get_preferred_width(self) |
| 125 | min_height, nat_height = Gtk.Viewport.do_get_preferred_height(self) |
| 126 | return 0, nat_height |
125 | 127 | child_minimum, child_natural = self.get_child().get_preferred_size() |
126 | 128 | return child_minimum.height, child_natural.height |
127 | 129 | |