views:

26

answers:

1

I've just started using Seed for development. One thing that Seed's web page mentions is that it "Maps C-isms (say, out arguments, or enums) to things that make sense in JavaScript." Unfortunately, I can't find any documentation or examples for how out arguments should work. So, for example, the following call in Seed:

window.get_size()

Will return the error "GInvokeError Too few "out" arguments (handling out)"

In C, the call would be expressed by passing in two out arguments:

gtk_window_get_size(GTK_WINDOW(widget), &width, &height);

I've tried various permutations on the JavaScript call without success. I've also looked at the documentation and sample code, but haven't found anything. Short of looking at the code, I think I'm running out of options.

I'd appreciate any insight anyone can offer into this.

A: 

Try to call this function indirectly. From this some sort of a shell function you could then pass out params to the gtk_window_get_size method and then you can work with the retrieved results. For example return it to the calling js function which in this case wants to resolve the size of the window.

Machta
I think this should be possible to do directly from js, as the homepage explicitly mentions dealing with out arguments. On the other hand, the equivalent call in python is totally straightforward and simply returns a (width,height) tuple, so maybe the fact that the naive call in JavaScript is failing should actually be considered a bug in Seed.
echo-flow
And why you don't give it any arguments in this call: window.get_size(), when it expects two out arguments? Where it is supposed to store the values?
Machta
It's not really clear how "out arguments" would be represented in js, because it's not possible to pass around pointers the way you can in C. You can pass in a reference to an object, which is close, but I've tried that, it and it doesn't have any effect on the object. I think it would make sense for such a function to return out arguments as an array of return values, as is currently done in the python bindings, but it's not currently doing that, so I'm inclined to file this as a bug in Seed.
echo-flow
Maybe it is a bug, but why don't you do what you have just described on your own? Create a function that would do all the work (pass params to gtk_window_get_size(GTK_WINDOW(widget), and store the values in an array) and then return the array with results. Then from JS it is just a matter of calling this method on the server...
Machta