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 331785 - gtk.Notebook.get_current_page() returns incorrect page number when pages hidden
gtk.Notebook.get_current_page() returns incorrect page number when pages hidden
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkNotebook
2.8.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-02-19 15:37 UTC by Sebastien Bacher
Modified: 2006-02-20 23:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastien Bacher 2006-02-19 15:37:56 UTC
That bug has been opened on https://launchpad.net/distros/ubuntu/+source/gtk+2.0/+bug/30348

"Hi,

I have found the Gtk+ Notebook widget has inconsistent behaviour when pages are hidden.

gtk_notebook_get_current_page() returns the selected page starting from 0. Hidden pages are not counted.

gtk_notebook_get_nth_page() takes a page number as an argument. The number is the page number as added (i.e. it includes any hidden pages).

Since these behave differently gtk_notebook_get_nth_page(gtk_notebook_get_current_page()) does not return the selected page if hidden pages are present.

My expected behaviour was that hidden pages are counted but not visible.

This bug is always reproducible. Find attached a PyGTK and C example that shows the bug.

The use case I have for this is:
An application contains a notebook which has pages that are added and removed dynamically. When the application starts the notebook contains a single "splashscreen" page. When a page is added the "splashscreen" is hidden until all the dynamically added pages are removed.

I am using Ubuntu Breezy (libgtk2.0-0 version 2.8.6-0ubuntu2.1)

http://librarian.launchpad.net/1546945/gtk_notebook_bug.py
Python example of Gtk+ notebook hidden page bug

http://librarian.launchpad.net/1546946/gtk_notebook_bug.c
C example of Gtk+ notebook hidden page bug"
Comment 1 Matthias Clasen 2006-02-20 23:14:08 UTC
2006-02-20  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtknotebook.c: Properly update internal state
        when child visibility changes.  (#331785, Sebastien Bacher)