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 <[email protected]> Signed-off-by: Manuel Quiñones <[email protected]> Acked-by: Simon Schampijer <[email protected]>
This commit is contained in:
committed by
Manuel Quiñones
parent
b6152b023a
commit
0788e546f6
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user