After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 711494 - GtkStack: add a signal telling when transition is done
GtkStack: add a signal telling when transition is done
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-11-05 15:25 UTC by Xavier Claessens
Modified: 2013-11-12 15:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkStack: add transition-running property (4.43 KB, patch)
2013-11-11 21:39 UTC, Xavier Claessens
needs-work Details | Review
GtkStack: add transition-running property (4.51 KB, patch)
2013-11-12 03:17 UTC, Xavier Claessens
accepted-commit_now Details | Review

Description Xavier Claessens 2013-11-05 15:25:59 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.
Comment 1 Matthias Clasen 2013-11-09 04:10:55 UTC
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 ?
Comment 2 Xavier Claessens 2013-11-11 21:39:34 UTC
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.
Comment 3 Matthias Clasen 2013-11-12 03:09:19 UTC
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.
Comment 4 Xavier Claessens 2013-11-12 03:17:58 UTC
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.
Comment 5 Xavier Claessens 2013-11-12 03:20:17 UTC
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 :)
Comment 6 Matthias Clasen 2013-11-12 04:32:16 UTC
Review of attachment 259631 [details] [review]:

thanks, looks good now
Comment 7 Xavier Claessens 2013-11-12 15:28:24 UTC
Thanks, pushed to master.