scrolledwindow: make gtk_scrolled_window_add() smart

There's really no reason why we shouldn't automatically create a
GtkViewport when the widget added to GtkScrolledWindow is not a
GtkScrollable, instead of just printing a g_warning.
Copy the viewport special case into the scrolled window implementation
of gtk_container_add().

https://bugzilla.gnome.org/show_bug.cgi?id=693015
This commit is contained in:
Cosimo Cecchi
2013-02-01 17:03:44 +01:00
committed by Matthias Clasen
parent 5f41eb74a5
commit 9efa28591c
2 changed files with 22 additions and 14 deletions

View File

@ -49,8 +49,9 @@
* #GtkTreeView or #GtkIconView, it can be added to a #GtkScrolledWindow
* with gtk_container_add(). If a widget does not, you must first add the
* widget to a #GtkViewport, then add the viewport to the scrolled window.
* The convenience function gtk_scrolled_window_add_with_viewport() does
* exactly this, so you can ignore the presence of the viewport.
* gtk_container_add() does this automatically if a child that does not
* implement #GtkScrollable is added to a #GtkScrolledWindow, so you can
* ignore the presence of the viewport.
*
* The #GtkViewport will start scrolling content only if allocated less
* than the child widget's minimum size in a given orientation.