creationix / node-gir

Node bindings to libgirepository
http://live.gnome.org/GObjectIntrospection
MIT License
231 stars 58 forks source link

Creation methods with parameters are ignored #25

Closed JumpLink closed 11 years ago

JumpLink commented 11 years ago

For example

var box = new gtk.Box(gtk.Orientation.vertical, 4);

or

var box = new gtk.Box({orientation:gtk.Orientation.vertical});

are not working, the box has no vertical orientation or an error.

But this works:

box.orientation = gtk.Orientation.vertical;

Similar in

label = new gtk.Label("test");

This label has not the given text "test" inside it.

But this works:

label.set_label("test");

or this works,too:

label = new gtk.Label({label:"test"});
piotras commented 11 years ago

label = new gtk.Label({label:"test"}); is correct. GObject constructor accepts property name, value pairs, so there are not strict arguments.

JumpLink commented 11 years ago

And what about:

var box = new gtk.Box( { orientation : gtk.Orientation.vertical } );

in this case it does not work. Although it works as follows:

box.orientation = gtk.Orientation.vertical;

"orientation" is a property they comes from the gtk.Orientable interface.

piotras commented 11 years ago

I am not sure if I understand the problem. Is constructor argument ignored in every case, or just in the Box constructor one? Might be that gtk.Orientation.vertical is of type which is not supported in constructor (yet). Also might be related to fact that 'orientation' property is registered for GtkOrientable interface.

JumpLink commented 11 years ago

"Might be that gtk.Orientation.vertical is of type which is not supported in constructor (yet)." This is what I meen, thank you.