[gtk+/gtkobject-removal: 4/5] Remove GtkObject completely



commit 52dc60e0463aa94d3c2cb2280b297c3f09c31785
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 18 19:57:32 2010 -0400

    Remove GtkObject completely

 gtk/Makefile.am              |    2 -
 gtk/gtk.h                    |    1 -
 gtk/gtk.symbols              |    8 +-
 gtk/gtkadjustment.c          |    2 +-
 gtk/gtkadjustment.h          |    1 -
 gtk/gtkarrow.c               |    1 +
 gtk/gtkbbox.c                |    1 +
 gtk/gtkbindings.c            |   31 +--
 gtk/gtkbindings.h            |   11 +-
 gtk/gtkbox.c                 |    1 +
 gtk/gtkbuilder.c             |    1 +
 gtk/gtkcellrenderer.c        |    2 +-
 gtk/gtkcellrendererspinner.c |    1 +
 gtk/gtkcombobox.c            |   10 +-
 gtk/gtkcontainer.c           |   18 +-
 gtk/gtkexpander.c            |   10 +-
 gtk/gtkfilefilter.c          |    2 +-
 gtk/gtkhsv.c                 |    1 +
 gtk/gtkicontheme.c           |    1 +
 gtk/gtkimcontext.h           |    1 -
 gtk/gtkimcontextsimple.c     |    1 +
 gtk/gtkinvisible.c           |    2 +-
 gtk/gtkmain.c                |   18 +-
 gtk/gtkmain.h                |    3 +-
 gtk/gtkmenushell.c           |    2 +-
 gtk/gtknotebook.c            |    5 +-
 gtk/gtkoffscreenwindow.c     |    4 +-
 gtk/gtkorientable.c          |    1 +
 gtk/gtkplug-x11.c            |    1 +
 gtk/gtkplug.c                |    6 +-
 gtk/gtkprivate.h             |   67 ++---
 gtk/gtkrecentfilter.c        |    2 +-
 gtk/gtkruler.c               |    1 +
 gtk/gtkscalebutton.c         |    6 +-
 gtk/gtkscrolledwindow.c      |    1 +
 gtk/gtkselection.c           |    1 +
 gtk/gtksettings.c            |    1 +
 gtk/gtksizegroup.c           |    6 +-
 gtk/gtksizerequest.c         |    9 +-
 gtk/gtksocket-win32.c        |    2 +-
 gtk/gtksocket-x11.c          |    1 +
 gtk/gtksocket.c              |    5 +-
 gtk/gtkstyle.c               |    1 +
 gtk/gtktable.c               |    1 +
 gtk/gtktestutils.h           |    3 +
 gtk/gtktextlayout.c          |    2 +-
 gtk/gtktexttag.h             |    3 -
 gtk/gtktextview.c            |    2 +-
 gtk/gtkthemes.c              |    1 +
 gtk/gtktoolbar.c             |    2 +-
 gtk/gtktrayicon-x11.c        |    2 +
 gtk/gtktreemodel.h           |    3 -
 gtk/gtktreesortable.h        |    1 +
 gtk/gtktreeview.c            |    2 +-
 gtk/gtktreeviewcolumn.c      |    2 +-
 gtk/gtktypeutils.c           |    1 -
 gtk/gtkviewport.c            |    1 +
 gtk/gtkwidget.c              |  631 +++++++++++++++++++++++------------------
 gtk/gtkwidget.h              |   16 +-
 gtk/gtkwindow.c              |    6 +-
 gtk/gtkwrapbox.c             |    1 +
 gtk/gtkxembed.c              |    1 +
 62 files changed, 494 insertions(+), 439 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 15397d3..516cf38 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -245,7 +245,6 @@ gtk_public_h_sources =          \
 	gtkmodules.h		\
 	gtkmountoperation.h     \
 	gtknotebook.h		\
-	gtkobject.h		\
 	gtkoffscreenwindow.h	\
 	gtkorientable.h		\
 	gtkpagesetup.h		\
@@ -514,7 +513,6 @@ gtk_base_c_sources =            \
 	gtkmodules.c		\
 	gtkmountoperation.c     \
 	gtknotebook.c		\
-	gtkobject.c		\
 	gtkoffscreenwindow.c	\
 	gtkorientable.c		\
 	gtkpagesetup.c		\
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 71a0fa5..c138c8f 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -128,7 +128,6 @@
 #include <gtk/gtkmodules.h>
 #include <gtk/gtkmountoperation.h>
 #include <gtk/gtknotebook.h>
-#include <gtk/gtkobject.h>
 #include <gtk/gtkoffscreenwindow.h>
 #include <gtk/gtkorientable.h>
 #include <gtk/gtkpagesetup.h>
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index b6aaed1..ecf1e0d 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -2079,13 +2079,6 @@ gtk_notebook_set_action_widget
 #endif
 #endif
 
-#if IN_HEADER(__GTK_OBJECT_H__)
-#if IN_FILE(__GTK_OBJECT_C__)
-gtk_object_destroy
-gtk_object_get_type G_GNUC_CONST
-#endif
-#endif
-
 #if IN_HEADER(__GTK_OFFSCREEN_WINDOW_H__)
 #if IN_FILE(__GTK_OFFSCREEN_WINDOW_C__)
 gtk_offscreen_window_get_type G_GNUC_CONST
@@ -4379,6 +4372,7 @@ gtk_widget_get_margin_top
 gtk_widget_set_margin_top
 gtk_widget_get_margin_bottom
 gtk_widget_set_margin_bottom
+gtk_widget_in_destruction
 #endif
 #endif
 
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c
index 8b0c377..146fbd4 100644
--- a/gtk/gtkadjustment.c
+++ b/gtk/gtkadjustment.c
@@ -66,7 +66,7 @@ static guint adjustment_signals[LAST_SIGNAL] = { 0 };
 
 static guint64 adjustment_changed_stamp = 0; /* protected by global gdk lock */
 
-G_DEFINE_TYPE (GtkAdjustment, gtk_adjustment, GTK_TYPE_OBJECT)
+G_DEFINE_TYPE (GtkAdjustment, gtk_adjustment, G_TYPE_INITIALLY_UNOWNED)
 
 static void
 gtk_adjustment_class_init (GtkAdjustmentClass *class)
diff --git a/gtk/gtkadjustment.h b/gtk/gtkadjustment.h
index 1435ba5..0e7cafb 100644
--- a/gtk/gtkadjustment.h
+++ b/gtk/gtkadjustment.h
@@ -31,7 +31,6 @@
 #ifndef __GTK_ADJUSTMENT_H__
 #define __GTK_ADJUSTMENT_H__
 
-#include <gtk/gtkobject.h>
 #include <gdk/gdk.h>
 
 G_BEGIN_DECLS
diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c
index 414fc18..6305d24 100644
--- a/gtk/gtkarrow.c
+++ b/gtk/gtkarrow.c
@@ -48,6 +48,7 @@
 #include <math.h>
 #include "gtkarrow.h"
 #include "gtksizerequest.h"
+#include "gtktypeutils.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index a5ffe3e..361f54e 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -51,6 +51,7 @@
 #include "gtkorientable.h"
 #include "gtkprivate.h"
 #include "gtksizerequest.h"
+#include "gtktypeutils.h"
 
 #include "gtkintl.h"
 
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index ff9a49f..6973a6a 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -1,7 +1,7 @@
 /* GTK - The GIMP Toolkit
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
- * GtkBindingSet: Keybinding manager for GtkObjects.
+ * GtkBindingSet: Keybinding manager for GObjects.
  * Copyright (C) 1998 Tim Janik
  *
  * This library is free software; you can redistribute it and/or
@@ -34,6 +34,7 @@
 
 #include "gtkbindings.h"
 #include "gtkkeyhash.h"
+#include "gtktypeutils.h"
 #include "gtkwidget.h"
 #include "gtkrc.h"
 
@@ -340,7 +341,7 @@ binding_ht_lookup_entry (GtkBindingSet  *set,
 }
 
 static gboolean
-binding_compose_params (GtkObject       *object,
+binding_compose_params (GObject         *object,
 			GtkBindingArg	*args,
 			GSignalQuery	*query,
 			GValue	       **params_p)
@@ -469,7 +470,7 @@ binding_compose_params (GtkObject       *object,
 
 static gboolean
 gtk_binding_entry_activate (GtkBindingEntry *entry,
-			    GtkObject	    *object)
+			    GObject	    *object)
 {
   GtkBindingSignal *sig;
   gboolean old_emission;
@@ -593,7 +594,7 @@ gtk_binding_set_new (const gchar *set_name)
 
 /**
  * gtk_binding_set_by_class:
- * @object_class: a valid #GtkObject class
+ * @object_class: a valid #GObject class
  *
  * This function returns the binding set named after the type name of
  * the passed in class structure. New binding sets are created on
@@ -604,10 +605,10 @@ gtk_binding_set_new (const gchar *set_name)
 GtkBindingSet*
 gtk_binding_set_by_class (gpointer object_class)
 {
-  GtkObjectClass *class = object_class;
+  GObjectClass *class = object_class;
   GtkBindingSet* binding_set;
 
-  g_return_val_if_fail (GTK_IS_OBJECT_CLASS (class), NULL);
+  g_return_val_if_fail (G_IS_OBJECT_CLASS (class), NULL);
 
   if (!key_id_class_binding_set)
     key_id_class_binding_set = g_quark_from_static_string (key_class_binding_set);
@@ -671,12 +672,12 @@ gboolean
 gtk_binding_set_activate (GtkBindingSet	 *binding_set,
 			  guint		  keyval,
 			  GdkModifierType modifiers,
-			  GtkObject	 *object)
+			  GObject	 *object)
 {
   GtkBindingEntry *entry;
   
   g_return_val_if_fail (binding_set != NULL, FALSE);
-  g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE);
+  g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
   
   keyval = gdk_keyval_to_lower (keyval);
   modifiers = modifiers & BINDING_MOD_MASK ();
@@ -1052,7 +1053,7 @@ gtk_binding_set_add_path (GtkBindingSet	     *binding_set,
 
 static gboolean
 binding_match_activate (GSList          *pspec_list,
-			GtkObject	*object,
+			GObject	        *object,
 			guint	         path_length,
 			gchar           *path,
 			gchar           *path_reversed,
@@ -1170,7 +1171,7 @@ gtk_binding_entries_sort_patterns (GSList      *entries,
 }
 
 static gboolean
-gtk_bindings_activate_list (GtkObject *object,
+gtk_bindings_activate_list (GObject   *object,
 			    GSList    *entries,
 			    gboolean   is_release)
 {
@@ -1264,7 +1265,7 @@ gtk_bindings_activate_list (GtkObject *object,
  * Return value: %TRUE if a binding was found and activated
  */
 gboolean
-gtk_bindings_activate (GtkObject       *object,
+gtk_bindings_activate (GObject         *object,
 		       guint	        keyval,
 		       GdkModifierType  modifiers)
 {
@@ -1274,8 +1275,6 @@ gtk_bindings_activate (GtkObject       *object,
   gboolean handled = FALSE;
   gboolean is_release;
 
-  g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE);
-
   if (!GTK_IS_WIDGET (object))
     return FALSE;
 
@@ -1296,7 +1295,7 @@ gtk_bindings_activate (GtkObject       *object,
 
 /**
  * gtk_bindings_activate_event:
- * @object: a #GtkObject (generally must be a widget)
+ * @object: a #GObject (generally must be a widget)
  * @event: a #GdkEventKey
  * 
  * Looks up key bindings for @object to find one matching
@@ -1307,7 +1306,7 @@ gtk_bindings_activate (GtkObject       *object,
  * Since: 2.4
  */
 gboolean
-gtk_bindings_activate_event (GtkObject   *object,
+gtk_bindings_activate_event (GObject     *object,
                              GdkEventKey *event)
 {
   GSList *entries = NULL;
@@ -1315,8 +1314,6 @@ gtk_bindings_activate_event (GtkObject   *object,
   GtkKeyHash *key_hash;
   gboolean handled = FALSE;
 
-  g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE);
-
   if (!GTK_IS_WIDGET (object))
     return FALSE;
 
diff --git a/gtk/gtkbindings.h b/gtk/gtkbindings.h
index 904eb3e..260eeb8 100644
--- a/gtk/gtkbindings.h
+++ b/gtk/gtkbindings.h
@@ -1,7 +1,7 @@
 /* GTK - The GIMP Toolkit
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
- * GtkBindingSet: Keybinding manager for GtkObjects.
+ * GtkBindingSet: Keybinding manager for GObjects.
  * Copyright (C) 1998 Tim Janik
  *
  * This library is free software; you can redistribute it and/or
@@ -36,8 +36,7 @@
 
 
 #include <gdk/gdk.h>
-#include <gtk/gtkobject.h>
-
+#include <gtk/gtkenums.h>
 
 G_BEGIN_DECLS
 
@@ -101,15 +100,15 @@ struct _GtkBindingSignal
 GtkBindingSet*	gtk_binding_set_new	(const gchar	*set_name);
 GtkBindingSet*	gtk_binding_set_by_class(gpointer	 object_class);
 GtkBindingSet*	gtk_binding_set_find	(const gchar	*set_name);
-gboolean gtk_bindings_activate		(GtkObject	*object,
+gboolean gtk_bindings_activate		(GObject	*object,
 					 guint		 keyval,
 					 GdkModifierType modifiers);
-gboolean gtk_bindings_activate_event    (GtkObject      *object,
+gboolean gtk_bindings_activate_event    (GObject        *object,
 					 GdkEventKey    *event);
 gboolean gtk_binding_set_activate	(GtkBindingSet	*binding_set,
 					 guint		 keyval,
 					 GdkModifierType modifiers,
-					 GtkObject	*object);
+					 GObject	*object);
 
 void	 gtk_binding_entry_skip         (GtkBindingSet  *binding_set,
                                          guint           keyval,
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 2f931f3..805be79 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -78,6 +78,7 @@
 #include "gtkbox.h"
 #include "gtkorientable.h"
 #include "gtksizerequest.h"
+#include "gtktypeutils.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c
index 127bae2..bf3928e 100644
--- a/gtk/gtkbuilder.c
+++ b/gtk/gtkbuilder.c
@@ -246,6 +246,7 @@
 #include "gtkbuilder.h"
 #include "gtkbuildable.h"
 #include "gtkbuilderprivate.h"
+#include "gtkdebug.h"
 #include "gtkmain.h"
 #include "gtkintl.h"
 #include "gtkprivate.h"
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 865dd96..d8eb6c2 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -145,7 +145,7 @@ gtk_cell_renderer_get_type (void)
 	NULL /* interface data */
       };
 
-      cell_renderer_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkCellRenderer",
+      cell_renderer_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, "GtkCellRenderer",
 						   &cell_renderer_info, G_TYPE_FLAG_ABSTRACT);
 
       g_type_add_interface_static (cell_renderer_type, GTK_TYPE_CELL_SIZE_REQUEST,
diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c
index 9db5377..6d562b4 100644
--- a/gtk/gtkcellrendererspinner.c
+++ b/gtk/gtkcellrendererspinner.c
@@ -32,6 +32,7 @@
 #include "gtkcellrendererspinner.h"
 #include "gtkiconfactory.h"
 #include "gtkicontheme.h"
+#include "gtktypeutils.h"
 #include "gtkintl.h"
 
 
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 690dbfb..6b04ca7 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1283,7 +1283,7 @@ gtk_combo_box_remove (GtkContainer *container,
   gtk_widget_unparent (widget);
   _gtk_bin_set_child (GTK_BIN (container), NULL);
 
-  if (GTK_OBJECT_FLAGS (combo_box) & GTK_IN_DESTRUCTION)
+  if (gtk_widget_in_destruction (combo_box))
     return;
 
   gtk_widget_queue_resize (GTK_WIDGET (container));
@@ -3971,12 +3971,12 @@ gtk_combo_box_menu_key_press (GtkWidget   *widget,
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (data);
 
-  if (!gtk_bindings_activate_event (GTK_OBJECT (widget), event))
+  if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
     {
       /* The menu hasn't managed the
        * event, forward it to the combobox
        */
-      gtk_bindings_activate_event (GTK_OBJECT (combo_box), event);
+      gtk_bindings_activate_event (G_OBJECT (combo_box), event);
     }
 
   return TRUE;
@@ -4010,12 +4010,12 @@ gtk_combo_box_list_key_press (GtkWidget   *widget,
     return TRUE;
   }
 
-  if (!gtk_bindings_activate_event (GTK_OBJECT (widget), event))
+  if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
     {
       /* The list hasn't managed the
        * event, forward it to the combobox
        */
-      gtk_bindings_activate_event (GTK_OBJECT (combo_box), event);
+      gtk_bindings_activate_event (G_OBJECT (combo_box), event);
     }
 
   return TRUE;
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 35871f6..df6cd29 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1086,7 +1086,7 @@ gtk_container_destroy (GtkWidget *widget)
   GtkContainer *container = GTK_CONTAINER (widget);
   GtkContainerPrivate *priv = container->priv;
 
-  if (GTK_CONTAINER_RESIZE_PENDING (container))
+  if (_gtk_widget_get_resize_pending (GTK_WIDGET (container)))
     _gtk_container_dequeue_resize_handler (container);
 
   if (priv->focus_child)
@@ -1278,10 +1278,10 @@ void
 _gtk_container_dequeue_resize_handler (GtkContainer *container)
 {
   g_return_if_fail (GTK_IS_CONTAINER (container));
-  g_return_if_fail (GTK_CONTAINER_RESIZE_PENDING (container));
+  g_return_if_fail (_gtk_widget_get_resize_pending (GTK_WIDGET (container)));
 
   container_resize_queue = g_slist_remove (container_resize_queue, container);
-  GTK_PRIVATE_UNSET_FLAG (container, GTK_RESIZE_PENDING);
+  _gtk_widget_set_resize_pending (GTK_WIDGET (container), FALSE);
 }
 
 /**
@@ -1392,7 +1392,7 @@ gtk_container_idle_sizer (gpointer data)
       widget = slist->data;
       g_slist_free_1 (slist);
 
-      GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
+      _gtk_widget_set_resize_pending (widget, FALSE);
       gtk_container_check_resize (GTK_CONTAINER (widget));
     }
 
@@ -1418,9 +1418,9 @@ _gtk_container_queue_resize (GtkContainer *container)
   
   while (TRUE)
     {
-      GTK_PRIVATE_SET_FLAG (widget, GTK_ALLOC_NEEDED);
-      GTK_PRIVATE_SET_FLAG (widget, GTK_WIDTH_REQUEST_NEEDED);
-      GTK_PRIVATE_SET_FLAG (widget, GTK_HEIGHT_REQUEST_NEEDED);
+      _gtk_widget_set_alloc_needed (widget, TRUE);
+      _gtk_widget_set_width_request_needed (widget, TRUE);
+      _gtk_widget_set_height_request_needed (widget, TRUE);
 
       if ((resize_container && widget == GTK_WIDGET (resize_container)) ||
 	  !(parent = gtk_widget_get_parent (widget)))
@@ -1438,9 +1438,9 @@ _gtk_container_queue_resize (GtkContainer *container)
 	  switch (resize_container->priv->resize_mode)
 	    {
 	    case GTK_RESIZE_QUEUE:
-	      if (!GTK_CONTAINER_RESIZE_PENDING (resize_container))
+	      if (!_gtk_widget_get_resize_pending (GTK_WIDGET (resize_container)))
 		{
-		  GTK_PRIVATE_SET_FLAG (resize_container, GTK_RESIZE_PENDING);
+		  _gtk_widget_set_resize_pending (GTK_WIDGET (resize_container), TRUE);
 		  if (container_resize_queue == NULL)
 		    gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
 				     gtk_container_idle_sizer,
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index f87cae8..7285927 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -608,7 +608,7 @@ gtk_expander_size_allocate (GtkWidget     *widget,
   child_ypad     = 2 * border_width + priv->spacing + (interior_focus ? 0 : 2 * focus_width + 2 * focus_pad);
   top_min_height = 2 * expander_spacing + expander_size;
 
-  child_visible = (child && GTK_WIDGET_CHILD_VISIBLE (child));
+  child_visible = (child && gtk_widget_get_child_visible (child));
 
   if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
     {
@@ -1107,7 +1107,7 @@ focus_in_site (GtkExpander      *expander,
       {
 	GtkWidget *child = gtk_bin_get_child (GTK_BIN (expander));
 
-	if (child && GTK_WIDGET_CHILD_VISIBLE (child))
+	if (child && gtk_widget_get_child_visible (child))
 	  return gtk_widget_child_focus (child, direction);
 	else
 	  return FALSE;
@@ -1325,7 +1325,7 @@ gtk_expander_get_width (GtkSizeRequest      *widget,
       *natural_size += label_nat;
     }
 
-  if (child && GTK_WIDGET_CHILD_VISIBLE (child))
+  if (child && gtk_widget_get_child_visible (child))
     {
       gint child_min, child_nat;
 
@@ -1395,7 +1395,7 @@ gtk_expander_get_height (GtkSizeRequest      *widget,
       *natural_size += extra;
     }
 
-  if (child && GTK_WIDGET_CHILD_VISIBLE (child))
+  if (child && gtk_widget_get_child_visible (child))
     {
       gint child_min, child_nat;
 
@@ -1470,7 +1470,7 @@ gtk_expander_get_height_for_width (GtkSizeRequest *widget,
       *natural_height += extra;
     }
 
-  if (child && GTK_WIDGET_CHILD_VISIBLE (child))
+  if (child && gtk_widget_get_child_visible (child))
     {
       gint child_min, child_nat;
 
diff --git a/gtk/gtkfilefilter.c b/gtk/gtkfilefilter.c
index 5a735b0..9d4e248 100644
--- a/gtk/gtkfilefilter.c
+++ b/gtk/gtkfilefilter.c
@@ -74,7 +74,7 @@ struct _FilterRule
 static void gtk_file_filter_finalize   (GObject            *object);
 
 
-G_DEFINE_TYPE (GtkFileFilter, gtk_file_filter, GTK_TYPE_OBJECT)
+G_DEFINE_TYPE (GtkFileFilter, gtk_file_filter, G_TYPE_INITIALLY_UNOWNED)
 
 static void
 gtk_file_filter_init (GtkFileFilter *object)
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c
index 4819125..efd5fe8 100644
--- a/gtk/gtkhsv.c
+++ b/gtk/gtkhsv.c
@@ -39,6 +39,7 @@
 #include "gtkhsv.h"
 #include "gtkbindings.h"
 #include "gtkmarshalers.h"
+#include "gtktypeutils.h"
 #include "gtkintl.h"
 
 /* Default width/height */
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 19bb542..016dd8c 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -39,6 +39,7 @@
 #endif /* G_OS_WIN32 */
 
 #include "gtkicontheme.h"
+#include "gtkdebug.h"
 #include "gtkiconfactory.h"
 #include "gtkiconcache.h"
 #include "gtkbuiltincache.h"
diff --git a/gtk/gtkimcontext.h b/gtk/gtkimcontext.h
index 25c218b..1c5dfd0 100644
--- a/gtk/gtkimcontext.h
+++ b/gtk/gtkimcontext.h
@@ -26,7 +26,6 @@
 
 
 #include <gdk/gdk.h>
-#include <gtk/gtkobject.h>
 
 
 G_BEGIN_DECLS
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index b5d5937..36e0ead 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -27,6 +27,7 @@
 #include "gtkimcontextsimple.h"
 #include "gtksettings.h"
 #include "gtkwidget.h"
+#include "gtkdebug.h"
 #include "gtkintl.h"
 
 
diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c
index c8d7258..9c3341f 100644
--- a/gtk/gtkinvisible.c
+++ b/gtk/gtkinvisible.c
@@ -268,7 +268,7 @@ gtk_invisible_style_set (GtkWidget *widget,
 static void
 gtk_invisible_show (GtkWidget *widget)
 {
-  GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+  _gtk_widget_set_visible_flag (widget, TRUE);
   gtk_widget_map (widget);
 }
 
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index e9ebc01..1a6c0b1 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1931,7 +1931,7 @@ gtk_grab_notify_foreach (GtkWidget *child,
 
   if (is_shadowed)
     {
-      GTK_PRIVATE_SET_FLAG (child, GTK_SHADOWED);
+      _gtk_widget_set_shadowed (child, TRUE);
       if (!was_shadowed && devices &&
 	  gtk_widget_is_sensitive (child))
         synth_crossing_for_grab_notify (child, info->new_grab_widget,
@@ -1940,7 +1940,7 @@ gtk_grab_notify_foreach (GtkWidget *child,
     }
   else
     {
-      GTK_PRIVATE_UNSET_FLAG (child, GTK_SHADOWED);
+      _gtk_widget_set_shadowed (child, FALSE);
       if (was_shadowed && devices &&
           gtk_widget_is_sensitive (child))
         synth_crossing_for_grab_notify (info->old_grab_widget, child,
@@ -2232,25 +2232,25 @@ gtk_quit_destroy (GtkQuitFunction *quitf)
 }
 
 static gint
-gtk_quit_destructor (GtkObject **object_p)
+gtk_quit_destructor (GtkWidget **object_p)
 {
   if (*object_p)
-    gtk_object_destroy (*object_p);
+    gtk_widget_destroy (*object_p);
   g_free (object_p);
 
   return FALSE;
 }
 
 void
-gtk_quit_add_destroy (guint              main_level,
-		      GtkObject         *object)
+gtk_quit_add_destroy (guint      main_level,
+		      GtkWidget *object)
 {
-  GtkObject **object_p;
+  GtkWidget **object_p;
 
   g_return_if_fail (main_level > 0);
-  g_return_if_fail (GTK_IS_OBJECT (object));
+  g_return_if_fail (GTK_IS_WIDGET (object));
 
-  object_p = g_new (GtkObject*, 1);
+  object_p = g_new (GtkWidget*, 1);
   *object_p = object;
   g_signal_connect (object,
 		    "destroy",
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 39171f5..04b9fd8 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -33,6 +33,7 @@
 
 
 #include <gdk/gdk.h>
+#include <gtk/gtktypeutils.h>
 #include <gtk/gtkwidget.h>
 #ifdef G_PLATFORM_WIN32
 #include <gtk/gtkbox.h>
@@ -144,7 +145,7 @@ void       gtk_device_grab_remove  (GtkWidget          *widget,
 void	   gtk_init_add		   (GtkFunction	       function,
 				    gpointer	       data);
 void	   gtk_quit_add_destroy	   (guint	       main_level,
-				    GtkObject	      *object);
+				    GtkWidget	      *object);
 guint	   gtk_quit_add		   (guint	       main_level,
 				    GtkFunction	       function,
 				    gpointer	       data);
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 9aee0f1..cff9524 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -909,7 +909,7 @@ gtk_menu_shell_key_press (GtkWidget   *widget,
   if (!(menu_shell->active_menu_item || priv->in_unselectable_item) && menu_shell->parent_menu_shell)
     return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent *)event);
 
-  if (gtk_bindings_activate_event (GTK_OBJECT (widget), event))
+  if (gtk_bindings_activate_event (G_OBJECT (widget), event))
     return TRUE;
 
   g_object_get (gtk_widget_get_settings (widget),
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 1562759..82e46fc 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -1714,7 +1714,7 @@ gtk_notebook_map (GtkWidget *widget)
     {
       if (priv->action_widget[i] &&
           gtk_widget_get_visible (priv->action_widget[i]) &&
-          GTK_WIDGET_CHILD_VISIBLE (priv->action_widget[i]) &&
+          gtk_widget_get_child_visible (priv->action_widget[i]) &&
           !gtk_widget_get_mapped (priv->action_widget[i]))
         gtk_widget_map (priv->action_widget[i]);
     }
@@ -4616,10 +4616,9 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
   GList * next_list;
   gint need_resize = FALSE;
   GtkWidget *tab_label;
-
   gboolean destroying;
 
-  destroying = GTK_OBJECT_FLAGS (notebook) & GTK_IN_DESTRUCTION;
+  destroying = gtk_widget_in_destruction (notebook);
 
   next_list = gtk_notebook_search_page (notebook, list, STEP_NEXT, TRUE);
   if (!next_list)
diff --git a/gtk/gtkoffscreenwindow.c b/gtk/gtkoffscreenwindow.c
index 26bbadb..3a55d9a 100644
--- a/gtk/gtkoffscreenwindow.c
+++ b/gtk/gtkoffscreenwindow.c
@@ -200,7 +200,7 @@ gtk_offscreen_window_show (GtkWidget *widget)
   gboolean need_resize;
   GtkContainer *container;
 
-  GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+  _gtk_widget_set_visible_flag (widget, TRUE);
 
   container = GTK_CONTAINER (widget);
   need_resize = _gtk_container_get_need_resize (container) || !gtk_widget_get_realized (widget);
@@ -219,7 +219,7 @@ gtk_offscreen_window_show (GtkWidget *widget)
 static void
 gtk_offscreen_window_hide (GtkWidget *widget)
 {
-  GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+  _gtk_widget_set_visible_flag (widget, FALSE);
   gtk_widget_unmap (widget);
 }
 
diff --git a/gtk/gtkorientable.c b/gtk/gtkorientable.c
index 33a59df..2a3c761 100644
--- a/gtk/gtkorientable.c
+++ b/gtk/gtkorientable.c
@@ -25,6 +25,7 @@
 
 #include "gtkorientable.h"
 #include "gtkprivate.h"
+#include "gtktypeutils.h"
 #include "gtkintl.h"
 
 
diff --git a/gtk/gtkplug-x11.c b/gtk/gtkplug-x11.c
index da8e5ea..47d74ef 100644
--- a/gtk/gtkplug-x11.c
+++ b/gtk/gtkplug-x11.c
@@ -45,6 +45,7 @@
 #include "gtkplug.h"
 #include "gtkprivate.h"
 #include "gtkplugprivate.h"
+#include "gtkdebug.h"
 
 #include "x11/gdkx.h"
 
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index c31f070..6839ec7 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -418,7 +418,7 @@ _gtk_plug_remove_from_socket (GtkPlug   *plug,
   priv = plug->priv;
   widget = GTK_WIDGET (plug);
 
-  if (GTK_WIDGET_IN_REPARENT (widget))
+  if (_gtk_widget_get_in_reparent (widget))
     return;
 
   g_object_ref (plug);
@@ -428,12 +428,12 @@ _gtk_plug_remove_from_socket (GtkPlug   *plug,
   window = gtk_widget_get_window (widget);
 
   gdk_window_hide (window);
-  GTK_PRIVATE_SET_FLAG (plug, GTK_IN_REPARENT);
+  _gtk_widget_set_in_reparent (widget, TRUE);
   gdk_window_reparent (window,
 		       gtk_widget_get_root_window (widget),
 		       0, 0);
   gtk_widget_unparent (GTK_WIDGET (plug));
-  GTK_PRIVATE_UNSET_FLAG (plug, GTK_IN_REPARENT);
+  _gtk_widget_set_in_reparent (widget, FALSE);
   
   socket_->plug_widget = NULL;
   if (socket_->plug_window != NULL)
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 9e5b4cf..bae28cb 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -31,50 +31,29 @@
 
 G_BEGIN_DECLS
 
-/* The private flags that are used in the private_flags member of GtkWidget.
- */
-typedef enum
-{
-  PRIVATE_GTK_USER_STYLE            = 1 <<  0,
-  PRIVATE_GTK_RESIZE_PENDING        = 1 <<  2,
-  PRIVATE_GTK_HAS_POINTER           = 1 <<  3,   /* If the pointer is above a window belonging to the widget */
-  PRIVATE_GTK_SHADOWED		    = 1 <<  4,   /* If there is a grab in effect shadowing the widget */
-  PRIVATE_GTK_HAS_SHAPE_MASK	    = 1 <<  5,
-  PRIVATE_GTK_IN_REPARENT           = 1 <<  6,
-  PRIVATE_GTK_DIRECTION_SET         = 1 <<  7,   /* If the reading direction is not DIR_NONE */
-  PRIVATE_GTK_DIRECTION_LTR         = 1 <<  8,   /* If the reading direction is DIR_LTR */
-  PRIVATE_GTK_ANCHORED              = 1 <<  9,   /* If widget has a GtkWindow ancestor */
-  PRIVATE_GTK_CHILD_VISIBLE         = 1 <<  10,  /* If widget should be mapped when parent is mapped */
-  PRIVATE_GTK_REDRAW_ON_ALLOC       = 1 <<  11,  /* If we should queue a draw on the entire widget when it is reallocated */
-  PRIVATE_GTK_ALLOC_NEEDED          = 1 <<  12,  /* If we we should allocate even if the allocation is the same */
-  PRIVATE_GTK_WIDTH_REQUEST_NEEDED  = 1 <<  13,  /* Whether we need to call gtk_extended_layout_get_desired_width */
-  PRIVATE_GTK_HEIGHT_REQUEST_NEEDED = 1 <<  14   /* Whether we need to call gtk_extended_layout_get_desired_height */
-} GtkPrivateFlags;
-
-/* Macros for extracting a widgets private_flags from GtkWidget.
- */
-#define GTK_PRIVATE_FLAGS(wid)                (GTK_WIDGET (wid)->private_flags)
-#define GTK_WIDGET_USER_STYLE(obj)            ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_USER_STYLE) != 0)
-#define GTK_CONTAINER_RESIZE_PENDING(obj)     ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_PENDING) != 0)
-#define GTK_WIDGET_HAS_POINTER(obj)           ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HAS_POINTER) != 0)
-#define GTK_WIDGET_SHADOWED(obj)              ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_SHADOWED) != 0)
-#define GTK_WIDGET_HAS_SHAPE_MASK(obj)        ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HAS_SHAPE_MASK) != 0)
-#define GTK_WIDGET_IN_REPARENT(obj)           ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_IN_REPARENT) != 0)
-#define GTK_WIDGET_DIRECTION_SET(obj)         ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_DIRECTION_SET) != 0)
-#define GTK_WIDGET_DIRECTION_LTR(obj)         ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_DIRECTION_LTR) != 0)
-#define GTK_WIDGET_ANCHORED(obj)              ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_ANCHORED) != 0)
-#define GTK_WIDGET_CHILD_VISIBLE(obj)         ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_CHILD_VISIBLE) != 0)
-#define GTK_WIDGET_REDRAW_ON_ALLOC(obj)       ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_REDRAW_ON_ALLOC) != 0)
-#define GTK_WIDGET_ALLOC_NEEDED(obj)          ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_ALLOC_NEEDED) != 0)
-#define GTK_WIDGET_WIDTH_REQUEST_NEEDED(obj)  ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_WIDTH_REQUEST_NEEDED) != 0)
-#define GTK_WIDGET_HEIGHT_REQUEST_NEEDED(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HEIGHT_REQUEST_NEEDED) != 0)
-
-/* Macros for setting and clearing private widget flags.
- * we use a preprocessor string concatenation here for a clear
- * flags/private_flags distinction at the cost of single flag operations.
- */
-#define GTK_PRIVATE_SET_FLAG(wid,flag)    G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) |= (PRIVATE_ ## flag)); }G_STMT_END
-#define GTK_PRIVATE_UNSET_FLAG(wid,flag)  G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) &= ~(PRIVATE_ ## flag)); }G_STMT_END
+void         _gtk_widget_set_visible_flag   (GtkWidget *widget,
+                                             gboolean   visible);
+gboolean     _gtk_widget_get_resize_pending (GtkWidget *widget);
+void         _gtk_widget_set_resize_pending (GtkWidget *widget,
+                                             gboolean   resize_pending);
+gboolean     _gtk_widget_get_in_reparent    (GtkWidget *widget);
+void         _gtk_widget_set_in_reparent    (GtkWidget *widget,
+                                             gboolean   in_reparent);
+gboolean     _gtk_widget_get_anchored       (GtkWidget *widget);
+void         _gtk_widget_set_anchored       (GtkWidget *widget,
+                                             gboolean   anchored);
+gboolean     _gtk_widget_get_shadowed       (GtkWidget *widget);
+void         _gtk_widget_set_shadowed       (GtkWidget *widget,
+                                             gboolean   shadowed);
+gboolean     _gtk_widget_get_alloc_needed   (GtkWidget *widget);
+void         _gtk_widget_set_alloc_needed   (GtkWidget *widget,
+                                             gboolean   alloc_needed);
+gboolean     _gtk_widget_get_width_request_needed  (GtkWidget *widget);
+void         _gtk_widget_set_width_request_needed  (GtkWidget *widget,
+                                                    gboolean   width_request_needed);
+gboolean     _gtk_widget_get_height_request_needed (GtkWidget *widget);
+void         _gtk_widget_set_height_request_needed (GtkWidget *widget,
+                                                    gboolean   height_request_needed);
 
 #ifdef G_OS_WIN32
 
diff --git a/gtk/gtkrecentfilter.c b/gtk/gtkrecentfilter.c
index 7dced40..1f2b1fb 100644
--- a/gtk/gtkrecentfilter.c
+++ b/gtk/gtkrecentfilter.c
@@ -75,7 +75,7 @@ struct _FilterRule
   } u;
 };
 
-G_DEFINE_TYPE (GtkRecentFilter, gtk_recent_filter, GTK_TYPE_OBJECT)
+G_DEFINE_TYPE (GtkRecentFilter, gtk_recent_filter, G_TYPE_INITIALLY_UNOWNED)
 
 
 static void
diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c
index c02a82d..209c7c2 100644
--- a/gtk/gtkruler.c
+++ b/gtk/gtkruler.c
@@ -31,6 +31,7 @@
 
 #include "gtkorientable.h"
 #include "gtkruler.h"
+#include "gtktypeutils.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 95dbc63..9ff1101 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -1139,7 +1139,7 @@ static gboolean
 gtk_scale_button_key_release (GtkWidget   *widget,
 			      GdkEventKey *event)
 {
-  return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
+  return gtk_bindings_activate_event (G_OBJECT (widget), event);
 }
 
 /* This is called when the grab is broken for
@@ -1386,10 +1386,10 @@ cb_dock_key_release (GtkWidget   *widget,
       return TRUE;
     }
 
-  if (!gtk_bindings_activate_event (GTK_OBJECT (widget), event))
+  if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
     {
       /* The popup hasn't managed the event, pass onto the button */
-      gtk_bindings_activate_event (GTK_OBJECT (user_data), event);
+      gtk_bindings_activate_event (G_OBJECT (user_data), event);
     }
 
   return TRUE;
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 28a5de3..5e8acee 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -32,6 +32,7 @@
 #include "gtkmarshalers.h"
 #include "gtkscrolledwindow.h"
 #include "gtkwindow.h"
+#include "gtktypeutils.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index ed618f8..d82e517 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -57,6 +57,7 @@
 #include "gdk.h"
 
 #include "gtkmain.h"
+#include "gtkdebug.h"
 #include "gtkselection.h"
 #include "gtktextbufferrichtext.h"
 #include "gtkintl.h"
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 8690a9c..72fbd43 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -27,6 +27,7 @@
 #include "gtkrc.h"
 #include "gtkintl.h"
 #include "gtkwidget.h"
+#include "gtktypeutils.h"
 #include "gtkprivate.h"
 
 #ifdef GDK_WINDOWING_X11
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index 9116a18..4a3da3e 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -187,9 +187,9 @@ real_queue_resize (GtkWidget *widget)
 {
   GtkWidget *parent;
 
-  GTK_PRIVATE_SET_FLAG (widget, GTK_ALLOC_NEEDED);
-  GTK_PRIVATE_SET_FLAG (widget, GTK_WIDTH_REQUEST_NEEDED);
-  GTK_PRIVATE_SET_FLAG (widget, GTK_HEIGHT_REQUEST_NEEDED);
+  _gtk_widget_set_alloc_needed (widget, TRUE);
+  _gtk_widget_set_width_request_needed (widget, TRUE);
+  _gtk_widget_set_height_request_needed (widget, TRUE);
 
   parent = gtk_widget_get_parent (widget);
   if (parent)
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index db72826..01abc70 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -122,6 +122,7 @@
 #include <config.h>
 #include "gtksizerequest.h"
 #include "gtksizegroup.h"
+#include "gtkdebug.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
@@ -256,7 +257,7 @@ compute_size_for_orientation (GtkSizeRequest    *request,
     {
       cached_size = &cache->widths[0];
 
-      if (!GTK_WIDGET_WIDTH_REQUEST_NEEDED (request))
+      if (!_gtk_widget_get_width_request_needed (widget))
         found_in_cache = get_cached_size (for_size, cache->widths, &cached_size);
       else
         {
@@ -268,7 +269,7 @@ compute_size_for_orientation (GtkSizeRequest    *request,
     {
       cached_size = &cache->heights[0];
 
-      if (!GTK_WIDGET_HEIGHT_REQUEST_NEEDED (request))
+      if (!_gtk_widget_get_height_request_needed (widget))
         found_in_cache = get_cached_size (for_size, cache->heights, &cached_size);
       else
         {
@@ -330,14 +331,14 @@ compute_size_for_orientation (GtkSizeRequest    *request,
           cached_size->age = cache->cached_width_age;
           cache->cached_width_age++;
 
-          GTK_PRIVATE_UNSET_FLAG (request, GTK_WIDTH_REQUEST_NEEDED);
+          _gtk_widget_set_width_request_needed (widget, FALSE);
         }
       else
         {
           cached_size->age = cache->cached_height_age;
           cache->cached_height_age++;
 
-          GTK_PRIVATE_UNSET_FLAG (request, GTK_HEIGHT_REQUEST_NEEDED);
+          _gtk_widget_set_height_request_needed (widget, FALSE);
         }
 
       adjusted_min = cached_size->minimum_size;
diff --git a/gtk/gtksocket-win32.c b/gtk/gtksocket-win32.c
index 8e9406f..d300304 100644
--- a/gtk/gtksocket-win32.c
+++ b/gtk/gtksocket-win32.c
@@ -43,7 +43,7 @@ GdkNativeWindow
 _gtk_socket_windowing_get_id (GtkSocket *socket)
 {
   g_return_val_if_fail (GTK_IS_SOCKET (socket), 0);
-  g_return_val_if_fail (GTK_WIDGET_ANCHORED (socket), 0);
+  g_return_val_if_fail (_gtk_widget_get_anchored (GTK_WIDGET (socket)), 0);
 
   if (!gtk_widget_get_realized (GTK_WIDGET (socket)))
     gtk_widget_realize (GTK_WIDGET (socket));
diff --git a/gtk/gtksocket-x11.c b/gtk/gtksocket-x11.c
index 6d1e626..12de812 100644
--- a/gtk/gtksocket-x11.c
+++ b/gtk/gtksocket-x11.c
@@ -37,6 +37,7 @@
 #include "gtksocket.h"
 #include "gtksocketprivate.h"
 #include "gtkdnd.h"
+#include "gtkdebug.h"
 
 #include "x11/gdkx.h"
 
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index 36d3119..d596a2c 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -40,6 +40,7 @@
 #include "gtkprivate.h"
 #include "gtksocketprivate.h"
 #include "gtkdnd.h"
+#include "gtkdebug.h"
 #include "gtkintl.h"
 
 
@@ -309,7 +310,7 @@ gtk_socket_add_id (GtkSocket      *socket,
 		   GdkNativeWindow window_id)
 {
   g_return_if_fail (GTK_IS_SOCKET (socket));
-  g_return_if_fail (GTK_WIDGET_ANCHORED (socket));
+  g_return_if_fail (_gtk_widget_get_anchored (GTK_WIDGET (socket)));
 
   if (!gtk_widget_get_realized (GTK_WIDGET (socket)))
     gtk_widget_realize (GTK_WIDGET (socket));
@@ -334,7 +335,7 @@ GdkNativeWindow
 gtk_socket_get_id (GtkSocket *socket)
 {
   g_return_val_if_fail (GTK_IS_SOCKET (socket), 0);
-  g_return_val_if_fail (GTK_WIDGET_ANCHORED (socket), 0);
+  g_return_val_if_fail (_gtk_widget_get_anchored (GTK_WIDGET (socket)), 0);
 
   if (!gtk_widget_get_realized (GTK_WIDGET (socket)))
     gtk_widget_realize (GTK_WIDGET (socket));
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 8ae92fd..0ba732f 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -39,6 +39,7 @@
 #include "gtkiconfactory.h"
 #include "gtksettings.h"	/* _gtk_settings_parse_convert() */
 #include "gtkintl.h"
+#include "gtkdebug.h"
 #include "gtkspinner.h"
 
 
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index 9de0ab3..8e07de8 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -30,6 +30,7 @@
 
 #include "gtkprivate.h"
 #include "gtksizerequest.h"
+#include "gtktypeutils.h"
 #include "gtkintl.h"
 
 
diff --git a/gtk/gtktestutils.h b/gtk/gtktestutils.h
index 5b90dc6..c6fe4fa 100644
--- a/gtk/gtktestutils.h
+++ b/gtk/gtktestutils.h
@@ -25,6 +25,9 @@
 #ifndef __GTK_TEST_UTILS_H__
 #define __GTK_TEST_UTILS_H__
 
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkspinbutton.h>
+
 G_BEGIN_DECLS
 
 /* --- Gtk+ Test Utility API --- */
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 929810e..6dd77c7 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -222,7 +222,7 @@ gtk_text_layout_class_init (GtkTextLayoutClass *klass)
                   _gtk_marshal_VOID__OBJECT_INT_INT,
                   G_TYPE_NONE,
                   3,
-                  GTK_TYPE_OBJECT,
+                  G_TYPE_OBJECT,
                   G_TYPE_INT,
                   G_TYPE_INT);
   
diff --git a/gtk/gtktexttag.h b/gtk/gtktexttag.h
index d74a43b..20d631a 100644
--- a/gtk/gtktexttag.h
+++ b/gtk/gtktexttag.h
@@ -58,9 +58,6 @@
 #include <gdk/gdk.h>
 #include <gtk/gtkenums.h>
 
-/* Not needed, retained for compatibility -Yosh */
-#include <gtk/gtkobject.h>
-
 
 G_BEGIN_DECLS
 
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index bec1d31..34dcd05 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -3440,7 +3440,7 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
            * get in the way. Invalidating the layout around the anchor
            * achieves this.
 	   */ 
-	  if (GTK_WIDGET_ALLOC_NEEDED (child->widget))
+	  if (_gtk_widget_get_alloc_needed (child->widget))
 	    {
 	      GtkTextIter end = child_loc;
 	      gtk_text_iter_forward_char (&end);
diff --git a/gtk/gtkthemes.c b/gtk/gtkthemes.c
index 7a55322..1533fa4 100644
--- a/gtk/gtkthemes.c
+++ b/gtk/gtkthemes.c
@@ -33,6 +33,7 @@
 #include "gtkthemes.h"
 #include "gtkrc.h"
 #include "gtkintl.h"
+#include "gtkdebug.h"
 
 
 typedef struct _GtkThemeEngineClass GtkThemeEngineClass;
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 8c943c4..0ac4f18 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -3394,7 +3394,7 @@ toolbar_content_get_state (ToolbarContent *content)
 static gboolean
 toolbar_content_child_visible (ToolbarContent *content)
 {
-  return GTK_WIDGET_CHILD_VISIBLE (content->item);
+  return gtk_widget_get_child_visible (content->item);
 }
 
 static void
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index 5575277..0c4c3af 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -28,6 +28,8 @@
 #include "gtkintl.h"
 #include "gtkprivate.h"
 #include "gtktrayicon.h"
+#include "gtktestutils.h"
+#include "gtkdebug.h"
 
 #include "x11/gdkx.h"
 #include <X11/Xatom.h>
diff --git a/gtk/gtktreemodel.h b/gtk/gtktreemodel.h
index e7f59c6..b706a00 100644
--- a/gtk/gtktreemodel.h
+++ b/gtk/gtktreemodel.h
@@ -26,9 +26,6 @@
 
 #include <glib-object.h>
 
-/* Not needed, retained for compatibility -Yosh */
-#include <gtk/gtkobject.h>
-
 G_BEGIN_DECLS
 
 #define GTK_TYPE_TREE_MODEL            (gtk_tree_model_get_type ())
diff --git a/gtk/gtktreesortable.h b/gtk/gtktreesortable.h
index 52dea71..dec601a 100644
--- a/gtk/gtktreesortable.h
+++ b/gtk/gtktreesortable.h
@@ -25,6 +25,7 @@
 #define __GTK_TREE_SORTABLE_H__
 
 
+#include <gtk/gtkenums.h>
 #include <gtk/gtktreemodel.h>
 #include <gtk/gtktypeutils.h>
 
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index d1a533c..0aecf2d 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -11779,7 +11779,7 @@ gtk_tree_view_scroll_to_cell (GtkTreeView       *tree_view,
    */
   if (!gtk_widget_get_visible (GTK_WIDGET (tree_view)) ||
       !gtk_widget_get_realized (GTK_WIDGET (tree_view)) ||
-      GTK_WIDGET_ALLOC_NEEDED (tree_view) || 
+      _gtk_widget_get_alloc_needed (tree_view) ||
       GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID))
     {
       if (tree_view->priv->scroll_to_path)
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index bd5b36e..6f3d2c7 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -161,7 +161,7 @@ static void gtk_tree_view_column_buildable_init                 (GtkBuildableIfa
 
 static guint tree_column_signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE_WITH_CODE (GtkTreeViewColumn, gtk_tree_view_column, GTK_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (GtkTreeViewColumn, gtk_tree_view_column, G_TYPE_INITIALLY_UNOWNED,
 			 G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
 						gtk_tree_view_column_cell_layout_init)
 			 G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
diff --git a/gtk/gtktypeutils.c b/gtk/gtktypeutils.c
index ea30f06..b215a4c 100644
--- a/gtk/gtktypeutils.c
+++ b/gtk/gtktypeutils.c
@@ -28,7 +28,6 @@
 #include <string.h> /* strcmp */
 
 #include "gtktypeutils.h"
-#include "gtkobject.h"
 #include "gtkintl.h"
 
 
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 449af88..9539693 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -29,6 +29,7 @@
 #include "gtksizerequest.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
+#include "gtktypeutils.h"
 #include "gtkprivate.h"
 
 
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4b7157a..5f26338 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -56,6 +56,7 @@
 #include "gtkbuildable.h"
 #include "gtkbuilderprivate.h"
 #include "gtksizerequest.h"
+#include "gtkdebug.h"
 
 
 /**
@@ -146,10 +147,39 @@ struct _GtkWidgetPrivate
    */
   guint saved_state : 3;
 
-  /* unused bits in our 32-bit block */
-  guint reserved : 10;
-
-  guint in_destruction : 1;
+  guint direction             : 2;
+
+  guint in_destruction        : 1;
+  guint toplevel              : 1;
+  guint anchored              : 1;
+  guint composite_child       : 1;
+  guint no_window             : 1;
+  guint realized              : 1;
+  guint mapped                : 1;
+  guint visible               : 1;
+  guint sensitive             : 1;
+  guint parent_sensitive      : 1;
+  guint can_focus             : 1;
+  guint has_focus             : 1;
+  guint can_default           : 1;
+  guint has_default           : 1;
+  guint receives_default      : 1;
+  guint has_grab              : 1;
+  guint shadowed              : 1;
+  guint rc_style              : 1;
+  guint user_style            : 1;
+  guint app_paintable         : 1;
+  guint double_buffered       : 1;
+  guint redraw_on_alloc       : 1;
+  guint no_show_all           : 1;
+  guint child_visible         : 1;
+  guint multidevice           : 1;
+  guint has_shape_mask        : 1;
+  guint in_reparent           : 1;
+  guint resize_pending        : 1;
+  guint alloc_needed          : 1;
+  guint width_request_needed  : 1;
+  guint height_request_needed : 1;
 
   /* The widget's name. If the widget does not have a name
    *  (the name is NULL), then its name (as returned by
@@ -314,7 +344,7 @@ static void	gtk_widget_get_property		 (GObject           *object,
 						  GValue            *value,
 						  GParamSpec        *pspec);
 static void	gtk_widget_dispose		 (GObject	    *object);
-static void	gtk_widget_real_destroy		 (GtkObject	    *object);
+static void	gtk_widget_real_destroy		 (GtkWidget	    *object);
 static void	gtk_widget_finalize		 (GObject	    *object);
 static void	gtk_widget_real_show		 (GtkWidget	    *widget);
 static void	gtk_widget_real_hide		 (GtkWidget	    *widget);
@@ -537,7 +567,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 {
   static GObjectNotifyContext cpn_context = { 0, NULL, NULL };
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
   GtkBindingSet *binding_set;
 
   gtk_widget_parent_class = g_type_class_peek_parent (klass);
@@ -573,8 +602,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   gobject_class->set_property = gtk_widget_set_property;
   gobject_class->get_property = gtk_widget_get_property;
 
-  object_class->destroy = gtk_widget_real_destroy;
-  
+  klass->destroy = gtk_widget_real_destroy;
+
   klass->activate_signal = 0;
   klass->set_scroll_adjustments_signal = 0;
   klass->dispatch_child_properties_changed = gtk_widget_dispatch_child_properties_changed;
@@ -1007,14 +1036,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                                                      0,
                                                      GTK_PARAM_READWRITE));
 
-   /**
-    * GtkWidget::destroy:
-    * @object: the object which received the signal
-    *
-    * Signals that all holders of a reference to the widget should release
-    * the reference that they hold. May result in finalization of the widget
-    * if all references are released.
-    */
+  /**
+   * GtkWidget::destroy:
+   * @object: the object which received the signal
+   *
+   * Signals that all holders of a reference to the widget should release
+   * the reference that they hold. May result in finalization of the widget
+   * if all references are released.
+   */
   widget_signals[DESTROY] =
     g_signal_new (I_("destroy"),
                   G_TYPE_FROM_CLASS (gobject_class),
@@ -1210,14 +1239,15 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  _gtk_marshal_VOID__OBJECT,
 		  G_TYPE_NONE, 1,
 		  GTK_TYPE_STYLE);
-/**
- * GtkWidget::direction-changed:
- * @widget: the object on which the signal is emitted
- * @previous_direction: the previous text direction of @widget
- *
- * The ::direction-changed signal is emitted when the text direction
- * of a widget changes.
- */
+
+  /**
+   * GtkWidget::direction-changed:
+   * @widget: the object on which the signal is emitted
+   * @previous_direction: the previous text direction of @widget
+   *
+   * The ::direction-changed signal is emitted when the text direction
+   * of a widget changes.
+   */
   widget_signals[DIRECTION_CHANGED] =
     g_signal_new (I_("direction-changed"),
 		  G_TYPE_FROM_CLASS (gobject_class),
@@ -1253,15 +1283,15 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  G_TYPE_NONE, 1,
 		  G_TYPE_BOOLEAN);
 
-/**
- * GtkWidget::child-notify:
- * @widget: the object which received the signal
- * @pspec: the #GParamSpec of the changed child property
- *
- * The ::child-notify signal is emitted for each 
- * <link linkend="child-properties">child property</link>  that has
- * changed on an object. The signal's detail holds the property name. 
- */
+  /**
+   * GtkWidget::child-notify:
+   * @widget: the object which received the signal
+   * @pspec: the #GParamSpec of the changed child property
+   *
+   * The ::child-notify signal is emitted for each 
+   * <link linkend="child-properties">child property</link>  that has
+   * changed on an object. The signal's detail holds the property name. 
+   */
   widget_signals[CHILD_NOTIFY] =
     g_signal_new (I_("child-notify"),
 		   G_TYPE_FROM_CLASS (gobject_class),
@@ -1309,7 +1339,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[FOCUS] =
     g_signal_new (I_("focus"),
-		  G_TYPE_FROM_CLASS (object_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, focus),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1324,7 +1354,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[MOVE_FOCUS] =
     g_signal_new_class_handler (I_("move-focus"),
-                                G_TYPE_FROM_CLASS (object_class),
+                                G_TYPE_FROM_CLASS (klass),
                                 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                                 G_CALLBACK (gtk_widget_real_move_focus),
                                 NULL, NULL,
@@ -1332,6 +1362,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                                 G_TYPE_NONE,
                                 1,
                                 GTK_TYPE_DIRECTION_TYPE);
+
   /**
    * GtkWidget::event:
    * @widget: the object which received the signal.
@@ -1351,7 +1382,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[EVENT] =
     g_signal_new (I_("event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1371,7 +1402,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[EVENT_AFTER] =
     g_signal_new (I_("event-after"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  0,
 		  0,
 		  NULL, NULL,
@@ -1398,7 +1429,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[BUTTON_PRESS_EVENT] =
     g_signal_new (I_("button-press-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, button_press_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1425,7 +1456,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[BUTTON_RELEASE_EVENT] =
     g_signal_new (I_("button-release-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, button_release_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1453,13 +1484,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SCROLL_EVENT] =
     g_signal_new (I_("scroll-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, scroll_event),
 		  _gtk_boolean_handled_accumulator, NULL,
 		  _gtk_marshal_BOOLEAN__BOXED,
 		  G_TYPE_BOOLEAN, 1,
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
   /**
    * GtkWidget::motion-notify-event:
    * @widget: the object which received the signal.
@@ -1479,7 +1511,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[MOTION_NOTIFY_EVENT] =
     g_signal_new (I_("motion-notify-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, motion_notify_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1497,7 +1529,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[COMPOSITED_CHANGED] =
     g_signal_new (I_("composited-changed"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
 		  G_STRUCT_OFFSET (GtkWidgetClass, composited_changed),
 		  NULL, NULL,
@@ -1520,7 +1552,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    **/
   widget_signals[KEYNAV_FAILED] =
     g_signal_new_class_handler (I_("keynav-failed"),
-                                G_TYPE_FROM_CLASS (gobject_class),
+                                G_TYPE_FROM_CLASS (klass),
                                 G_SIGNAL_RUN_LAST,
                                 G_CALLBACK (gtk_widget_real_keynav_failed),
                                 _gtk_boolean_handled_accumulator, NULL,
@@ -1544,7 +1576,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DELETE_EVENT] =
     g_signal_new (I_("delete-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, delete_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1571,7 +1603,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DESTROY_EVENT] =
     g_signal_new (I_("destroy-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, destroy_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1598,7 +1630,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[EXPOSE_EVENT] =
     g_signal_new (I_("expose-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, expose_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1623,7 +1655,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[KEY_PRESS_EVENT] =
     g_signal_new (I_("key-press-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, key_press_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1648,7 +1680,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[KEY_RELEASE_EVENT] =
     g_signal_new (I_("key-release-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, key_release_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1675,7 +1707,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[ENTER_NOTIFY_EVENT] =
     g_signal_new (I_("enter-notify-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, enter_notify_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1702,7 +1734,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[LEAVE_NOTIFY_EVENT] =
     g_signal_new (I_("leave-notify-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, leave_notify_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1711,7 +1743,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::configure-event
+   * GtkWidget::configure-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventConfigure): the #GdkEventConfigure which triggered
    *   this signal.
@@ -1728,7 +1760,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[CONFIGURE_EVENT] =
     g_signal_new (I_("configure-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, configure_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1737,7 +1769,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::focus-in-event
+   * GtkWidget::focus-in-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventFocus): the #GdkEventFocus which triggered
    *   this signal.
@@ -1753,7 +1785,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[FOCUS_IN_EVENT] =
     g_signal_new (I_("focus-in-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, focus_in_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1762,7 +1794,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::focus-out-event
+   * GtkWidget::focus-out-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventFocus): the #GdkEventFocus which triggered this
    *   signal.
@@ -1778,7 +1810,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[FOCUS_OUT_EVENT] =
     g_signal_new (I_("focus-out-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, focus_out_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1787,7 +1819,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::map-event
+   * GtkWidget::map-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventAny): the #GdkEventAny which triggered this signal.
    *
@@ -1803,7 +1835,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[MAP_EVENT] =
     g_signal_new (I_("map-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, map_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1812,7 +1844,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::unmap-event
+   * GtkWidget::unmap-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventAny): the #GdkEventAny which triggered this signal
    *
@@ -1832,7 +1864,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[UNMAP_EVENT] =
     g_signal_new (I_("unmap-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, unmap_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1841,7 +1873,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::property-notify-event
+   * GtkWidget::property-notify-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventProperty): the #GdkEventProperty which triggered
    *   this signal.
@@ -1857,7 +1889,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[PROPERTY_NOTIFY_EVENT] =
     g_signal_new (I_("property-notify-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, property_notify_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1866,7 +1898,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::selection-clear-event
+   * GtkWidget::selection-clear-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventSelection): the #GdkEventSelection which triggered
    *   this signal.
@@ -1879,7 +1911,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SELECTION_CLEAR_EVENT] =
     g_signal_new (I_("selection-clear-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, selection_clear_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1888,7 +1920,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::selection-request-event
+   * GtkWidget::selection-request-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventSelection): the #GdkEventSelection which triggered
    *   this signal.
@@ -1902,7 +1934,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SELECTION_REQUEST_EVENT] =
     g_signal_new (I_("selection-request-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, selection_request_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1919,7 +1951,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SELECTION_NOTIFY_EVENT] =
     g_signal_new (I_("selection-notify-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, selection_notify_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1935,7 +1967,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SELECTION_RECEIVED] =
     g_signal_new (I_("selection-received"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, selection_received),
 		  NULL, NULL,
@@ -1953,7 +1985,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SELECTION_GET] =
     g_signal_new (I_("selection-get"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, selection_get),
 		  NULL, NULL,
@@ -1964,7 +1996,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  G_TYPE_UINT);
 
   /**
-   * GtkWidget::proximity-in-event
+   * GtkWidget::proximity-in-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventProximity): the #GdkEventProximity which triggered
    *   this signal.
@@ -1979,7 +2011,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[PROXIMITY_IN_EVENT] =
     g_signal_new (I_("proximity-in-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, proximity_in_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -1988,7 +2020,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
-   * GtkWidget::proximity-out-event
+   * GtkWidget::proximity-out-event:
    * @widget: the object which received the signal
    * @event: (type Gdk.EventProximity): the #GdkEventProximity which triggered
    *   this signal.
@@ -2003,7 +2035,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[PROXIMITY_OUT_EVENT] =
     g_signal_new (I_("proximity-out-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, proximity_out_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2024,7 +2056,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_LEAVE] =
     g_signal_new (I_("drag-leave"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_leave),
 		  NULL, NULL,
@@ -2048,7 +2080,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_BEGIN] =
     g_signal_new (I_("drag-begin"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_begin),
 		  NULL, NULL,
@@ -2067,7 +2099,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_END] =
     g_signal_new (I_("drag-end"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_end),
 		  NULL, NULL,
@@ -2087,7 +2119,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_DATA_DELETE] =
     g_signal_new (I_("drag-data-delete"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_data_delete),
 		  NULL, NULL,
@@ -2113,7 +2145,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_FAILED] =
     g_signal_new (I_("drag-failed"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  0, _gtk_boolean_handled_accumulator, NULL,
 		  _gtk_marshal_BOOLEAN__OBJECT_ENUM,
@@ -2216,7 +2248,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_MOTION] =
     g_signal_new (I_("drag-motion"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_motion),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2249,7 +2281,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_DROP] =
     g_signal_new (I_("drag-drop"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_drop),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2277,7 +2309,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_DATA_GET] =
     g_signal_new (I_("drag-data-get"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_data_get),
 		  NULL, NULL,
@@ -2354,7 +2386,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DRAG_DATA_RECEIVED] =
     g_signal_new (I_("drag-data-received"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, drag_data_received),
 		  NULL, NULL,
@@ -2384,7 +2416,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[VISIBILITY_NOTIFY_EVENT] =
     g_signal_new (I_("visibility-notify-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, visibility_notify_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2407,7 +2439,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[CLIENT_EVENT] =
     g_signal_new (I_("client-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, client_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2431,7 +2463,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[NO_EXPOSE_EVENT] =
     g_signal_new (I_("no-expose-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, no_expose_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2457,7 +2489,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[WINDOW_STATE_EVENT] =
     g_signal_new (I_("window-state-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, window_state_event),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2481,13 +2513,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[DAMAGE_EVENT] =
     g_signal_new (I_("damage-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
                   0,
 		  _gtk_boolean_handled_accumulator, NULL,
 		  _gtk_marshal_BOOLEAN__BOXED,
 		  G_TYPE_BOOLEAN, 1,
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
 /**
    * GtkWidget::grab-broken-event:
    * @widget: the object which received the signal
@@ -2507,13 +2540,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[GRAB_BROKEN] =
     g_signal_new (I_("grab-broken-event"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, grab_broken_event),
 		  _gtk_boolean_handled_accumulator, NULL,
 		  _gtk_marshal_BOOLEAN__BOXED,
 		  G_TYPE_BOOLEAN, 1,
 		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
   /**
    * GtkWidget::query-tooltip:
    * @widget: the object which received the signal
@@ -2543,7 +2577,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[QUERY_TOOLTIP] =
     g_signal_new (I_("query-tooltip"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, query_tooltip),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2569,7 +2603,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[POPUP_MENU] =
     g_signal_new (I_("popup-menu"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
 		  G_STRUCT_OFFSET (GtkWidgetClass, popup_menu),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2583,7 +2617,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SHOW_HELP] =
     g_signal_new (I_("show-help"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
 		  G_STRUCT_OFFSET (GtkWidgetClass, show_help),
 		  _gtk_boolean_handled_accumulator, NULL,
@@ -2597,7 +2631,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[ACCEL_CLOSURES_CHANGED] =
     g_signal_new (I_("accel-closures-changed"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  0,
 		  0,
 		  NULL, NULL,
@@ -2615,7 +2649,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[SCREEN_CHANGED] =
     g_signal_new (I_("screen-changed"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, screen_changed),
 		  NULL, NULL,
@@ -2638,7 +2672,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    */
   widget_signals[CAN_ACTIVATE_ACCEL] =
      g_signal_new (I_("can-activate-accel"),
-		  G_TYPE_FROM_CLASS (gobject_class),
+		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, can_activate_accel),
                   _gtk_boolean_handled_accumulator, NULL,
@@ -3058,7 +3092,7 @@ gtk_widget_get_property (GObject         *object,
       g_value_set_boolean (value, (gtk_widget_get_receives_default (widget) != FALSE));
       break;
     case PROP_COMPOSITE_CHILD:
-      g_value_set_boolean (value, (GTK_OBJECT_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0 );
+      g_value_set_boolean (value, widget->priv->composite_child);
       break;
     case PROP_STYLE:
       g_value_set_object (value, gtk_widget_get_style (widget));
@@ -3147,7 +3181,7 @@ gtk_widget_init (GtkWidget *widget)
                                               GtkWidgetPrivate);
   priv = widget->priv;
 
-  GTK_PRIVATE_FLAGS (widget) = PRIVATE_GTK_CHILD_VISIBLE;
+  priv->child_visible = TRUE;
   priv->state = GTK_STATE_NORMAL;
   priv->saved_state = GTK_STATE_NORMAL;
   priv->name = NULL;
@@ -3158,15 +3192,14 @@ gtk_widget_init (GtkWidget *widget)
   priv->window = NULL;
   priv->parent = NULL;
 
-  GTK_OBJECT_FLAGS (widget) |= GTK_SENSITIVE;
-  GTK_OBJECT_FLAGS (widget) |= GTK_PARENT_SENSITIVE;
-  GTK_OBJECT_FLAGS (widget) |= composite_child_stack ? GTK_COMPOSITE_CHILD : 0;
-  gtk_widget_set_double_buffered (widget, TRUE);
-
-  GTK_PRIVATE_SET_FLAG (widget, GTK_REDRAW_ON_ALLOC);
-  GTK_PRIVATE_SET_FLAG (widget, GTK_WIDTH_REQUEST_NEEDED);
-  GTK_PRIVATE_SET_FLAG (widget, GTK_HEIGHT_REQUEST_NEEDED);
-  GTK_PRIVATE_SET_FLAG (widget, GTK_ALLOC_NEEDED);
+  priv->sensitive = TRUE;
+  priv->parent_sensitive = TRUE;
+  priv->composite_child = composite_child_stack != 0;
+  priv->double_buffered = TRUE;
+  priv->redraw_on_alloc = TRUE;
+  priv->width_request_needed = TRUE;
+  priv->height_request_needed = TRUE;
+  priv->alloc_needed = TRUE;
 
   priv->style = gtk_widget_get_default_style ();
   g_object_ref (priv->style);
@@ -3369,7 +3402,7 @@ gtk_widget_unparent (GtkWidget *widget)
   /* If we are unanchoring the child, we save around the toplevel
    * to emit hierarchy changed
    */
-  if (GTK_WIDGET_ANCHORED (priv->parent))
+  if (priv->parent->priv->anchored)
     g_object_ref (toplevel);
   else
     toplevel = NULL;
@@ -3386,7 +3419,7 @@ gtk_widget_unparent (GtkWidget *widget)
   
   if (gtk_widget_get_realized (widget))
     {
-      if (GTK_WIDGET_IN_REPARENT (widget))
+      if (priv->in_reparent)
 	gtk_widget_unmap (widget);
       else
 	gtk_widget_unrealize (widget);
@@ -3396,7 +3429,7 @@ gtk_widget_unparent (GtkWidget *widget)
    * flag to the default state, so it doesn't affect the child
    * in the next parent.
    */
-  GTK_PRIVATE_SET_FLAG (widget, GTK_CHILD_VISIBLE);
+  priv->child_visible = TRUE;
     
   old_parent = priv->parent;
   priv->parent = NULL;
@@ -3509,11 +3542,11 @@ gtk_widget_real_show (GtkWidget *widget)
 
   if (!gtk_widget_get_visible (widget))
     {
-      GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+      priv->visible = TRUE;
 
       if (priv->parent &&
 	  gtk_widget_get_mapped (priv->parent) &&
-	  GTK_WIDGET_CHILD_VISIBLE (widget) &&
+          gtk_widget_get_child_visible (widget) &&
 	  !gtk_widget_get_mapped (widget))
 	gtk_widget_map (widget);
     }
@@ -3595,7 +3628,7 @@ gtk_widget_real_hide (GtkWidget *widget)
 {
   if (gtk_widget_get_visible (widget))
     {
-      GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+      widget->priv->visible = FALSE;
       
       if (gtk_widget_get_mapped (widget))
 	gtk_widget_unmap (widget);
@@ -3685,7 +3718,7 @@ gtk_widget_map (GtkWidget *widget)
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
   g_return_if_fail (gtk_widget_get_visible (widget));
-  g_return_if_fail (GTK_WIDGET_CHILD_VISIBLE (widget));
+  g_return_if_fail (gtk_widget_get_child_visible (widget));
 
   priv = widget->priv;
 
@@ -3828,7 +3861,7 @@ gtk_widget_realize (GtkWidget *widget)
   GtkWidgetShapeInfo *shape_info;
   
   g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (GTK_WIDGET_ANCHORED (widget) ||
+  g_return_if_fail (widget->priv->anchored ||
 		    GTK_IS_INVISIBLE (widget));
 
   priv = widget->priv;
@@ -3857,7 +3890,7 @@ gtk_widget_realize (GtkWidget *widget)
 				       GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (widget), quark_has_tooltip)),
 				       TRUE);
 
-      if (GTK_WIDGET_HAS_SHAPE_MASK (widget))
+      if (priv->has_shape_mask)
 	{
 	  shape_info = g_object_get_qdata (G_OBJECT (widget), quark_shape_info);
 	  gdk_window_shape_combine_mask (priv->window,
@@ -3877,7 +3910,7 @@ gtk_widget_realize (GtkWidget *widget)
       if (mode != GDK_EXTENSION_EVENTS_NONE)
         gtk_widget_set_extension_events_internal (widget, mode, NULL);
 
-      if ((GTK_WIDGET_FLAGS (widget) & GTK_MULTIDEVICE) != 0)
+      if (priv->multidevice)
         gdk_window_set_support_multidevice (priv->window, TRUE);
 
       _gtk_widget_enable_device_events (widget);
@@ -3897,7 +3930,7 @@ gtk_widget_unrealize (GtkWidget *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (GTK_WIDGET_HAS_SHAPE_MASK (widget))
+  if (widget->priv->has_shape_mask)
     gtk_widget_shape_combine_mask (widget, NULL, 0, 0);
 
   if (g_object_get_qdata (G_OBJECT (widget), quark_input_shape_info))
@@ -4250,10 +4283,10 @@ gtk_widget_size_allocate (GtkWidget	*widget,
     }
 #endif /* G_ENABLE_DEBUG */
  
-  alloc_needed = GTK_WIDGET_ALLOC_NEEDED (widget);
-  if (!GTK_WIDGET_WIDTH_REQUEST_NEEDED (widget) &&
-      !GTK_WIDGET_HEIGHT_REQUEST_NEEDED (widget))      /* Preserve request/allocate ordering */
-    GTK_PRIVATE_UNSET_FLAG (widget, GTK_ALLOC_NEEDED);
+  alloc_needed = priv->alloc_needed;
+  if (!priv->width_request_needed && !priv->height_request_needed)
+    /* Preserve request/allocate ordering */
+    priv->alloc_needed = FALSE;
 
   old_allocation = priv->allocation;
   real_allocation = *allocation;
@@ -4301,7 +4334,7 @@ gtk_widget_size_allocate (GtkWidget	*widget,
 
   if (gtk_widget_get_mapped (widget))
     {
-      if (!gtk_widget_get_has_window (widget) && GTK_WIDGET_REDRAW_ON_ALLOC (widget) && position_changed)
+      if (!gtk_widget_get_has_window (widget) && priv->redraw_on_alloc && position_changed)
 	{
 	  /* Invalidate union(old_allaction,priv->allocation) in priv->window
 	   */
@@ -4314,7 +4347,7 @@ gtk_widget_size_allocate (GtkWidget	*widget,
       
       if (size_changed)
 	{
-	  if (GTK_WIDGET_REDRAW_ON_ALLOC (widget))
+	  if (priv->redraw_on_alloc)
 	    {
 	      /* Invalidate union(old_allaction,priv->allocation) in priv->window and descendents owned by widget
 	       */
@@ -5048,14 +5081,14 @@ static gboolean
 gtk_widget_real_key_press_event (GtkWidget         *widget,
 				 GdkEventKey       *event)
 {
-  return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
+  return gtk_bindings_activate_event (G_OBJECT (widget), event);
 }
 
 static gboolean
 gtk_widget_real_key_release_event (GtkWidget         *widget,
 				   GdkEventKey       *event)
 {
-  return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
+  return gtk_bindings_activate_event (G_OBJECT (widget), event);
 }
 
 static gboolean
@@ -5507,16 +5540,16 @@ gtk_widget_reparent (GtkWidget *widget,
        * that gtk_widget_unparent doesn't unrealize widget
        */
       if (gtk_widget_get_realized (widget) && gtk_widget_get_realized (new_parent))
-	GTK_PRIVATE_SET_FLAG (widget, GTK_IN_REPARENT);
+	priv->in_reparent = TRUE;
       
       g_object_ref (widget);
       gtk_container_remove (GTK_CONTAINER (priv->parent), widget);
       gtk_container_add (GTK_CONTAINER (new_parent), widget);
       g_object_unref (widget);
       
-      if (GTK_WIDGET_IN_REPARENT (widget))
+      if (priv->in_reparent)
 	{
-	  GTK_PRIVATE_UNSET_FLAG (widget, GTK_IN_REPARENT);
+          priv->in_reparent = FALSE;
 
 	  gtk_widget_reparent_subwindows (widget, gtk_widget_get_parent_window (widget));
 	  gtk_widget_reparent_fixup_child (widget,
@@ -5844,12 +5877,9 @@ gtk_widget_set_can_focus (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (can_focus != gtk_widget_get_can_focus (widget))
+  if (widget->priv->can_focus != can_focus)
     {
-      if (can_focus)
-        GTK_OBJECT_FLAGS (widget) |= GTK_CAN_FOCUS;
-      else
-        GTK_OBJECT_FLAGS (widget) &= ~(GTK_CAN_FOCUS);
+      widget->priv->can_focus = can_focus;
 
       gtk_widget_queue_resize (widget);
       g_object_notify (G_OBJECT (widget), "can-focus");
@@ -5872,7 +5902,7 @@ gtk_widget_get_can_focus (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_CAN_FOCUS) != 0;
+  return widget->priv->can_focus;
 }
 
 /**
@@ -5892,7 +5922,7 @@ gtk_widget_has_focus (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_FOCUS) != 0;
+  return widget->priv->has_focus;
 }
 
 /**
@@ -5938,12 +5968,9 @@ gtk_widget_set_can_default (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (can_default != gtk_widget_get_can_default (widget))
+  if (widget->priv->can_default != can_default)
     {
-      if (can_default)
-        GTK_OBJECT_FLAGS (widget) |= GTK_CAN_DEFAULT;
-      else
-        GTK_OBJECT_FLAGS (widget) &= ~(GTK_CAN_DEFAULT);
+      widget->priv->can_default = can_default;
 
       gtk_widget_queue_resize (widget);
       g_object_notify (G_OBJECT (widget), "can-default");
@@ -5966,7 +5993,7 @@ gtk_widget_get_can_default (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_CAN_DEFAULT) != 0;
+  return widget->priv->can_default;
 }
 
 /**
@@ -5986,17 +6013,14 @@ gtk_widget_has_default (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_DEFAULT) != 0;
+  return widget->priv->has_default;
 }
 
 void
 _gtk_widget_set_has_default (GtkWidget *widget,
                              gboolean   has_default)
 {
-  if (has_default)
-    GTK_OBJECT_FLAGS (widget) |= GTK_HAS_DEFAULT;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_HAS_DEFAULT);
+  widget->priv->has_default = has_default;
 }
 
 /**
@@ -6049,12 +6073,9 @@ gtk_widget_set_receives_default (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (receives_default != gtk_widget_get_receives_default (widget))
+  if (widget->priv->receives_default != receives_default)
     {
-      if (receives_default)
-        GTK_OBJECT_FLAGS (widget) |= GTK_RECEIVES_DEFAULT;
-      else
-        GTK_OBJECT_FLAGS (widget) &= ~(GTK_RECEIVES_DEFAULT);
+      widget->priv->receives_default = receives_default;
 
       g_object_notify (G_OBJECT (widget), "receives-default");
     }
@@ -6080,7 +6101,7 @@ gtk_widget_get_receives_default (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_RECEIVES_DEFAULT) != 0;
+  return widget->priv->receives_default;
 }
 
 /**
@@ -6101,17 +6122,14 @@ gtk_widget_has_grab (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_GRAB) != 0;
+  return widget->priv->has_grab;
 }
 
 void
 _gtk_widget_set_has_grab (GtkWidget *widget,
                           gboolean   has_grab)
 {
-  if (has_grab)
-    GTK_OBJECT_FLAGS (widget) |= GTK_HAS_GRAB;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_HAS_GRAB);
+  widget->priv->has_grab = has_grab;
 }
 
 /**
@@ -6194,7 +6212,7 @@ gtk_widget_set_name (GtkWidget	 *widget,
   g_free (priv->name);
   priv->name = new_name;
 
-  if (gtk_widget_has_rc_style (widget))
+  if (priv->rc_style)
     gtk_widget_reset_rc_style (widget);
 
   g_object_notify (G_OBJECT (widget), "name");
@@ -6315,6 +6333,13 @@ gtk_widget_set_visible (GtkWidget *widget,
     }
 }
 
+void
+_gtk_widget_set_visible_flag (GtkWidget *widget,
+                              gboolean   visible)
+{
+  widget->priv->visible = visible;
+}
+
 /**
  * gtk_widget_get_visible:
  * @widget: a #GtkWidget
@@ -6334,7 +6359,7 @@ gtk_widget_get_visible (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_VISIBLE) != 0;
+  return widget->priv->visible;
 }
 
 /**
@@ -6361,10 +6386,7 @@ gtk_widget_set_has_window (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (has_window)
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_NO_WINDOW);
-  else
-    GTK_OBJECT_FLAGS (widget) |= GTK_NO_WINDOW;
+  widget->priv->no_window = !has_window;
 }
 
 /**
@@ -6383,7 +6405,7 @@ gtk_widget_get_has_window (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return !((GTK_OBJECT_FLAGS (widget) & GTK_NO_WINDOW) != 0);
+  return ! widget->priv->no_window;
 }
 
 /**
@@ -6403,17 +6425,14 @@ gtk_widget_is_toplevel (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_TOPLEVEL) != 0;
+  return widget->priv->toplevel;
 }
 
 void
 _gtk_widget_set_is_toplevel (GtkWidget *widget,
                              gboolean   is_toplevel)
 {
-  if (is_toplevel)
-    GTK_OBJECT_FLAGS (widget) |= GTK_TOPLEVEL;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_TOPLEVEL);
+  widget->priv->toplevel = is_toplevel;
 }
 
 /**
@@ -6451,7 +6470,7 @@ gtk_widget_get_realized (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_REALIZED) != 0;
+  return widget->priv->realized;
 }
 
 /**
@@ -6472,10 +6491,7 @@ gtk_widget_set_realized (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (realized)
-    GTK_OBJECT_FLAGS (widget) |= GTK_REALIZED;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_REALIZED);
+  widget->priv->realized = realized;
 }
 
 /**
@@ -6493,7 +6509,7 @@ gtk_widget_get_mapped (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_MAPPED) != 0;
+  return widget->priv->mapped;
 }
 
 /**
@@ -6514,10 +6530,7 @@ gtk_widget_set_mapped (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (mapped)
-    GTK_OBJECT_FLAGS (widget) |= GTK_MAPPED;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_MAPPED);
+  widget->priv->mapped = mapped;
 }
 
 /**
@@ -6552,12 +6565,9 @@ gtk_widget_set_app_paintable (GtkWidget *widget,
 
   app_paintable = (app_paintable != FALSE);
 
-  if (gtk_widget_get_app_paintable (widget) != app_paintable)
+  if (widget->priv->app_paintable != app_paintable)
     {
-      if (app_paintable)
-        GTK_OBJECT_FLAGS (widget) |= GTK_APP_PAINTABLE;
-      else
-        GTK_OBJECT_FLAGS (widget) &= ~(GTK_APP_PAINTABLE);
+      widget->priv->app_paintable = app_paintable;
 
       if (gtk_widget_is_drawable (widget))
 	gtk_widget_queue_draw (widget);
@@ -6584,7 +6594,7 @@ gtk_widget_get_app_paintable (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_APP_PAINTABLE) != 0;
+  return widget->priv->app_paintable;
 }
 
 /**
@@ -6619,12 +6629,9 @@ gtk_widget_set_double_buffered (GtkWidget *widget,
 
   double_buffered = (double_buffered != FALSE);
 
-  if (double_buffered != gtk_widget_get_double_buffered (widget))
+  if (widget->priv->double_buffered != double_buffered)
     {
-      if (double_buffered)
-        GTK_OBJECT_FLAGS (widget) |= GTK_DOUBLE_BUFFERED;
-      else
-        GTK_OBJECT_FLAGS (widget) &= ~(GTK_DOUBLE_BUFFERED);
+      widget->priv->double_buffered = double_buffered;
 
       g_object_notify (G_OBJECT (widget), "double-buffered");
     }
@@ -6647,7 +6654,7 @@ gtk_widget_get_double_buffered (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_DOUBLE_BUFFERED) != 0;
+  return widget->priv->double_buffered;
 }
 
 /**
@@ -6678,10 +6685,7 @@ gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (redraw_on_allocate)
-    GTK_PRIVATE_SET_FLAG (widget, GTK_REDRAW_ON_ALLOC);
-  else
-    GTK_PRIVATE_UNSET_FLAG (widget, GTK_REDRAW_ON_ALLOC);
+  widget->priv->redraw_on_alloc = redraw_on_allocate;
 }
 
 /**
@@ -6707,24 +6711,24 @@ gtk_widget_set_sensitive (GtkWidget *widget,
 
   sensitive = (sensitive != FALSE);
 
-  if (sensitive == (gtk_widget_get_sensitive (widget) != FALSE))
+  if (widget->priv->sensitive == sensitive)
     return;
 
   if (sensitive)
     {
-      GTK_OBJECT_FLAGS (widget) |= GTK_SENSITIVE;
+      widget->priv->sensitive = TRUE;
       data.state = priv->saved_state;
     }
   else
     {
-      GTK_OBJECT_FLAGS (widget) &= ~(GTK_SENSITIVE);
+      widget->priv->sensitive = FALSE;
       data.state = gtk_widget_get_state (widget);
     }
   data.state_restoration = TRUE;
   data.use_forall = TRUE;
 
   if (priv->parent)
-    data.parent_sensitive = (gtk_widget_is_sensitive (priv->parent) != FALSE);
+    data.parent_sensitive = gtk_widget_is_sensitive (priv->parent);
   else
     data.parent_sensitive = TRUE;
 
@@ -6754,7 +6758,7 @@ gtk_widget_get_sensitive (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_SENSITIVE) != 0;
+  return widget->priv->sensitive;
 }
 
 /**
@@ -6773,8 +6777,7 @@ gtk_widget_is_sensitive (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (gtk_widget_get_sensitive (widget) &&
-          (GTK_OBJECT_FLAGS (widget) & GTK_PARENT_SENSITIVE) != 0);
+  return widget->priv->sensitive && widget->priv->parent_sensitive;
 }
 
 /**
@@ -6832,7 +6835,7 @@ gtk_widget_set_parent (GtkWidget *widget,
   gtk_widget_reset_rc_styles (widget);
 
   g_signal_emit (widget, widget_signals[PARENT_SET], 0, NULL);
-  if (GTK_WIDGET_ANCHORED (priv->parent))
+  if (priv->parent->priv->anchored)
     _gtk_widget_propagate_hierarchy_changed (widget, NULL);
   g_object_notify (G_OBJECT (widget), "parent");
 
@@ -6844,7 +6847,7 @@ gtk_widget_set_parent (GtkWidget *widget,
   if (gtk_widget_get_visible (priv->parent) &&
       gtk_widget_get_visible (widget))
     {
-      if (GTK_WIDGET_CHILD_VISIBLE (widget) &&
+      if (gtk_widget_get_child_visible (widget) &&
 	  gtk_widget_get_mapped (priv->parent))
 	gtk_widget_map (widget);
 
@@ -6920,7 +6923,7 @@ gtk_widget_has_rc_style (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_OBJECT_FLAGS (widget) & GTK_RC_STYLE) != 0;
+  return widget->priv->rc_style;
 }
 
 /**
@@ -6944,16 +6947,16 @@ gtk_widget_set_style (GtkWidget *widget,
     {
       gboolean initial_emission;
 
-      initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
+      initial_emission = !widget->priv->rc_style && !widget->priv->user_style;
       
-      GTK_OBJECT_FLAGS (widget) &= ~(GTK_RC_STYLE);
-      GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
+      widget->priv->rc_style = FALSE;
+      widget->priv->user_style = TRUE;
       
       gtk_widget_set_style_internal (widget, style, initial_emission);
     }
   else
     {
-      if (GTK_WIDGET_USER_STYLE (widget))
+      if (widget->priv->user_style)
 	gtk_widget_reset_rc_style (widget);
     }
 }
@@ -6972,8 +6975,7 @@ gtk_widget_ensure_style (GtkWidget *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (!GTK_WIDGET_USER_STYLE (widget) &&
-      !gtk_widget_has_rc_style (widget))
+  if (!widget->priv->rc_style && !widget->priv->user_style)
     gtk_widget_reset_rc_style (widget);
 }
 
@@ -6986,12 +6988,12 @@ gtk_widget_reset_rc_style (GtkWidget *widget)
   GtkWidgetPrivate *priv = widget->priv;
   GtkStyle *new_style = NULL;
   gboolean initial_emission;
-  
-  initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
 
-  GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
-  GTK_OBJECT_FLAGS (widget) |= GTK_RC_STYLE;
-  
+  initial_emission = !priv->rc_style && !priv->user_style;
+
+  priv->user_style = FALSE;
+  priv->rc_style = TRUE;
+
   if (gtk_widget_has_screen (widget))
     new_style = gtk_rc_get_style (widget);
   if (!new_style)
@@ -7056,7 +7058,7 @@ gtk_widget_modify_style (GtkWidget      *widget,
    * modifier style and the only reference was our own.
    */
   
-  if (gtk_widget_has_rc_style (widget))
+  if (widget->priv->rc_style)
     gtk_widget_reset_rc_style (widget);
 }
 
@@ -7422,7 +7424,7 @@ gtk_widget_set_style_internal (GtkWidget *widget,
 		     initial_emission ? NULL : previous_style);
       g_object_unref (previous_style);
 
-      if (GTK_WIDGET_ANCHORED (widget) && !initial_emission)
+      if (priv->anchored && !initial_emission)
 	gtk_widget_queue_resize (widget);
     }
   else if (initial_emission)
@@ -7470,16 +7472,13 @@ gtk_widget_propagate_hierarchy_changed_recurse (GtkWidget *widget,
   GtkWidgetPrivate *priv = widget->priv;
   HierarchyChangedInfo *info = client_data;
   gboolean new_anchored = gtk_widget_is_toplevel (widget) ||
-                 (priv->parent && GTK_WIDGET_ANCHORED (priv->parent));
+                 (priv->parent && priv->parent->priv->anchored);
 
-  if (GTK_WIDGET_ANCHORED (widget) != new_anchored)
+  if (priv->anchored != new_anchored)
     {
       g_object_ref (widget);
-      
-      if (new_anchored)
-	GTK_PRIVATE_SET_FLAG (widget, GTK_ANCHORED);
-      else
-	GTK_PRIVATE_UNSET_FLAG (widget, GTK_ANCHORED);
+
+      priv->anchored = new_anchored;
       
       g_signal_emit (widget, widget_signals[HIERARCHY_CHANGED], 0, info->previous_toplevel);
       do_screen_change (widget, info->previous_screen, info->new_screen);
@@ -7503,8 +7502,8 @@ gtk_widget_propagate_hierarchy_changed_recurse (GtkWidget *widget,
  * emitting #GtkWidget::hierarchy-changed.
  **/
 void
-_gtk_widget_propagate_hierarchy_changed (GtkWidget    *widget,
-					 GtkWidget    *previous_toplevel)
+_gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
+					 GtkWidget *previous_toplevel)
 {
   GtkWidgetPrivate *priv = widget->priv;
   HierarchyChangedInfo info;
@@ -7513,7 +7512,7 @@ _gtk_widget_propagate_hierarchy_changed (GtkWidget    *widget,
   info.previous_screen = previous_toplevel ? gtk_widget_get_screen (previous_toplevel) : NULL;
 
   if (gtk_widget_is_toplevel (widget) ||
-      (priv->parent && GTK_WIDGET_ANCHORED (priv->parent)))
+      (priv->parent && priv->parent->priv->anchored))
     info.new_screen = gtk_widget_get_screen (widget);
   else
     info.new_screen = NULL;
@@ -7627,7 +7626,7 @@ _gtk_widget_propagate_screen_changed (GtkWidget    *widget,
 static void
 reset_rc_styles_recurse (GtkWidget *widget, gpointer data)
 {
-  if (gtk_widget_has_rc_style (widget))
+  if (widget->priv->rc_style)
     gtk_widget_reset_rc_style (widget);
   
   if (GTK_IS_CONTAINER (widget))
@@ -7971,12 +7970,12 @@ gtk_widget_set_child_visible (GtkWidget *widget,
   g_object_ref (widget);
 
   if (is_visible)
-    GTK_PRIVATE_SET_FLAG (widget, GTK_CHILD_VISIBLE);
+    priv->child_visible = TRUE;
   else
     {
       GtkWidget *toplevel;
-      
-      GTK_PRIVATE_UNSET_FLAG (widget, GTK_CHILD_VISIBLE);
+
+      priv->child_visible = FALSE;
 
       toplevel = gtk_widget_get_toplevel (widget);
       if (toplevel != widget && gtk_widget_is_toplevel (toplevel))
@@ -7986,7 +7985,7 @@ gtk_widget_set_child_visible (GtkWidget *widget,
   if (priv->parent && gtk_widget_get_realized (priv->parent))
     {
       if (gtk_widget_get_mapped (priv->parent) &&
-	  GTK_WIDGET_CHILD_VISIBLE (widget) &&
+	  priv->child_visible &&
 	  gtk_widget_get_visible (widget))
 	gtk_widget_map (widget);
       else
@@ -8014,7 +8013,7 @@ gtk_widget_get_child_visible (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   
-  return GTK_WIDGET_CHILD_VISIBLE (widget);
+  return widget->priv->child_visible;
 }
 
 static GdkScreen *
@@ -8953,7 +8952,7 @@ gtk_widget_set_composite_name (GtkWidget   *widget,
 			       const gchar *name)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail ((GTK_OBJECT_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0);
+  g_return_if_fail (widget->priv->composite_child);
   g_return_if_fail (name != NULL);
 
   if (!quark_composite_name)
@@ -8984,7 +8983,7 @@ gtk_widget_get_composite_name (GtkWidget *widget)
 
   priv = widget->priv;
 
-  if (((GTK_OBJECT_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0) && priv->parent)
+  if (widget->priv->composite_child && priv->parent)
     return _gtk_container_child_composite_name (GTK_CONTAINER (priv->parent),
 					       widget);
   else
@@ -9142,17 +9141,8 @@ gtk_widget_set_direction (GtkWidget        *widget,
   g_return_if_fail (dir >= GTK_TEXT_DIR_NONE && dir <= GTK_TEXT_DIR_RTL);
 
   old_dir = gtk_widget_get_direction (widget);
-  
-  if (dir == GTK_TEXT_DIR_NONE)
-    GTK_PRIVATE_UNSET_FLAG (widget, GTK_DIRECTION_SET);
-  else
-    {
-      GTK_PRIVATE_SET_FLAG (widget, GTK_DIRECTION_SET);
-      if (dir == GTK_TEXT_DIR_LTR)
-	GTK_PRIVATE_SET_FLAG (widget, GTK_DIRECTION_LTR);
-      else
-	GTK_PRIVATE_UNSET_FLAG (widget, GTK_DIRECTION_LTR);
-    }
+
+  widget->priv->direction = dir;
 
   if (old_dir != gtk_widget_get_direction (widget))
     gtk_widget_emit_direction_changed (widget, old_dir);
@@ -9172,10 +9162,10 @@ gtk_widget_get_direction (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_TEXT_DIR_LTR);
   
-  if (GTK_WIDGET_DIRECTION_SET (widget))
-    return GTK_WIDGET_DIRECTION_LTR (widget) ? GTK_TEXT_DIR_LTR : GTK_TEXT_DIR_RTL;
-  else
+  if (widget->priv->direction == GTK_TEXT_DIR_NONE)
     return gtk_default_direction;
+  else
+    return widget->priv->direction;
 }
 
 static void
@@ -9185,7 +9175,7 @@ gtk_widget_set_default_direction_recurse (GtkWidget *widget, gpointer data)
 
   g_object_ref (widget);
   
-  if (!GTK_WIDGET_DIRECTION_SET (widget))
+  if (widget->priv->direction == GTK_TEXT_DIR_NONE)
     gtk_widget_emit_direction_changed (widget, old_dir);
   
   if (GTK_IS_CONTAINER (widget))
@@ -9256,7 +9246,7 @@ gtk_widget_dispose (GObject *object)
   else if (gtk_widget_get_visible (widget))
     gtk_widget_hide (widget);
 
-  GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+  priv->visible = FALSE;
   if (gtk_widget_get_realized (widget))
     gtk_widget_unrealize (widget);
 
@@ -9271,7 +9261,7 @@ gtk_widget_dispose (GObject *object)
 }
 
 static void
-gtk_widget_real_destroy (GtkObject *object)
+gtk_widget_real_destroy (GtkWidget *object)
 {
   /* gtk_object_destroy() will already hold a refcount on object */
   GtkWidget *widget = GTK_WIDGET (object);
@@ -9283,7 +9273,7 @@ gtk_widget_real_destroy (GtkObject *object)
 
   /* Callers of add_mnemonic_label() should disconnect on ::destroy */
   g_object_set_qdata (G_OBJECT (widget), quark_mnemonic_labels, NULL);
-  
+
   gtk_grab_remove (widget);
 
   g_object_unref (priv->style);
@@ -9898,10 +9888,7 @@ gtk_widget_propagate_state (GtkWidget           *widget,
    */
 
 
-  if (data->parent_sensitive)
-    GTK_OBJECT_FLAGS (widget) |= GTK_PARENT_SENSITIVE;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_PARENT_SENSITIVE);
+  priv->parent_sensitive = data->parent_sensitive;
 
   if (gtk_widget_is_sensitive (widget))
     {
@@ -9941,7 +9928,7 @@ gtk_widget_propagate_state (GtkWidget           *widget,
 
       g_signal_emit (widget, widget_signals[STATE_CHANGED], 0, old_state);
 
-      if (!GTK_WIDGET_SHADOWED (widget))
+      if (!priv->shadowed)
         {
           GList *event_windows = NULL;
           GList *devices, *d;
@@ -10094,7 +10081,7 @@ gtk_widget_shape_combine_mask (GtkWidget *widget,
 
   if (!shape_mask)
     {
-      GTK_PRIVATE_UNSET_FLAG (widget, GTK_HAS_SHAPE_MASK);
+      priv->has_shape_mask = FALSE;
 
       if (priv->window)
 	gdk_window_shape_combine_mask (priv->window, NULL, 0, 0);
@@ -10103,7 +10090,7 @@ gtk_widget_shape_combine_mask (GtkWidget *widget,
     }
   else
     {
-      GTK_PRIVATE_SET_FLAG (widget, GTK_HAS_SHAPE_MASK);
+      priv->has_shape_mask = TRUE;
       
       shape_info = g_slice_new (GtkWidgetShapeInfo);
       g_object_set_qdata_full (G_OBJECT (widget), quark_shape_info, shape_info,
@@ -10210,7 +10197,7 @@ gtk_widget_reset_shapes (GtkWidget *widget)
 
   priv = widget->priv;
 
-  if (!GTK_WIDGET_HAS_SHAPE_MASK (widget))
+  if (!priv->has_shape_mask)
     gtk_reset_shapes_recurse (widget, priv->window);
 }
 
@@ -11917,7 +11904,7 @@ gtk_widget_get_no_show_all (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   
-  return (GTK_OBJECT_FLAGS (widget) & GTK_NO_SHOW_ALL) != 0;
+  return widget->priv->no_show_all;
 }
 
 /**
@@ -11942,15 +11929,12 @@ gtk_widget_set_no_show_all (GtkWidget *widget,
 
   no_show_all = (no_show_all != FALSE);
 
-  if (no_show_all == gtk_widget_get_no_show_all (widget))
-    return;
+  if (widget->priv->no_show_all != no_show_all)
+    {
+      widget->priv->no_show_all = no_show_all;
 
-  if (no_show_all)
-    GTK_OBJECT_FLAGS (widget) |= GTK_NO_SHOW_ALL;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_NO_SHOW_ALL);
-  
-  g_object_notify (G_OBJECT (widget), "no-show-all");
+      g_object_notify (G_OBJECT (widget), "no-show-all");
+    }
 }
 
 
@@ -12400,7 +12384,7 @@ gtk_widget_get_support_multidevice (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return GTK_WIDGET_FLAGS (widget) & GTK_MULTIDEVICE;
+  return widget->priv->multidevice;
 }
 
 /**
@@ -12427,12 +12411,12 @@ gtk_widget_set_support_multidevice (GtkWidget *widget,
 
   if (support_multidevice)
     {
-      GTK_WIDGET_SET_FLAGS (widget, GTK_MULTIDEVICE);
+      priv->multidevice = TRUE;
       gtk_widget_set_extension_events (widget, GDK_EXTENSION_EVENTS_ALL);
     }
   else
     {
-      GTK_WIDGET_UNSET_FLAGS (widget, GTK_MULTIDEVICE);
+      priv->multidevice = FALSE;
       gtk_widget_set_extension_events (widget, GDK_EXTENSION_EVENTS_NONE);
     }
 
@@ -12444,10 +12428,7 @@ static void
 _gtk_widget_set_has_focus (GtkWidget *widget,
                            gboolean   has_focus)
 {
-  if (has_focus)
-    GTK_OBJECT_FLAGS (widget) |= GTK_HAS_FOCUS;
-  else
-    GTK_OBJECT_FLAGS (widget) &= ~(GTK_HAS_FOCUS);
+  widget->priv->has_focus = has_focus;
 }
 
 /**
@@ -12505,3 +12486,99 @@ gtk_widget_send_focus_change (GtkWidget *widget,
 
   return res;
 }
+
+gboolean
+gtk_widget_in_destruction (GtkWidget *widget)
+{
+  return widget->priv->in_destruction;
+}
+
+_gtk_widget_get_resize_pending (GtkWidget *widget)
+{
+  return widget->priv->resize_pending;
+}
+
+void
+_gtk_widget_set_resize_pending (GtkWidget *widget,
+                                gboolean   resize_pending)
+{
+  widget->priv->resize_pending = resize_pending;
+}
+
+gboolean
+_gtk_widget_get_in_reparent (GtkWidget *widget)
+{
+  return widget->priv->in_reparent;
+}
+
+void
+_gtk_widget_set_in_reparent (GtkWidget *widget,
+                             gboolean   in_reparent)
+{
+  widget->priv->in_reparent = in_reparent;
+}
+
+gboolean
+_gtk_widget_get_anchored (GtkWidget *widget)
+{
+  return widget->priv->anchored;
+}
+
+void
+_gtk_widget_set_anchored (GtkWidget *widget,
+                          gboolean   anchored)
+{
+  widget->priv->anchored = anchored;
+}
+
+gboolean
+_gtk_widget_get_shadowed (GtkWidget *widget)
+{
+  return widget->priv->shadowed;
+}
+
+void
+_gtk_widget_set_shadowed (GtkWidget *widget,
+                          gboolean   shadowed)
+{
+  widget->priv->shadowed = shadowed;
+}
+
+gboolean
+_gtk_widget_get_alloc_needed (GtkWidget *widget)
+{
+  return widget->priv->alloc_needed;
+}
+
+void
+_gtk_widget_set_alloc_needed (GtkWidget *widget,
+                              gboolean   alloc_needed)
+{
+  widget->priv->alloc_needed = alloc_needed;
+}
+
+gboolean
+_gtk_widget_get_width_request_needed (GtkWidget *widget)
+{
+  return widget->priv->width_request_needed;
+}
+
+void
+_gtk_widget_set_width_request_needed (GtkWidget *widget,
+                                      gboolean   width_request_needed)
+{
+  widget->priv->width_request_needed = width_request_needed;
+}
+
+gboolean
+_gtk_widget_get_height_request_needed (GtkWidget *widget)
+{
+  return widget->priv->height_request_needed;
+}
+
+void
+_gtk_widget_set_height_request_needed (GtkWidget *widget,
+                                       gboolean   height_request_needed)
+{
+  widget->priv->height_request_needed = height_request_needed;
+}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 052453e..413ca85 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -33,7 +33,6 @@
 
 #include <gdk/gdk.h>
 #include <gtk/gtkaccelgroup.h>
-#include <gtk/gtkobject.h>
 #include <gtk/gtkadjustment.h>
 #include <gtk/gtkstyle.h>
 #include <gtk/gtksettings.h>
@@ -250,16 +249,7 @@ struct _GtkRequisition
  */
 struct _GtkWidget
 {
-  /* The object structure needs to be the first
-   *  element in the widget structure in order for
-   *  the object mechanism to work correctly. This
-   *  allows a GtkWidget pointer to be cast to a
-   *  GtkObject pointer.
-   */
-  GInitiallyUnowned object;
-
-  /* internally used private flags. */
-  guint GSEAL (private_flags) : 16;
+  GInitiallyUnowned parent_instance;
 
   GtkWidgetPrivate *priv;
 };
@@ -269,7 +259,7 @@ struct _GtkWidget
  * @parent_class: The object class structure needs to be the first
  *   element in the widget class structure in order for the class mechanism
  *   to work correctly. This allows a GtkWidgetClass pointer to be cast to
- *   a GtkObjectClass pointer.
+ *   a GObjectClass pointer.
  * @activate_signal: The signal to emit when a widget of this class is
  *   activated, gtk_widget_activate() handles the emission.
  *   Implementation of this signal is optional.
@@ -1009,6 +999,8 @@ void         _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
 						       GtkWidget *toplevel,
 						       gpointer   user_data);
 
+gboolean     gtk_widget_in_destruction (GtkWidget *widget);
+
 G_END_DECLS
 
 #endif /* __GTK_WIDGET_H__ */
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index c1982cc..5daa002 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -983,7 +983,7 @@ gtk_window_init (GtkWindow *window)
   gtk_widget_set_has_window (GTK_WIDGET (window), TRUE);
   _gtk_widget_set_is_toplevel (GTK_WIDGET (window), TRUE);
 
-  GTK_PRIVATE_SET_FLAG (window, GTK_ANCHORED);
+  _gtk_widget_set_anchored (GTK_WIDGET (window), TRUE);
 
   gtk_container_set_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE);
 
@@ -4554,7 +4554,7 @@ gtk_window_show (GtkWidget *widget)
   GtkContainer *container = GTK_CONTAINER (window);
   gboolean need_resize;
 
-  GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+  _gtk_widget_set_visible_flag (widget, TRUE);
 
   need_resize = _gtk_container_get_need_resize (container) || !gtk_widget_get_realized (widget);
   _gtk_container_set_need_resize (container, FALSE);
@@ -4636,7 +4636,7 @@ gtk_window_hide (GtkWidget *widget)
   GtkWindow *window = GTK_WINDOW (widget);
   GtkWindowPrivate *priv = window->priv;
 
-  GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+  _gtk_widget_set_visible_flag (widget, FALSE);
   gtk_widget_unmap (widget);
 
   if (priv->modal)
diff --git a/gtk/gtkwrapbox.c b/gtk/gtkwrapbox.c
index 65afc64..fd8a35b 100644
--- a/gtk/gtkwrapbox.c
+++ b/gtk/gtkwrapbox.c
@@ -37,6 +37,7 @@
 #include "gtkwrapbox.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
+#include "gtktypeutils.h"
 
 
 typedef struct _GtkWrapBoxChild  GtkWrapBoxChild;
diff --git a/gtk/gtkxembed.c b/gtk/gtkxembed.c
index d5ab3bf..05bb517 100644
--- a/gtk/gtkxembed.c
+++ b/gtk/gtkxembed.c
@@ -23,6 +23,7 @@
 #include "gtkmain.h"
 #include "gtkprivate.h"
 #include "gtkxembed.h"
+#include "gtkdebug.h"
 
 
 typedef struct _GtkXEmbedMessage GtkXEmbedMessage;



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