Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-12-04 20:40:26 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-12-17 21:37:09 (GMT)
commit0788e546f62f6cb389220b53743808cd232a61d5 (patch)
treefc5c2c4c711db3ec1700c61c8e7e7bd9f48190d8
parentb6152b023af22fa28e8a64d400b9496602dab959 (diff)
TrayViewport: handle the case of the widget not yet allocated in the size-allocate callback - SL #4279
In the callback, the allocation can be 1x1 if it is yet unknown [1]. This is the case of trays that start hidden by default, like the one in Browse activity. [1] http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-size-allocate Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Signed-off-by: Manuel QuiƱones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--src/sugar3/graphics/tray.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py
index c0e5679..b460595 100644
--- a/src/sugar3/graphics/tray.py
+++ b/src/sugar3/graphics/tray.py
@@ -137,6 +137,12 @@ class _TrayViewport(Gtk.Viewport):
return self._can_scroll_prev
def _size_allocate_cb(self, viewport, allocation):
+ if allocation.width == 1 and allocation.height == 1:
+ # HACK: the first time this callback is called 'width' and
+ # 'height' are 1 so we mark the Viewport as scrollable and
+ # we show the Prev / Next buttons
+ return
+
bar_minimum, bar_natural = self.traybar.get_preferred_size()
if self.orientation == Gtk.Orientation.HORIZONTAL: