From f36fc4ae857bbd751636f4159afd8eb1c39cd389 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho 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 Acked-by: Simon Schampijer --- 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 f4bfb831..d1c0cfd5 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