Question about testing/removing signals after signal_connect()

Hi:

I’m having a problem with connecting signals. I need to call
signal_connect several times with the same method. However, I don’t
want it to execute the method several times:

def do_something()
puts “Hello”
end

def connect
if button.signals_array.includes?(“clicked”,do_something)
button.signal_connect(“clicked”) {do_something }
end
end

10.times do
connect
end

I want it to output:

Hello

only once.

This would work great except that there’s no button.signals_array
available in Gtk as far as I can tell.

How can I test a widget to see if a signal is already attached to it? I
know there’s a list of signals that get executed, and connect_signals
adds to that list. How can I check that list for duplicates?

Thanks!

Eric