win_mainloop := nil; function mainloop_destroyed(window) { gtk_main_quit(); win_mainloop = nil; } function create_mainloop () { local label, button, vbox, action_area; if (!win_mainloop) { win_mainloop = new (GtkDialog); win_mainloop.signal ("destroy", `mainloop_destroyed(@win_mainloop)); win_mainloop.title = "Test Main Loop"; win_mainloop.border_width = 0; vbox = car(win_mainloop.children()); action_area = cadr(vbox.children()); label = new(GtkLabel); label.set_text("In recursive main loop..."); label.set_padding(20, 20); vbox.pack_start(label, TRUE, TRUE, 0); label.show(); button = new(GtkButton); button.label = "Leave"; action_area.pack_start(button, FALSE, TRUE, 0); button.signal("clicked", `(@win_mainloop).destroy()); button.can_default = TRUE; button.grab_default(); win_mainloop.show_all(); princ("create_mainloop: start\n"); gtk_main (); princ ("create_mainloop: done\n"); } win_mainloop; }
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.