Re: determine number of pages in a GtkNotebook



MHL Schulze t-online de (Martin Schulze) writes:

> Hello!
> 
> Maybe my former mail was not clear enough. So now in simpler words:
> 
> - How can I determine the number of pages in a GtkNotebook-Widget?
> - Is is safe to use g_list_length(my_notebook.children)?

No, but you might be able to get away with it. The only documented
exported way of getting the number of pages is to use gtk_container_children(),
and you really should do that.

> - Furthermore: Will the pointers stored in my_notebook.children stay
> valid when inserting/deleting a page to my_notebook so that it's safe
> to use g_list_position(my_notebook.children, node) to determine the
> position of a page?

No. It's completely undefined what's in that list. gtk_notebook_page_num()
gives you the mapping from page widget to page number.

> - If yes, will these methods stay valid for future versions gtk-2.x.x?

There is no guarantee that anything other than:

 - Member variables marked with /*< public >*/ and in the API docs
 - Functions in the public header files that do *not* begin with _gtk_
   
Will remain public in future versions of GTK+.

Regards,
                                        Owen





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