diff options
author | Carlos Garnacho <carlos@lanedo.com> | 2012-05-04 12:52:25 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2012-05-04 14:26:48 (GMT) |
commit | f36fc4ae857bbd751636f4159afd8eb1c39cd389 (patch) | |
tree | 55a2318bcc0750dca8cf8b0062ecbb05e03ac685 | |
parent | abe02123b7c159726d09dd716e4801c30aaef9a0 (diff) |
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>
Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r-- | src/sugar3/graphics/tray.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py index f4bfb83..d1c0cfd 100644 --- a/src/sugar3/graphics/tray.py +++ b/src/sugar3/graphics/tray.py @@ -115,13 +115,15 @@ class _TrayViewport(Gtk.Viewport): def do_get_preferred_width(self): if self.orientation == Gtk.Orientation.HORIZONTAL: - return Gtk.Viewport.do_get_preferred_width(self) + min_width, nat_width = Gtk.Viewport.do_get_preferred_width(self) + return 0, nat_width child_minimum, child_natural = self.get_child().get_preferred_size() return child_minimum.width, child_natural.width def do_get_preferred_height(self): if self.orientation != Gtk.Orientation.HORIZONTAL: - return Gtk.Viewport.do_get_preferred_width(self) + min_height, nat_height = Gtk.Viewport.do_get_preferred_height(self) + return 0, nat_height child_minimum, child_natural = self.get_child().get_preferred_size() return child_minimum.height, child_natural.height |