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

Re: [Libguestfs] example script for GObject



* Richard W.M. Jones:

>   var optargs = new Guestfs.AddDriveOpts ({readonly: true});
>   g.add_drive_opts (filename, optargs);
>
> This awkward style is required because GObject Introspection doesn't
> support optional arguments.

This is really, really ugly. Couldn't one use some sort of list instead?

Something that could be translated to Javascript as

    g.add_drive_opts (filename, [ Guestfs.AddDriveOpts.FORMAT, "raw" ] )

or even

    g.add_drive_opts (filename, Guestfs.AddDriveOpts.FORMAT, "raw" )

would be much nicer.

>> g.add_drive (file.get_path (), Guestfs.AddDriveOpts.OPTS_FORMAT, "raw");
> I think Javascript is simply ignoring the second and third arguments.
> I'm a bit surprised there is no error ...

Oh, thanks for noticing.

-Hilko


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