Re: Notebooks and page numbers



On Mon, Aug 02, 2010 at 09:24:20AM -0400, Jeff Clough wrote:
On Mon, 2010-08-02 at 15:11 +0200, David NeÄas wrote:

Anyway, if you need to maintain an association if the tabs do change you
can use a widget name â widget map for page identification (easy with
names set in Glade or simply using object-data on the notebook) and
gtk_notebook_page_num() to look up the page number if you have the
widget.

Do you have a handy link to where this would be documented or otherwise
further explained?  It sounds precisely like what I was looking for
earlier but couldn't find (library.gnome.org is not so much with the
working for me right now).

For what it's worth, I'm not using Glade.

Well, then

a) static: you likely have some structs (GObjects) that hold the GUI so
just add the page widgets there.

b) dynamic: after creating a new tab do

g_object_set_data(G_OBJECT(notebook), 'tab-misc', page_widget1);
g_object_set_data(G_OBJECT(notebook), 'tab-unsorted', page_widget2);
g_object_set_data(G_OBJECT(notebook), 'tab-other', page_widget3);
g_object_set_data(G_OBJECT(notebook), 'tab-stuff-that-does-not-really-belong-anywhere', page_widget4);
etc.

and then retrieve it with
page_widget = g_object_get_data(G_OBJECT(notebook), 'tab-misc');
etc.

c) with desctruction: if tabs can be also destroyed by the user you have
to connect to the notebook signals (or the page widget signals) and
manage the connection.

Yeti




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