Re: [gtkmm] Signal disconnect



bryan reigndropsfall net wrote:

I'm sure this has been asked a million times on this list, but since the
search feature of mailman (the archive system for gnome mail) sucks, I'm
going to ask again. How do I disconnect a signal handler from a signal? I've got a handler connected to the row_changed signal of my TreeView, but
I want to run an iterator to update the contents of each row, but I don't
want the signal handler to pick that up.  I know I could set up a check
for a boolean inside the handler and when I run my iterator on the
TreeView's rows I could just check if the boolean is set or not, but I
figured there had to be a better way to do this.  Thanks in advance!

Easy enough:

sigc::connection c = widget.signal_whatever().connect(sigc::mem_fun(whatever, whatever));

Then keep hold of c until you want to disconnect, and when you do, call c.disconnect().

Works in libsigc++ 1.2 as well, with the appropriate changes:

SigC::Connection c = widget.signal_whatever().connect(SigC::slot(whatever, whatever));

c.disconnect();




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