Re: libseed-list watching stdin



This worked:

GLib.io_add_watch(stdin, 0, GLib.IOCondition.IN, watch_func);

And I had to use GString as buffer when reading:

var linebuf = new GLib.String;
var codebuf = "";
var watch = function(source, condition, data) {
    GLib.io_channel_read_line_string(source, linebuf);
    codebuf += linebuf.str;
    ....
    return true;
}

It would be nice if also the other read-functions worked, those who take a gchar pointer. How does Seed handle pointer-arguments?
Also, why does some stuff work in OOP style and some not? I created the 
GString with "new GLib.String", but it doesn't seem to have any methods. 
The IOChannel is created with GLib.io_channel_unix_new(), since "new 
GLib.IOChannel" can't pass any filedescriptor. And the returned 
IOChannel doesn't have any methods either. Is this because both are only 
GLib and not GObject?
/Jonatan

Jonatan Liljedahl wrote:
What's the simplest way to have a watcher on stdin?

I tried something like GLib.io_channel_add_watch(GLib.io_channel_unix_new(1),1,my_func) but get "ConversionError Can not convert Javascript value to long".
/Jonatan

_______________________________________________
libseed-list mailing list
libseed-list gnome org
http://mail.gnome.org/mailman/listinfo/libseed-list






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