Gtk: wait until window visible, how?

I write a program using ruby-gtk, it has 2 windows: toplevel and dialog.
After some event happens dialog window appear on screen i need to pause
program until this dialog will be destroyed, but i don’t know how to do
this in gtk, in Tcl/Tk this fragment looks like:

tkwait dialog

i try do write:
1 while dialog.visible?

but this fragment hang my program

Help please!


Alexander Danilov
UIN: 164825399