Glib::Dispatcher: How to use a non-void signal for tunneling?



Hi,

I need to update the GUI from outside the Gtk main thread. I wasn't happy with all the gdk_threads functions so I tried to incorporate Glib::Dispatcher in order to create a thread tunnel whenever I need to modify the GUI in another thread.

However, Glib::Dispatcher emits a sigc::signal<void>, but I need it to pass information around everytime an update is required. I especially can't use sigc::bind, since the information is updated everytime the update occurs (and this means it's probably a new object which is passed around on each call).

Here is the situation:
I am tranferring files asynchronously and display progress information in a Gtk::Dialog. The progress information object is handed to me in a signal handler which is called by Async::Handle::transfer. To visualize this information in the Dialog, I would have to pass this info object further through the thread tunnel in order to use it to draw a progress bar etc. in the main GUI thread.

But this doesn't seem to be possible. I may not pass it to the slot, because it's connected to a void signal. I also can't bind it, because I would bind an object which is already outdated. I tried that, in the hopes that it's always the same object, just with updated date (which would make sense), but making calls on the info object when I bind it segfaults, so I guess it's a dangling reference.

What can I do? There must be a way to pass information through the tunnel? The examples delivered with glibmm don't do that so they didn't help.

Thanks,
Matthias




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