GNOME Bugzilla – Bug 88368
signal_io() feature request
Last modified: 2004-12-22 21:47:04 UTC
In gtkmm 1.2, I used g_io_add_watch() to watch file descriptors. In gtkmm 2, I can use signal_io() and have the advantage to use SigC::Connections instead. However, g_io_add_watch() passes a GIOChannel to it's callback function which can be used to read/write from. This feature is lacking with SignalIO / signal_io() E.g.: g_io_add_watch(g_io_channel_unix_new(filedescriptor), GIOCondition (G_IO_IN), &Class::callback, this); The prototype for Class::callback would then be: static gboolean Class::callback(GIOChannel* iochannel, GIOCondition cond, gpointer data); Here, the iochannel can be used to read/write from. With signal_io(): signal_io().connect( slot(*this, &Class::callback), filedescriptor, Glib::IO_IN); The prototype will look like this: bool Class::callback(Glib::IOCondition cond); In the last example, I don't have the possibility to read from the file descriptor or a iochannel. This forces me to make 'filedescriptor' a member of the class, and I can't reuse the same callback for many different filedescriptors.
Please try to provide a patch. Maybe you can override based on SigC::Slot type. I have _no_ idea what this stuff does or whether it's a good idea.
This will be punted unless a patch is provided soon.
Cannot you just pass the filedescriptor to your callback via bind()? E.g. signal_io().connect( bind(slot(*this, &Class::callback), filedescriptor), filedescriptor, Glib::IO_IN);
You are completely right. Sorry that I missed this.