Re: GtkAssistant apply signal
Hi Le 18/05/2013 06:57, Kip Warner a écrit : During handling of the apply signal in my GtkAssistant, what is the recommended way of stopping the assistant from advancing to the next page if my code would like to abort the apply transitioning to the next page automatically? In the project-wizard in Anjuta, I have added a dummy page after each one. I don't block the transition between the current page and this dummy one. I check if the transition is valid in the prepare handler of the dummy page. If the transition is valid, I automatically switch to the page after the dummy one. Else, I switch back to the original page. Regards, Sébastien ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkAssistant apply signal
On Sat, 2013-05-18 at 17:47 +0900, Tristan Van Berkom wrote: Here's an idea, ... in the GtkAssistant documentation for apply[0], it says: The default behavior of the GtkAssistant is to switch to the page after the current page, unless the current page is the last one. Which means, you could do possibly two things: a.) In your derived GtkAssistant object, decide whether or not to invoke the parent class -apply() method from your own -apply() method which you override in your sublcass Hey Tristan. Thanks for both suggestions. This first one I don't know how to do because the GtkAssistant is being created by glade, and unless there's some kind of Python magic I could rely on, I don't know of an easy way to subclass it when it is already instantiated. b.) Connect to the apply signal on an assistant which you did not derive, and if the page is not valid, then just call: g_signal_stop_emission_by_name (assistant, apply); to avoid the default behaviour of switching pages. Both 'a' and 'b' would have the same effect (I have a preference for 'a' since I feel like 'b' is a sort of hack, but that's just my preference). 'b' is definitely a hack, but it might do the trick if I can get it to work. I am trying the following, assistant.stop_emission(apply) , except that the assistant still advances to the next page regardless. Hmm... -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkAssistant apply signal
On Sat, 2013-05-18 at 10:38 +0200, Sébastien Granjoux wrote: In the project-wizard in Anjuta, I have added a dummy page after each one. I don't block the transition between the current page and this dummy one. I check if the transition is valid in the prepare handler of the dummy page. If the transition is valid, I automatically switch to the page after the dummy one. Else, I switch back to the original page. Hey Sébastien. Thanks for the suggestion. I think that's a good hack and I might give it a try if I can't get Tristan's stop_emission(apply) logic to work. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkAssistant apply signal
Hey list, During handling of the apply signal in my GtkAssistant, what is the recommended way of stopping the assistant from advancing to the next page if my code would like to abort the apply transitioning to the next page automatically? I am aware of the set_page_complete() function, however I don't actually know if the page is ready to transition to the next page until the apply button is actually pressed. What I'm doing now if I ever want to stop the apply signal transitioning to the next page is to run the following in the apply signal callback where currentPageIndex is the index of the assistant page containing the apply button. assistant.set_current_page(currentPageIndex - 1) This works, excepts it has an obnoxious side effect. This makes the 'previous' button transition to ghost pages however many times the above 'apply' code is run if the user clicks 'previous' on the page containing the apply button. By ghost page, I mean clicking previous goes back, but the page doesn't actually change, only on the left page list in the assistant. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list