From: Joe V. D. <joe...@gm...> - 2006-01-28 02:14:56
|
On 1/27/06, Joe Van Dyk <joe...@gm...> wrote: > On 1/27/06, Joe Van Dyk <joe...@gm...> wrote: > > require 'gtk2' > > > > Gdk::Threads::init > > Gtk::init > > > > def show_dialog window, text > > dialog =3D Gtk::MessageDialog.new window, > > 0, > > Gtk::MessageDialog::INFO, > > Gtk::MessageDialog::BUTTONS_CLOSE, > > text > > dialog.run > > dialog.destroy > > end > > > > window =3D Gtk::Window.new > > window.set_default_size 300, 300 > > button =3D Gtk::Button.new("Hm.. not much going on here") > > button.signal_connect("clicked") { show_dialog window, "from button cli= ck" } > > window << button > > > > window.signal_connect("delete-event") { Gtk::main_quit } > > window.show_all > > > > Thread.new do > > sleep 5 > > puts "entering critical part here" > > Gdk::Threads::synchronize do > > show_dialog window, text, "from thread" > > doh, that should've been > show_dialog window, "from thread" > > This example now seems to work. But my real application is freezing > when the thread tries to tell a dialog window to open. > > Hm.... Here's the error that I get when I try to show the dialog box in my applica= tion: GLib-WARNING **:g_main_context_prepare(): main loop already active in another thread |