Re: GtkAssistant "apply" signal



On Sat, May 18, 2013 at 5:38 PM, Sébastien Granjoux <seb sfo free fr> wrote:
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.

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

  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).

Cheers,
    -Tristan

[0]: https://developer.gnome.org/gtk3/unstable/GtkAssistant.html#GtkAssistant-apply



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]