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 725711 - GtkStack visible children api is confusing
GtkStack visible children api is confusing
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: 2014-03-05 08:40 UTC by Jussi Kukkonen
Modified: 2014-03-07 03:53 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jussi Kukkonen 2014-03-05 08:40:08 UTC
GtkStack visible children functionality is unexpected and undocumented: 

    stack = Gtk.Stack ()
    stack.add_named (Gtk.Label ("label"), "page1")
    print stack.get_visible_child_name () # None

    stack.set_visible_child_name ("page1")
    print stack.get_visible_child_name () # None

I've looked at the source so I know that the widget needs to be visible (as in Widget.get_visible()) before it can be a "visible child".

The API feels misleading: The first get_visible_child_name() returns None, but if I had set the widget visible first it would have returned "page1". What's worse, the explicit set_visible_child_name() call just fails silently.

If this is intended, it should at least be documented.
Comment 1 Matthias Clasen 2014-03-07 03:51:57 UTC
The underlying issue here is that widgets are not visible by default. I'm adding a note