[Gtk-sharp-list] patch for gnome binding

Mike Kestner mkestner@ximian.com
Mon, 12 Jul 2004 07:48:47 -0500

On Mon, 2004-07-12 at 07:22, Mike Kestner wrote:
> On Mon, 2004-07-12 at 03:55, Martin Willemoes Hansen wrote:
> > I made a little fix for the gnome-binding of gtk#, what do you think? Is
> > it ok to commit?
> No, this is not the correct way to provide a subclassable ctor now.  It
> would be best to let the generator generate this ctor on its own now,
> since there are no parameters to map.

Okay, I see there isn't a void ctor for this.  There is no need to have
a disable_void_ctor attr on the class, as the generator doesn't generate
that by default any more.  So that can be removed.  

The new manual implementation should use CreateNativeObject to
instantiate objects for subclasses:

        if (GetType () != typeof (PrintJob)) {
                CreateNativeObject (new string [0], new GLib.Value [0]);

	Raw = gnome_print_job_new (PrintConfig.Default().Handle);

The problem with that is there is currently no way to set a PrintConfig
on a PrintJob, which should be done in the CreateNative branch.  So in
order to do this properly, you probably need to also add some glue to
set the config field on the Job.

Using the GType ctor, as you did in your patch, would require that all
subclasses define a GType property.  Even with that, the fact that you
were still using gnome_print_job_new would mean that the type of the
native object would always be Gnome.PrintJob, and not the subclassed
type, which could cause problems with the object wrapping mechanism if
the GC ever gets involved.

Mike Kestner <mkestner@ximian.com>