GNOME Bugzilla – Bug 711494
GtkStack: add a signal telling when transition is done
Last modified: 2013-11-12 15:28:24 UTC
I have a GtkListBox inside a GtkStack. When I click on a row, I create a new child for the GtkStack displaying details for that row. Then I make a sliding transition to display the details. In that 2nd GtkStack child there is a "back" button that does a sliding transition to go back to the GtkListBox. If I destroy the details widget while the transition is happening to got back to the GtkListBox then child becomes blank and the transition isn't nice. So I need to know when the transition is done so I can safely destroy the child. This can be fixed in 2 ways: A) Add a "transition-position" gdouble property (we already have priv->transition_pos for that) so I can connect "notify::transition-position" and wait for it become 1.0. B) add a "transition-done" signal emitted once the transition is done. I think (A) has the disadvantage of emitting torrent of notify signals which could have a performance impact. (B) is trivial, costs nothing, and is enough for my use-case. If we agree on this, I can cook a patch.
I think a boolean transition-running property has slightly more value than a transition-done signal, while still avoiding the cost of transition-position. Can you do it like that ?
Created attachment 259593 [details] [review] GtkStack: add transition-running property This is useful to know when the transition is done we can remove the child from the stack.
Review of attachment 259593 [details] [review]: ::: gtk/gtkstack.c @@ +1285,3 @@ + * @stack: a #GtkStack + * + * <!-- --> I know it is somewhat repetitive, but I like to have an actual body in the documentation. If it is not worth documenting, the api is not worth having... You can vary the wording a bit: Returns whether the @stack is currently in a transition from one page to another.
Created attachment 259631 [details] [review] GtkStack: add transition-running property This is useful to know when the transition is done we can remove the child from the stack.
I don't think it adds any value, the return value say it all already, but if you prefer... In tp-glib we don't document getters, we just say "Returns: same has #TpFoo:bar property", only properties gets proper documentation. Anyway, your call :)
Review of attachment 259631 [details] [review]: thanks, looks good now
Thanks, pushed to master.