Index: codegen/codegen.py
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/codegen/codegen.py,v
retrieving revision 1.94
diff -u -p -d -r1.94 codegen.py
--- codegen/codegen.py	20 Jun 2005 22:57:41 -0000	1.94
+++ codegen/codegen.py	9 Jul 2005 15:32:36 -0000
@@ -738,11 +738,13 @@ class GObjectWrapper(Wrapper):
         return '0'
 
     def write_property_based_constructor(self, constructor):
+        self.objinfo.has_new_constructor_api = True
         out = self.fp
         print >> out, "static int"
         print >> out, '_wrap_%s(PyGObject *self, PyObject *args,'\
               ' PyObject *kwargs)\n{' % constructor.c_name
-        print >> out, "    GType obj_type = pyg_type_from_object((PyObject *) self);"
+        if constructor.params:
+            print >> out, "    GType obj_type = pyg_type_from_object((PyObject *) self);"
 
         def py_str_list_to_c(arg):
             if arg:
@@ -788,7 +790,7 @@ class GObjectWrapper(Wrapper):
             print >> out, "    if (!pyg_parse_constructor_args(obj_type, arg_names, prop_names,"
             print >> out, "                                    params, &nparams, parsed_args))"
             print >> out, "        return -1;"
-            print >> out, "    self->obj = g_object_newv(obj_type, nparams, params);"
+            print >> out, "    pygobject_constructv(self, nparams, params);\n"
             print >> out, "    for (i = 0; i < nparams; ++i)"
             print >> out, "        g_value_unset(&params[i].value);"
         else:
@@ -802,7 +804,7 @@ class GObjectWrapper(Wrapper):
             print >> out, '    if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":%s.__init__", kwlist))' % classname
             print >> out, "        return -1;"
             print >> out
-            print >> out, "    self->obj = g_object_newv(obj_type, 0, NULL);"
+            print >> out, "    pygobject_constructv(self, 0, NULL);\n"
 
         print >> out, \
               '    if (!self->obj) {\n' \
@@ -814,7 +816,6 @@ class GObjectWrapper(Wrapper):
             print >> out, "    g_object_ref(self->obj);\n"
 
         print >> out, \
-              '    pygobject_register_wrapper((PyObject *)self);\n' \
               '    return 0;\n' \
               '}\n\n' % { 'typename': classname }
         return "_wrap_%s" % constructor.c_name
@@ -1115,6 +1116,8 @@ def write_registers(parser, fp):
             fp.write('    pygobject_register_class(d, "' + obj.c_name +
                      '", ' + obj.typecode + ', &Py' + obj.c_name +
                      '_Type, NULL);\n')
+        if obj.has_new_constructor_api:
+            fp.write('    pyg_set_object_has_new_constructor(%s);\n' % obj.typecode)
         if obj.class_init_func is not None:
             fp.write('    pyg_register_class_init(%s, %s);\n' %
                      (obj.typecode, obj.class_init_func))
Index: codegen/definitions.py
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/codegen/definitions.py,v
retrieving revision 1.19
diff -u -p -d -r1.19 definitions.py
--- codegen/definitions.py	9 Jan 2005 14:49:56 -0000	1.19
+++ codegen/definitions.py	9 Jul 2005 15:32:36 -0000
@@ -69,6 +69,7 @@ class ObjectDef(Definition):
 	self.fields = []
         self.implements = []
         self.class_init_func = None
+        self.has_new_constructor_api = False
 	for arg in get_valid_scheme_definitions(args):
 	    if arg[0] == 'in-module':
 		self.module = arg[1]
Index: gobject/gobjectmodule.c
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gobject/gobjectmodule.c,v
retrieving revision 1.180
diff -u -p -d -r1.180 gobjectmodule.c
--- gobject/gobjectmodule.c	8 Jul 2005 14:27:30 -0000	1.180
+++ gobject/gobjectmodule.c	9 Jul 2005 15:32:41 -0000
@@ -26,6 +26,7 @@
 
 #include "pygobject-private.h"
 #include "pythread.h"
+#include <gobject/gvaluecollector.h>
 
 static PyObject *gerror_exc = NULL;
 static gboolean use_gil_state_api = FALSE;
@@ -40,6 +41,9 @@ GQuark pygboxed_marshal_key;
 GQuark pygenum_class_key;
 GQuark pygflags_class_key;
 GQuark pygpointer_class_key;
+GQuark pygobject_has_updated_constructor_key;
+
+
 
 static void pyg_flags_add_constants(PyObject *module, GType flags_type,
 				    const gchar *strip_prefix);
@@ -1028,6 +1032,56 @@ get_type_name_for_class(PyTypeObject *cl
     return type_name;
 }
 
+
+static GStaticPrivate pygobject_contruction_wrapper = G_STATIC_PRIVATE_INIT;
+
+static inline void
+pygobject_init_wrapper_set(PyObject *wrapper)
+{
+    g_static_private_set(&pygobject_contruction_wrapper, wrapper, NULL);
+}
+
+static inline PyObject *
+pygobject_init_wrapper_get(void)
+{
+    return (PyObject *) g_static_private_get(&pygobject_contruction_wrapper);
+}
+
+static void
+pygobject__g_instance_init(GTypeInstance   *instance,
+                           gpointer         g_class)
+{
+    GObject *object = (GObject *) instance;
+    PyObject *wrapper, *args, *kwargs;
+
+    if (!g_type_get_qdata(G_OBJECT_TYPE(object), pygobject_has_updated_constructor_key))
+        return;
+
+    wrapper = g_object_get_qdata(object, pygobject_wrapper_key); 
+    if (wrapper == NULL) {
+        wrapper = pygobject_init_wrapper_get();
+        if (wrapper) {
+            g_object_set_qdata(object, pygobject_wrapper_key, wrapper);
+        }
+    }
+    pygobject_init_wrapper_set(NULL);
+    if (wrapper == NULL) {
+          /* this looks like a python object created through
+           * g_object_new -> we have no python wrapper, so create it
+           * now */
+        PyGILState_STATE state;
+        state = pyg_gil_state_ensure();
+        wrapper = pygobject_new_full(object, FALSE);
+        args = PyTuple_New(0);
+        kwargs = PyDict_New();
+        if (wrapper->ob_type->tp_init(wrapper, args, kwargs))
+            PyErr_Print();
+        Py_DECREF(args);
+        Py_DECREF(kwargs);
+        pyg_gil_state_release(state);
+    }
+}
+
 int
 pyg_type_register(PyTypeObject *class, char *type_name)
 {
@@ -1036,6 +1090,7 @@ pyg_type_register(PyTypeObject *class, c
     gint i;
     GTypeQuery query;
     gpointer gclass;
+    gpointer has_new_constructor_api;
     GTypeInfo type_info = {
 	0,    /* class_size */
 
@@ -1048,7 +1103,7 @@ pyg_type_register(PyTypeObject *class, c
 
 	0,    /* instance_size */
 	0,    /* n_preallocs */
-	(GInstanceInitFunc) NULL
+	(GInstanceInitFunc) pygobject__g_instance_init
     };
 
 
@@ -1088,6 +1143,16 @@ pyg_type_register(PyTypeObject *class, c
     PyDict_SetItemString(class->tp_dict, "__gtype__", gtype);
     Py_DECREF(gtype);
 
+      /* propagate new constructor API compatility flag from parent to child type */
+    has_new_constructor_api = g_type_get_qdata(parent_type,
+                                               pygobject_has_updated_constructor_key);
+    if (has_new_constructor_api == NULL)
+        g_warning("Constructor wrapper for %s needs to be updated to the new API",
+                  g_type_name(parent_type));
+    else
+        g_type_set_qdata(instance_type, pygobject_has_updated_constructor_key,
+                         has_new_constructor_api);
+
     /* if no __doc__, set it to the auto doc descriptor */
     if (PyDict_GetItemString(class->tp_dict, "__doc__") == NULL) {
 	PyDict_SetItemString(class->tp_dict, "__doc__",
@@ -1572,8 +1637,12 @@ pyg_object_new (PyGObject *self, PyObjec
     g_type_class_unref(class);
     
     if (obj)
-	return pygobject_new ((GObject *)obj);
-    return NULL;
+	self = (PyGObject *) pygobject_new ((GObject *)obj);
+    else
+        self = NULL;
+    g_object_unref(obj);
+
+    return (PyObject *) self;
 }
 
 static gint
@@ -2455,6 +2524,95 @@ pyg_parse_constructor_args(GType        
     return TRUE;
 }
 
+int
+pygobject_constructv(PyGObject  *self,
+                     guint       n_parameters,
+                     GParameter *parameters)
+{
+    if (self->obj == NULL) {
+        pygobject_init_wrapper_set((PyObject *) self);
+        self->obj = g_object_newv(pyg_type_from_object((PyObject *) self),
+                                  n_parameters, parameters);
+        pygobject_init_wrapper_set(NULL);
+        pygobject_register_wrapper((PyObject *) self);
+    } else {
+        int i;
+        for (i = 0; i < n_parameters; ++i)
+            g_object_set_property(self->obj, parameters[i].name, &parameters[i].value);
+    }
+    return 0;
+}
+
+/* This function is mostly juste copy-paste from g_object_new, but
+ * calls pygobject_constructv instead of g_object_newv */
+int
+pygobject_construct(PyGObject *self, const char *first_property_name, ...)
+{
+    va_list var_args;
+    GObjectClass *class;
+    GParameter *params;
+    const gchar *name;
+    guint n_params = 0, n_alloced_params = 16;
+    GType object_type = pyg_type_from_object((PyObject *) self);
+    int retval;
+
+    if (!first_property_name)
+        return pygobject_constructv(self, 0, NULL);
+
+    va_start(var_args, first_property_name);
+    class = g_type_class_ref(object_type);
+
+    params = g_new(GParameter, n_alloced_params);
+    name = first_property_name;
+    while (name)
+    {
+        gchar *error = NULL;
+        GParamSpec *pspec = g_object_class_find_property(class, name);
+
+        if (!pspec)
+	{
+            g_warning("%s: object class `%s' has no property named `%s'", 
+                      G_STRFUNC, 
+                      g_type_name(object_type), 
+                      name);
+            break;
+	}
+        if (n_params >= n_alloced_params)
+	{
+            n_alloced_params += 16;
+            params = g_renew(GParameter, params, n_alloced_params);
+	}
+        params[n_params].name = name;
+        params[n_params].value.g_type = 0;
+        g_value_init(&params[n_params].value, G_PARAM_SPEC_VALUE_TYPE(pspec));
+        G_VALUE_COLLECT(&params[n_params].value, var_args, 0, &error);
+        if (error)
+	{
+            g_warning("%s: %s", G_STRFUNC, error);
+            g_free(error);
+            g_value_unset(&params[n_params].value);
+            break;
+	}
+        n_params++;
+        name = va_arg(var_args, gchar*);
+    }
+
+    retval = pygobject_constructv(self, n_params, params);
+
+    while (n_params--)
+        g_value_unset(&params[n_params].value);
+    g_free(params);
+    va_end(var_args);
+    g_type_class_unref(class);
+    return retval;
+}
+
+void
+pyg_set_object_has_new_constructor(GType type)
+{
+    g_type_set_qdata(type, pygobject_has_updated_constructor_key, GINT_TO_POINTER(1));
+}
+
 /* ----------------- gobject module initialisation -------------- */
 
 struct _PyGObject_Functions pygobject_api_functions = {
@@ -2521,7 +2679,10 @@ struct _PyGObject_Functions pygobject_ap
   pyg_register_class_init,
   pyg_register_interface_info,
 
-  pyg_closure_set_exception_handler
+  pyg_closure_set_exception_handler,
+  pygobject_constructv,
+  pygobject_construct,
+  pyg_set_object_has_new_constructor
 };
 
 #define REGISTER_TYPE(d, type, name) \
@@ -2560,6 +2721,8 @@ initgobject(void)
     pyginterface_type_key    = g_quark_from_static_string("PyGInterface::type");
     pyginterface_info_key    = g_quark_from_static_string("PyGInterface::info");
     pygpointer_class_key     = g_quark_from_static_string("PyGPointer::class");
+    pygobject_has_updated_constructor_key =\
+        g_quark_from_static_string("PyGObject::has-updated-constructor");
 
     REGISTER_TYPE(d, PyGTypeWrapper_Type, "GType");
 
@@ -2582,6 +2745,7 @@ initgobject(void)
 			     &PyGObject_Type, NULL);
     PyDict_SetItemString(PyGObject_Type.tp_dict, "__gdoc__",
 			 pyg_object_descr_doc_get());
+    pyg_set_object_has_new_constructor(G_TYPE_OBJECT);
 
       /* GObject properties descriptor */
     if (PyType_Ready(&PyGProps_Type) < 0)
Index: gobject/pygobject-private.h
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gobject/pygobject-private.h,v
retrieving revision 1.36
diff -u -p -d -r1.36 pygobject-private.h
--- gobject/pygobject-private.h	8 Jul 2005 14:27:30 -0000	1.36
+++ gobject/pygobject-private.h	9 Jul 2005 15:32:41 -0000
@@ -51,9 +51,17 @@ extern GQuark pygobject_class_init_key;
 extern GQuark pygobject_class_key;
 extern GQuark pygobject_wrapper_key;
 extern GQuark pygpointer_class_key;
+extern GQuark pygobject_has_updated_constructor_key;
 
-void  pyg_destroy_notify (gpointer user_data);
-gboolean pyg_error_check(GError **error);
+void     pyg_destroy_notify   (gpointer     user_data);
+gboolean pyg_error_check      (GError     **error);
+int      pygobject_constructv (PyGObject   *self,
+                               guint        n_parameters,
+                               GParameter  *parameters);
+int      pygobject_construct  (PyGObject   *self,
+                               const char  *first_property_name,
+                               ...);
+void     pyg_set_object_has_new_constructor (GType gtype);
 
 /* from pygtype.h */
 extern PyTypeObject PyGTypeWrapper_Type;
@@ -103,6 +111,7 @@ void          pygobject_register_class  
 					  PyObject *bases);
 void          pygobject_register_wrapper (PyObject *self);
 PyObject *    pygobject_new              (GObject *obj);
+PyObject *    pygobject_new_full         (GObject *obj, gboolean sink);
 PyTypeObject *pygobject_lookup_class     (GType gtype);
 void          pygobject_watch_closure    (PyObject *self, GClosure *closure);
 void          pygobject_register_sinkfunc(GType type,
Index: gobject/pygobject.c
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gobject/pygobject.c,v
retrieving revision 1.49
diff -u -p -d -r1.49 pygobject.c
--- gobject/pygobject.c	9 Jul 2005 11:29:34 -0000	1.49
+++ gobject/pygobject.c	9 Jul 2005 15:32:41 -0000
@@ -660,6 +660,7 @@ pygobject_lookup_class(GType gtype)
 /**
  * pygobject_new:
  * @obj: a GObject instance.
+ * @sink: whether to sink any floating reference found on the GObject.
  *
  * This function gets a reference to a wrapper for the given GObject
  * instance.  If a wrapper has already been created, a new reference
@@ -669,7 +670,7 @@ pygobject_lookup_class(GType gtype)
  * Returns: a reference to the wrapper for the GObject.
  */
 PyObject *
-pygobject_new(GObject *obj)
+pygobject_new_full(GObject *obj, gboolean sink)
 {
     PyGObject *self;
 
@@ -695,7 +696,8 @@ pygobject_new(GObject *obj)
         pyg_begin_allow_threads;
 	self->obj = g_object_ref(obj);
 	pyg_end_allow_threads;
-	sink_object(self->obj);
+        if (sink)
+            sink_object(self->obj);
 
 	self->inst_dict = NULL;
 	self->weakreflist = NULL;
@@ -711,6 +713,12 @@ pygobject_new(GObject *obj)
     return (PyObject *)self;
 }
 
+PyObject *
+pygobject_new(GObject *obj)
+{
+    return pygobject_new_full(obj, TRUE);
+}
+
 static void
 pygobject_unwatch_closure(gpointer data, GClosure *closure)
 {
@@ -943,11 +951,7 @@ pygobject_init(PyGObject *self, PyObject
 	    n_params++;
 	}
     }
-
-    self->obj = g_object_newv(object_type, n_params, params);
-    if (self->obj)
-	pygobject_register_wrapper((PyObject *)self);
-    else
+    if (pygobject_constructv(self, n_params, params))
 	PyErr_SetString (PyExc_RuntimeError, "could not create object");
 	   
  cleanup:
Index: gobject/pygobject.h
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gobject/pygobject.h,v
retrieving revision 1.53
diff -u -p -d -r1.53 pygobject.h
--- gobject/pygobject.h	7 Jul 2005 18:44:12 -0000	1.53
+++ gobject/pygobject.h	9 Jul 2005 15:32:41 -0000
@@ -166,6 +166,13 @@ struct _PyGObject_Functions {
     void      (*register_class_init) (GType gtype, PyGClassInitFunc class_init);
     void      (*register_interface_info) (GType gtype, const GInterfaceInfo *info);
     void      (*closure_set_exception_handler) (GClosure *closure, PyClosureExceptionHandler handler);
+    int       (*pygobject_constructv) (PyGObject  *self,
+                                       guint       n_parameters,
+                                       GParameter *parameters);
+    int       (*pygobject_construct) (PyGObject  *self,
+                                      const char *first_property_name,
+                                      ...);
+    void      (*set_object_has_new_constructor) (GType type);
 };
 
 #ifndef _INSIDE_PYGOBJECT_
@@ -222,6 +229,10 @@ struct _PyGObject_Functions *_PyGObject_
 #define pyg_enable_threads          (_PyGObject_API->enable_threads)
 #define pyg_register_class_init     (_PyGObject_API->register_class_init)
 #define pyg_register_interface_info (_PyGObject_API->register_interface_info)
+#define pygobject_construct         (_PyGObject_API->pygobject_construct)
+#define pygobject_constructv        (_PyGObject_API->pygobject_constructv)
+#define pyg_set_object_has_new_constructor (_PyGObject_API->set_object_has_new_constructor)
+
 
 #define pyg_block_threads()   G_STMT_START {   \
     if (_PyGObject_API->block_threads != NULL) \
Index: gtk/gtk.override
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gtk/gtk.override,v
retrieving revision 1.336
diff -u -p -d -r1.336 gtk.override
--- gtk/gtk.override	27 Jun 2005 23:20:39 -0000	1.336
+++ gtk/gtk.override	9 Jul 2005 15:32:48 -0000
@@ -1261,23 +1261,25 @@ _wrap_gtk_button_new(PyGObject *self, Py
                                      kwlist, &text, &stock, &py_use_underline))
         return -1;
     if (stock)
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "label", stock, "use-stock", TRUE,
-                                 "use-underline", TRUE, NULL);
+        pygobject_construct(self,
+                            "label", stock, "use-stock", TRUE,
+                            "use-underline", TRUE, NULL);
     else if (text)
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "label", text, "use-underline",
-                                 PyObject_IsTrue(py_use_underline), NULL);
+        pygobject_construct(self,
+                            "label", text, "use-underline",
+                            PyObject_IsTrue(py_use_underline), NULL);
     else
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError, "could not create GtkButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_BUTTON);
+%%
 override gtk_button_get_alignment noargs
 static PyObject *
 _wrap_gtk_button_get_alignment(PyGObject *self)
@@ -1327,20 +1329,22 @@ _wrap_gtk_toggle_button_new(PyGObject *s
                                      &text, &py_use_underline))
         return -1;
     if (text)
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "label", text, "use-underline",
-                                 PyObject_IsTrue(py_use_underline), NULL);
+        pygobject_construct(self,
+                            "label", text, "use-underline",
+                            PyObject_IsTrue(py_use_underline), NULL);
     else
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
                         "could not create GtkToggleButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_TOGGLE_BUTTON);
+%%
 override gtk_check_button_new kwargs
 static int
 _wrap_gtk_check_button_new(PyGObject *self, PyObject *args, PyObject*kwargs)
@@ -1353,20 +1357,22 @@ _wrap_gtk_check_button_new(PyGObject *se
                                      kwlist, &text, &py_use_underline))
         return -1;
     if (text)
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "label", text, "use-underline",
-                                 PyObject_IsTrue(py_use_underline), NULL);
+        pygobject_construct(self,
+                            "label", text, "use-underline",
+                            PyObject_IsTrue(py_use_underline), NULL);
     else
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
                         "could not create GtkCheckButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_CHECK_BUTTON);
+%%
 override gtk_radio_button_new kwargs
 static int
 _wrap_gtk_radio_button_new(PyGObject *self, PyObject *args, PyObject*kwargs)
@@ -1393,29 +1399,30 @@ _wrap_gtk_radio_button_new(PyGObject *se
     /* various configs for create radio buttons ... */
     if (label == NULL) {
         if (group == NULL)
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+            pygobject_construct(self, NULL);
         else
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                     "group", group, NULL);
+            pygobject_construct(self, "group", group, NULL);
     } else {
         if (group == NULL)
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                     "label", label, "use-underline",
-                                     PyObject_IsTrue(py_use_underline), NULL);
+            pygobject_construct(self,
+                                "label", label, "use-underline",
+                                PyObject_IsTrue(py_use_underline), NULL);
         else
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                     "label", label, "group", group,
-                                     "use-underline",
-                                     PyObject_IsTrue(py_use_underline), NULL);
+            pygobject_construct(self,
+                                "label", label, "group", group,
+                                "use-underline",
+                                PyObject_IsTrue(py_use_underline), NULL);
     }
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError, "could not create GtkRadioButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_RADIO_BUTTON);
+%%
 override gtk_radio_button_get_group noargs
 static PyObject *
 _wrap_gtk_radio_button_get_group(PyGObject *self) {
@@ -1476,7 +1483,7 @@ _wrap_gtk_menu_item_new(PyGObject *self,
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zO:GtkMenuItem.__init__",
                                      kwlist, &text, &py_use_underline))
         return -1;
-    self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+    pygobject_construct(self, NULL);
     if (text) {
         GtkWidget *accel_label;
         accel_label = g_object_new(GTK_TYPE_ACCEL_LABEL, NULL);
@@ -1495,10 +1502,12 @@ _wrap_gtk_menu_item_new(PyGObject *self,
                         "could not create GtkMenuItem object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_MENU_ITEM);
+%%
 override gtk_menu_attach_to_widget kwargs
 static void
 pygtk_menu_detach (GtkWidget *attach_widget, GtkMenu *menu)
@@ -1578,7 +1587,7 @@ _wrap_gtk_check_menu_item_new(PyGObject 
                                      "|zO:GtkCheckMenuItem.__init__", kwlist,
                                      &text, &py_use_underline))
         return -1;
-    self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+    pygobject_construct(self, NULL);
     if (text) {
         GtkWidget *accel_label;
         accel_label = g_object_new(GTK_TYPE_ACCEL_LABEL, NULL);
@@ -1597,10 +1606,12 @@ _wrap_gtk_check_menu_item_new(PyGObject 
                         "could not create GtkCheckMenuItem object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_CHECK_MENU_ITEM);
+%%
 override gtk_radio_menu_item_new kwargs
 static int
 _wrap_gtk_radio_menu_item_new(PyGObject *self, PyObject *args,
@@ -1626,7 +1637,7 @@ _wrap_gtk_radio_menu_item_new(PyGObject 
         return -1;
     }
 
-    self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+    pygobject_construct(self, NULL);
 
     if (text) {
         GtkWidget *accel_label;
@@ -1649,10 +1660,12 @@ _wrap_gtk_radio_menu_item_new(PyGObject 
                         "could not create GtkRadioMenuItem object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_RADIO_MENU_ITEM);
+%%
 override gtk_image_menu_item_new kwargs
 static int
 _wrap_gtk_image_menu_item_new(PyGObject *self, PyObject *args,PyObject *kwargs)
@@ -2677,10 +2690,8 @@ _wrap_gtk_dialog_new_with_buttons(PyGObj
                         "buttons tuple must contain text/response id pairs");
         return -1;
     }
-    
-    self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
 
-    if (!self->obj) {
+    if (pygobject_constructv(self, 0, NULL)) {
         PyErr_SetString(PyExc_RuntimeError,
                         "could not create GtkDialog object");
         return -1;
@@ -2728,10 +2739,12 @@ _wrap_gtk_dialog_new_with_buttons(PyGObj
     g_object_ref(self->obj); /* we don't own the first reference of windows */
     pyg_gil_state_release(state);
 
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_DIALOG);
+%%
 override gtk_dialog_run noargs
 static PyObject *
 _wrap_gtk_dialog_run(PyGObject *self)
@@ -2857,19 +2870,20 @@ _wrap_gtk_progress_bar_new_with_adjustme
 
 
     if (adjustment)
-        self->obj = g_object_new(pyg_type_from_object((PyObject *)self),
-                                 "adjustment", adjustment, NULL);
+        pygobject_construct(self, "adjustment", adjustment, NULL);
     else
-        self->obj = g_object_new(pyg_type_from_object((PyObject *)self), NULL);
+        pygobject_construct(self, NULL);
 
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError, "could not create GtkProgressBar object");
 	return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_PROGRESS_BAR);
+%%
 override gtk_rc_set_default_files kwargs
 static PyObject *
 _wrap_gtk_rc_set_default_files(PyGObject *self, PyObject *args,
@@ -3930,11 +3944,11 @@ _wrap_gtk_file_chooser_dialog_new(PyGObj
         return -1;
     }
 
-    self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                             "title", title, 
-                             "action", action,
-			     "file-system-backend", backend,
-                             NULL);
+    pygobject_construct(self,
+                        "title", title, 
+                        "action", action,
+                        "file-system-backend", backend,
+                        NULL);
 
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
@@ -3970,10 +3984,12 @@ _wrap_gtk_file_chooser_dialog_new(PyGObj
     pyg_begin_allow_threads;
     g_object_ref(self->obj); /* we don't own the first reference of windows */
     pyg_end_allow_threads;
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_FILE_CHOOSER_DIALOG);
+%%
 override gtk_ui_manager_get_action_groups noargs
 static PyObject *
 _wrap_gtk_ui_manager_get_action_groups(PyGObject *self)
@@ -4360,19 +4376,20 @@ _wrap_gtk_color_button_new(PyGObject *se
  		return -1;
 	    }
         color = pyg_boxed_get(pycolor, GdkColor);
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "color", color, NULL);
+        pygobject_construct(self, "color", color, NULL);
     } else {
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     }
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError, "could not create GtkColorButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_COLOR_BUTTON);
+%%
 override gtk_color_button_get_color noargs
 static PyObject *
 _wrap_gtk_color_button_get_color(PyGObject *self)
@@ -4394,10 +4411,9 @@ _wrap_gtk_combo_box_new(PyGObject *self,
 				     kwlist, &pymodel))
         return -1;
     if (pymodel == NULL || (PyObject *)pymodel == Py_None)
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     else if (pygobject_check(pymodel, &PyGtkTreeModel_Type))
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "model", GTK_TREE_MODEL(pymodel->obj), NULL);
+        pygobject_construct(self, "model", GTK_TREE_MODEL(pymodel->obj), NULL);
     else {
 	PyErr_SetString(PyExc_TypeError,
 			"model must be a gtk.TreeModel or None");
@@ -4409,10 +4425,12 @@ _wrap_gtk_combo_box_new(PyGObject *self,
 			"could not create GtkComboBox object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_COMBO_BOX);
+%%
 override gtk_combo_box_get_active_iter noargs
 static PyObject *
 _wrap_gtk_combo_box_get_active_iter(PyGObject *self)
@@ -4475,7 +4493,7 @@ _wrap_gtk_combo_box_entry_new(PyGObject 
 				     kwlist, &pymodel, &column))
         return -1;
     if ((PyObject*)pymodel == Py_None || pymodel == NULL)
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     else if (pygobject_check(pymodel, &PyGtkTreeModel_Type)) {
 	gint ncol = gtk_tree_model_get_n_columns(GTK_TREE_MODEL(pymodel->obj));
 
@@ -4483,9 +4501,8 @@ _wrap_gtk_combo_box_entry_new(PyGObject 
 	    PyErr_SetString(PyExc_ValueError, "column value out of range");
 	    return -1;
 	}
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "model", GTK_TREE_MODEL(pymodel->obj),
-                                 "text-column", column, NULL);
+        pygobject_construct(self, "model", GTK_TREE_MODEL(pymodel->obj),
+                            "text-column", column, NULL);
     } else {
 	PyErr_SetString(PyExc_TypeError,
 			"model must be a gtk.TreeModel or None");
@@ -4497,10 +4514,12 @@ _wrap_gtk_combo_box_entry_new(PyGObject 
 			"could not create GtkComboBoxEntry object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_COMBO_BOX_ENTRY);
+%%
 override gtk_entry_completion_set_match_func args
 static gboolean
 pygtk_entry_completion_match_func_cb(GtkEntryCompletion *completion,
@@ -4724,19 +4743,21 @@ _wrap_gtk_file_chooser_widget_new(PyGObj
     if (py_action && pyg_enum_get_value(GTK_TYPE_FILE_CHOOSER_ACTION,
 					py_action, (gint *)&action))
         return -1;
-    self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                             "action", action, "file-system-backend", backend,
-                             NULL);
+        pygobject_construct(self,
+                            "action", action, "file-system-backend", backend,
+                            NULL);
  
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
 			"could not create GtkFileChooserWidget object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_FILE_CHOOSER_WIDGET);
+%%
 override gtk_file_filter_filter kwargs
 static PyObject *
 _wrap_gtk_file_filter_filter(PyGObject *self, PyObject *args,
@@ -4909,20 +4930,21 @@ _wrap_gtk_font_button_new(PyGObject *sel
         return -1;
 
     if (fontname == NULL)
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     else
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "font-name", fontname, NULL);
+        pygobject_construct(self, "font-name", fontname, NULL);
  
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
 			"could not create GtkFontButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_FONT_BUTTON);
+%%
 override gtk_action_get_proxies noargs
 static PyObject *
 _wrap_gtk_action_get_proxies(PyGObject *self)
@@ -5391,27 +5413,26 @@ _wrap_gtk_radio_tool_button_new(PyGObjec
     /* various configs for create radio tool buttons ... */
     if (stock == NULL) {
         if (widget == NULL)
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+            pygobject_construct(self, NULL);
         else
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                     "group", widget, NULL);
+            pygobject_construct(self, "group", widget, NULL);
     } else {
         if (widget == NULL)
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                     "stock-id", stock, NULL);
+            pygobject_construct(self, "stock-id", stock, NULL);
         else
-            self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                     "stock-id", stock, "group", widget, NULL);
+            pygobject_construct(self, "stock-id", stock, "group", widget, NULL);
     }
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
 			"could not create GtkRadioToolButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_RADIO_TOOL_BUTTON);
+%%
 override gtk_radio_tool_button_set_group kwargs
 static PyObject *
 _wrap_gtk_radio_tool_button_set_group(PyGObject *self, PyObject *args,
@@ -5496,20 +5517,21 @@ _wrap_gtk_toggle_tool_button_new(PyGObje
         return -1;
 
     if (stock_id)
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "stock-id", stock_id, NULL);
+        pygobject_construct(self, "stock-id", stock_id, NULL);
     else
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
 
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
 			"could not create GtkToggleToolButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_TOGGLE_TOOL_BUTTON);
+%%
 override gtk_tool_button_new kwargs
 static int
 _wrap_gtk_tool_button_new(PyGObject *self, PyObject *args,
@@ -5525,8 +5547,7 @@ _wrap_gtk_tool_button_new(PyGObject *sel
     if (PyArg_ParseTupleAndKeywords(args, kwargs,
 				    "s:GtkToolButton.__init__", kwlist1,
 				    &stock_id)) {
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "stock-id", stock_id, NULL);
+        pygobject_construct(self, "stock-id", stock_id, NULL);
     } else {
 	PyErr_Clear();
 	if (!PyArg_ParseTupleAndKeywords(args, kwargs,
@@ -5550,9 +5571,8 @@ _wrap_gtk_tool_button_new(PyGObject *sel
 	    }
 	    icon_widget = GTK_WIDGET(py_icon_widget->obj);
 	}
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "icon-widget", icon_widget,
-                                 "label", label, NULL);
+        pygobject_construct(self, "icon-widget", icon_widget,
+                            "label", label, NULL);
     }
 
     if (!self->obj) {
@@ -5560,10 +5580,12 @@ _wrap_gtk_tool_button_new(PyGObject *sel
 			"could not create GtkToolButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_TOOL_BUTTON);
+%%
 override gtk_tooltips_get_info_from_tip_window noargs
 static PyObject *
 _wrap_gtk_tooltips_get_info_from_tip_window(PyGObject *self)
@@ -5603,17 +5625,17 @@ _wrap_gtk_entry_new(PyGObject * self, Py
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:GtkEntry.__init__",
                                      kwlist, &max))
 	return -1;
-    self->obj = g_object_new(pyg_type_from_object((PyObject *)self),
-                             "max-length", max, NULL);
+    pygobject_construct(self, "max-length", max, NULL);
     if (!self->obj) {
 	PyErr_SetString(PyExc_RuntimeError,
                         "could not create GtkEntry object");
 	return -1;
     }
-    pygobject_register_wrapper((PyObject *) self);
     return 0;
 }
-
+%%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_ENTRY);
 %%
 override gtk_accel_groups_from_object
 static PyObject *
@@ -5651,7 +5673,6 @@ override gtk_table_new kwargs
 static int
 _wrap_gtk_table_new(PyGObject *self, PyObject *args, PyObject *kwargs)
 {
-    GType obj_type = pyg_type_from_object((PyObject *) self);
     char *arg_names[] = {"rows", "columns", "homogeneous", NULL };
     int rows = 1, cols = 1;
     PyObject *homogeneous = Py_False;
@@ -5659,16 +5680,18 @@ _wrap_gtk_table_new(PyGObject *self, PyO
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iiO:gtk.Table.__init__", arg_names,
                                      &rows, &cols, &homogeneous))
         return -1;
-    self->obj = g_object_new(obj_type, "n_rows", rows, "n_columns", cols,
-                             "homogeneous", PyObject_IsTrue(homogeneous), NULL);
+    pygobject_construct(self, "n_rows", rows, "n_columns", cols,
+                        "homogeneous", PyObject_IsTrue(homogeneous), NULL);
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError, "could not create gtk.Table object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_TABLE);
+%%
 override gtk_pixmap_new kwargs
 static int
 _wrap_gtk_pixmap_new(PyGObject *self, PyObject *args, PyObject *kwargs)
@@ -5689,7 +5712,7 @@ _wrap_gtk_pixmap_new(PyGObject *self, Py
         return -1;
     }
 
-    self->obj = g_object_new(pyg_type_from_object((PyObject *)self), NULL);
+    pygobject_construct(self, NULL);
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError, "could not create GtkPixmap object");
         return -1;
@@ -5697,10 +5720,12 @@ _wrap_gtk_pixmap_new(PyGObject *self, Py
 
     gtk_pixmap_set(GTK_PIXMAP(self->obj), GDK_PIXMAP(pixmap->obj), mask);
 
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_PIXMAP);
+%%
 override gtk_plug_new kwargs
 static int
 _wrap_gtk_plug_new(PyGObject *self, PyObject *args, PyObject *kwargs)
@@ -5717,7 +5742,7 @@ _wrap_gtk_plug_new(PyGObject *self, PyOb
 
     socket_id = PyLong_AsUnsignedLong(py_socket_id);
 
-    self->obj = g_object_new(pyg_type_from_object((PyObject *)self), NULL);
+    pygobject_construct(self, NULL);
 
     if (display)
         gtk_plug_construct_for_display(GTK_PLUG(self->obj),
@@ -5728,10 +5753,12 @@ _wrap_gtk_plug_new(PyGObject *self, PyOb
         PyErr_SetString(PyExc_RuntimeError, "could not create GtkPlug object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_PLUG);
+%%
 override gtk_adjustment_new kwargs
 static int
 _wrap_gtk_adjustment_new(PyGObject *self, PyObject *args, PyObject *kwargs)
@@ -5744,7 +5771,6 @@ _wrap_gtk_adjustment_new(PyGObject *self
     gdouble step_incr = 0;
     gdouble page_incr = 0;
     gdouble page_size = 0;
-    GType obj_type = pyg_type_from_object((PyObject *) self);
  
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
                                      "|dddddd:gtk.Adjustment.__init__" ,
@@ -5752,20 +5778,22 @@ _wrap_gtk_adjustment_new(PyGObject *self
                                      &page_incr, &page_size))
         return -1;
 
-    self->obj = g_object_new(obj_type, "lower", lower, "upper", upper,
-                             "step_increment", step_incr,
-                             "page_increment", page_incr,
-                             "page_size", page_size,
-                             "value", value, NULL);
+    pygobject_construct(self, "lower", lower, "upper", upper,
+                        "step_increment", step_incr,
+                        "page_increment", page_incr,
+                        "page_size", page_size,
+                        "value", value, NULL);
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
                         "could not create gtk.Adjustment object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_ADJUSTMENT);
+%%
 override-slot GtkMisc.tp_init
 static int
 _wrap_gtk_misc_tp_init(PyObject *self, PyObject *args, PyObject *kwargs)
@@ -5817,25 +5845,25 @@ _wrap_gtk_alignment_new(PyGObject *self,
     gdouble yalign = 0;
     gdouble xscale = 0;
     gdouble yscale = 0;
-    GType obj_type = pyg_type_from_object((PyObject *) self);
  
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
                                      "|dddd:gtk.Alignment.__init__" ,
                                      kwlist, &xalign, &yalign, &xscale, &yscale))
         return -1;
 
-    self->obj = g_object_new(obj_type,
-                             "xalign", xalign, "yalign", yalign,
-                             "xscale", xscale, "yscale", yscale, NULL);
+    pygobject_construct(self, "xalign", xalign, "yalign", yalign,
+                        "xscale", xscale, "yscale", yscale, NULL);
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
                         "could not create gtk.Alignment object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_ALIGNMENT);
+%%
 override gtk_about_dialog_set_authors kwargs
 static PyObject *
 _wrap_gtk_about_dialog_set_authors(PyGObject *self, PyObject *args,
@@ -6418,10 +6446,9 @@ _wrap_gtk_file_chooser_button_new(PyGObj
     if (PyArg_ParseTupleAndKeywords(args, kwargs,
 				     "s|z:GtkFileChooserButton.__init__",
 				     kwlist1, &title, &backend))
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "title", title,
-                                 "file-system-backend", backend,
-                                 NULL);
+        pygobject_construct(self, "title", title,
+                            "file-system-backend", backend,
+                            NULL);
     else {
         PyErr_Clear();
 	if (!PyArg_ParseTupleAndKeywords(args, kwargs,
@@ -6435,18 +6462,19 @@ _wrap_gtk_file_chooser_button_new(PyGObj
 			    "  gtk.FileChooserButton(filechooserdialog)");
 	    return -1;
 	}
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "dialog", GTK_WIDGET(dialog->obj), NULL);
+        pygobject_construct(self, "dialog", GTK_WIDGET(dialog->obj), NULL);
     }
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
 			"could not create GtkFileChooserBUtton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_FILE_CHOOSER_BUTTON);
+%%
 override gtk_icon_theme_get_icon_sizes kwargs
 static PyObject *
 _wrap_gtk_icon_theme_get_icon_sizes(PyGObject *self, PyObject *args,
@@ -6490,10 +6518,9 @@ _wrap_gtk_icon_view_new(PyGObject *self,
 				     kwlist, &pymodel))
         return -1;
     if (pymodel == NULL || (PyObject *)pymodel == Py_None)
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self), NULL);
+        pygobject_construct(self, NULL);
     else if (pygobject_check(pymodel, &PyGtkTreeModel_Type))
-	self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "model", GTK_TREE_MODEL(pymodel->obj), NULL);
+        pygobject_construct(self, "model", GTK_TREE_MODEL(pymodel->obj), NULL);
     else {
 	PyErr_SetString(PyExc_TypeError,
 			"model must be a gtk.TreeModel or None");
@@ -6505,10 +6532,12 @@ _wrap_gtk_icon_view_new(PyGObject *self,
 			"could not create GtkIconView object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
 %%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_ICON_VIEW);
+%%
 override gtk_icon_view_get_selected_items noargs
 static PyObject *
 _wrap_gtk_icon_view_get_selected_items(PyGObject *self)
@@ -6607,9 +6636,7 @@ _wrap_gtk_menu_tool_button_new(PyGObject
     if (PyArg_ParseTupleAndKeywords(args, kwargs,
 				     "s:GtkMenuToolButton.__init__",
 				     kwlist1, &stock_id))
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "stock-id", stock_id,
-                                 NULL);
+        pygobject_construct(self, "stock-id", stock_id, NULL);
     else {
         PyErr_Clear();
 	if (!PyArg_ParseTupleAndKeywords(args, kwargs,
@@ -6631,19 +6658,19 @@ _wrap_gtk_menu_tool_button_new(PyGObject
                 return -1;
             }
         }
-        self->obj = g_object_new(pyg_type_from_object((PyObject*) self),
-                                 "icon-widget", icon_widget,
-                                 "label", label,
-                                 NULL);
+        pygobject_construct(self, "icon-widget", icon_widget,
+                            "label", label, NULL);
     }
     if (!self->obj) {
         PyErr_SetString(PyExc_RuntimeError,
 			"could not create GtkMenuToolButton object");
         return -1;
     }
-    pygobject_register_wrapper((PyObject *)self);
     return 0;
 }
+%%
+init
+    pyg_set_object_has_new_constructor(GTK_TYPE_MENU_TOOL_BUTTON);
 %%
 override gtk_message_dialog_format_secondary_text kwargs
 static PyObject *
