[libpeas] Fix testing_show_widget()



commit b68f81bb0d6679345aafe27c915a6faef7d4fb05
Author: Garrett Regier <alias301 gmail com>
Date:   Wed Feb 9 22:37:55 2011 -0800

    Fix testing_show_widget()
    
    It now allows you to show a widget with a parent
    and no longer add the widget twice in the case that
    it had to create a window.

 tests/libpeas-gtk/testing/testing.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tests/libpeas-gtk/testing/testing.c b/tests/libpeas-gtk/testing/testing.c
index 65d29f1..9b58050 100644
--- a/tests/libpeas-gtk/testing/testing.c
+++ b/tests/libpeas-gtk/testing/testing.c
@@ -205,7 +205,9 @@ testing_show_widget (gpointer widget)
 
   g_assert (GTK_IS_WIDGET (widget));
 
-  if (GTK_IS_WINDOW (widget))
+  widget = gtk_widget_get_toplevel (GTK_WIDGET (widget));
+
+  if (gtk_widget_is_toplevel (GTK_WIDGET (widget)))
     window = widget;
   else
     {
@@ -219,8 +221,6 @@ testing_show_widget (gpointer widget)
   gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE);
 #endif
 
-  gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (widget));
-
   gtk_widget_show_all (window);
 
   g_signal_connect (window,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]