Re: Not able to contruct GLib.Thread



In my gir file g_thread_new is flagged as not introspectable
 introspectable="0"

In theory you could try changing that to '1' and rebuilding the typelib with g-ir-compiler, however I suspect there will be serious issues in using threads with the interpreter.

For MainLoop - have a look at this (it's in seed, but should be reasonably portable to gjs)

http://git.roojs.org/?p=gitlive;a=blob;f=Spawn.js

That code as a whole does an async system call, and runs a mainloop to wait for the return result.

I presume you found this - although not perfect it does help alot..
http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/

Regards
Alan


 --- On 16/Aug/2012, Mohan R wrote: 
> Hi,
> 
> I started learning gjs and gobject-introspection. As per my
> understanding, if I see a <record> entry with name="Thread"
> in /usr/share/gir-1.0/GLib-2.0.gir, then I can create a GThread object
> inside gjs.
> 
> With this, I tried to create one thread object,
> 
> #!/usr/bin/env gjs
> 
> const GLib = this.imports.gi.GLib;
> var MyThread = new GLib.Thread({});
> print(MyThread);
> 
> 
> But, I'm getting this error,
> 
> Error: Unable to construct boxed type Thread since it has no zero-args
> <constructor>, can only wrap an existing one
> 
> The same error appears when I do,
> 
> var MyMainLoop = new GLib.MainLoop({context: null, is_running: true});
> 
> But, I can create MainLoop with 'new' function,
> 
> var MyMainLoop = GLib.MainLoop.new(null, true);
> 
> Someone help me to understand how to create gir exported GObjects in
> gjs? I'm currently using gobject-introspection-1.32.1 and gjs-1.32.0
> 
> Thanks,
> Mohan R
> 
> _______________________________________________
> javascript-list mailing list
> javascript-list gnome org
> https://mail.gnome.org/mailman/listinfo/javascript-list


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