bgo #721407 - Fix scrolled window to work with template subclasses.

Ensure the hscrollbar & vscrollbar at gtk_scrolled_window_add() time,
this allows one to subclass GtkScrolledWindow with templates and add
children, as this will happen at instance initialization time before
the construct adjustment properties take effect.
This commit is contained in:
Tristan Van Berkom 2014-01-04 11:55:41 +09:00 committed by Matthias Clasen
parent 9137b4ed8e
commit 07d6c69128

View File

@ -2926,6 +2926,15 @@ gtk_scrolled_window_add (GtkContainer *container,
scrolled_window = GTK_SCROLLED_WINDOW (container);
priv = scrolled_window->priv;
/* gtk_scrolled_window_set_[hv]adjustment have the side-effect
* of creating the scrollbars
*/
if (!priv->hscrollbar)
gtk_scrolled_window_set_hadjustment (scrolled_window, NULL);
if (!priv->vscrollbar)
gtk_scrolled_window_set_vadjustment (scrolled_window, NULL);
hadj = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
vadj = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));