check for existing viewport first, and don't add one if there already is

* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one

-Yosh
This commit is contained in:
Manish Singh 1998-11-28 03:05:31 +00:00
parent 33347533ec
commit 67d445eebc
8 changed files with 57 additions and 5 deletions

View File

@ -1,3 +1,9 @@
Fri Nov 27 18:57:20 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:

View File

@ -1,3 +1,9 @@
Fri Nov 27 18:57:20 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:

View File

@ -1,3 +1,9 @@
Fri Nov 27 18:57:20 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:

View File

@ -1,3 +1,9 @@
Fri Nov 27 18:57:20 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:

View File

@ -1,3 +1,9 @@
Fri Nov 27 18:57:20 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:

View File

@ -1,3 +1,9 @@
Fri Nov 27 18:57:20 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:

View File

@ -1,3 +1,9 @@
Fri Nov 27 18:57:20 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add_with_viewport):
check for existing viewport first, and don't add one if there
already is one
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:

View File

@ -867,13 +867,23 @@ gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
g_return_if_fail (child != NULL);
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (scrolled_window->child == NULL);
g_return_if_fail (child->parent == NULL);
viewport =
gtk_viewport_new (gtk_scrolled_window_get_hadjustment (scrolled_window),
gtk_scrolled_window_get_vadjustment (scrolled_window));
if (scrolled_window->child != NULL)
{
g_return_if_fail (GTK_IS_VIEWPORT (scrolled_window->child));
g_return_if_fail (GTK_BIN (scrolled_window->child)->child == NULL);
viewport = scrolled_window->child;
}
else
{
viewport =
gtk_viewport_new (gtk_scrolled_window_get_hadjustment (scrolled_window),
gtk_scrolled_window_get_vadjustment (scrolled_window));
gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
}
gtk_widget_show (viewport);
gtk_container_add (GTK_CONTAINER (viewport), child);
gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
}