clean up the GInitiallyUnowned floating flag when setting GTK_FLOATING.

Thu Mar  9 14:49:35 2006  Tim Janik  <timj@imendio.com>

        * gtk/gtkobject.c (gtk_object_init): clean up the GInitiallyUnowned
        floating flag when setting GTK_FLOATING.
        added tests/floatingcheck (a weakened variant of what gtk+-2.10 has).
This commit is contained in:
Tim Janik
2006-03-09 13:51:18 +00:00
committed by Tim Janik
parent f6dd9b4141
commit 642ef2c7db
5 changed files with 88 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
Thu Mar 9 14:49:35 2006 Tim Janik <timj@imendio.com>
* gtk/gtkobject.c (gtk_object_init): clean up the GInitiallyUnowned
floating flag when setting GTK_FLOATING.
added tests/floatingcheck (a weakened variant of what gtk+-2.10 has).
2006-03-08 Matthias Clasen <mclasen@redhat.com>
* Bump version

View File

@@ -1,3 +1,9 @@
Thu Mar 9 14:49:35 2006 Tim Janik <timj@imendio.com>
* gtk/gtkobject.c (gtk_object_init): clean up the GInitiallyUnowned
floating flag when setting GTK_FLOATING.
added tests/floatingcheck (a weakened variant of what gtk+-2.10 has).
2006-03-08 Matthias Clasen <mclasen@redhat.com>
* Bump version

View File

@@ -382,6 +382,11 @@ static void
gtk_object_init (GtkObject *object,
GtkObjectClass *klass)
{
if (gobject_floating_flag_handler)
{
/* sink the GInitiallyUnowned floating flag */
gobject_floating_flag_handler (object, -1);
}
GTK_OBJECT_FLAGS (object) = GTK_FLOATING;
}

View File

@@ -25,8 +25,10 @@ if USE_X11
testsocket_programs = testsocket testsocket_child
endif
TESTS = floatingtest
noinst_PROGRAMS = \
$(TESTS) \
simple \
testcairo \
testcalendar \
@@ -71,6 +73,7 @@ noinst_PROGRAMS = \
testmerge \
testactions
floatingtest_DEPENDENCIES = $(TEST_DEPS)
simple_DEPENDENCIES = $(TEST_DEPS)
testicontheme_DEPENDENCIES = $(TEST_DEPS)
testiconview_DEPENDENCIES = $(TEST_DEPS)
@@ -109,6 +112,7 @@ testxinerama_DEPENDENCIES = $(TEST_DEPS)
testmerge_DEPENDENCIES = $(TEST_DEPS)
testactions_DEPENDENCIES = $(TEST_DEPS)
floatingtest_LDADD = $(LDADDS)
simple_LDADD = $(LDADDS)
testcairo_LDADD = $(LDADDS)
testcalendar_LDADD = $(LDADDS)
@@ -154,6 +158,8 @@ pixbuf_threads_LDADD = $(LDADDS) $(GLIB_LIBS)
testmerge_LDADD = $(LDADDS)
testactions_LDADD = $(LDADDS)
floatingtest_SOURCES = floatingtest.c
testfilechooser_SOURCES = \
prop-editor.c \
testfilechooser.c

65
tests/floatingtest.c Normal file
View File

@@ -0,0 +1,65 @@
/* floatingtest.c - test floating flag uses
* Copyright (C) 2005 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#undef GTK_DISABLE_DEPRECATED
#include "../gtk/gtk.h"
static gboolean destroyed = FALSE;
static void destroy (void) { destroyed = TRUE; }
int
main (int argc,
char *argv[])
{
GtkWidget *widget;
gtk_init (&argc, &argv);
widget = g_object_new (GTK_TYPE_LABEL, NULL);
g_object_connect (widget, "signal::destroy", destroy, NULL, NULL);
g_assert (GTK_OBJECT_FLOATING (widget));
//g_assert (g_object_is_floating (widget));
GTK_OBJECT_UNSET_FLAGS (widget, GTK_FLOATING);
g_assert (!GTK_OBJECT_FLOATING (widget));
//g_assert (!g_object_is_floating (widget));
GTK_OBJECT_SET_FLAGS (widget, GTK_FLOATING);
g_assert (GTK_OBJECT_FLOATING (widget));
//g_assert (g_object_is_floating (widget));
g_object_ref (widget);
gtk_object_sink (GTK_OBJECT (widget));
g_assert (!GTK_OBJECT_FLOATING (widget));
//g_assert (!g_object_is_floating (widget));
GTK_OBJECT_SET_FLAGS (GTK_OBJECT (widget), GTK_FLOATING);
g_assert (GTK_OBJECT_FLOATING (widget));
//g_assert (g_object_is_floating (widget));
g_object_ref (widget);
gtk_object_sink (GTK_OBJECT (widget));
g_assert (!GTK_OBJECT_FLOATING (widget));
//g_assert (!g_object_is_floating (widget));
g_assert (!destroyed);
g_object_unref (widget);
g_assert (destroyed);
return 0;
}