Hi Max, 2011/2/16 Max Usachev <maxusac...@gmail.com>: > 2011/2/16 Alberto Garcia <agar...@igalia.com> >> On Wed, Feb 16, 2011 at 11:01:04AM +0200, Max Usachev wrote: >> > I want to use StackableWindow in my program like dialogs >> >> That's not the way to do it in GTK: you have to show the new window >> and connect to its 'destroyed' signal to do what you want to do after >> the window is destroyed. >> > Agree, that is a right way to. But what do you propose, if I have the > following situation: > There is some framework, there is a controller, I call controller method, > for example - foo: > > def foo: > # some actions1 > calling CustomDialog > # some actions2 > > My code implementing CustomDialog. In desktop environment gtk.Dialog().run() > blocks code execution, and when dialog destroys, 'some actions2' executed. > In Maemo using hildon.StackableWindows as replacement for gtk.Dialog, 'some > actions2' executes immediately after window creation. I can't modify > controller code, I can only implement CustomDialog.
You can create a new GLib mainloop that runs while the window is open. In the destroy signal handler, you can then call the quit() method on the mainloop. Check out this example: ----------------- import gtk import glib def CustomDialog(): l = glib.MainLoop() w = gtk.Window() w.set_title('subwindow') w.connect('destroy', lambda w: l.quit()) w.show_all() l.run() def callback(*args): print 'before' CustomDialog() print 'after' w = gtk.Window() w.set_title('main window') b = gtk.Button('click me') b.connect('clicked', callback) w.add(b) w.connect('destroy', gtk.main_quit) w.show_all() gtk.main() ----------------- Obviously, this also works with Hildon windows instead of GTK windows. HTH :) Thomas _______________________________________________ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers