Re: changing default notebook page title




Daniel Hops <Daniel.Hops@eed.ericsson.se> writes:

> Aaron Walker wrote:
> 
> > By default, the tab label for the first tab created by
> > gtk_notebook_new() is set to "Page 1".  Is there any way to change it,
> > besides removing that tab and then adding a new one with
> > gtk_notebook_append_page()?
> 
> Hi,
> 
> what about this:
> 
> void
> set_notebook_tab    (GtkWidget       *notebook,
>                                        gint             page_num,
>                                       GtkWidget       *widget)
> {
>   GtkNotebookPage *page;
>   GtkWidget *notebook_page;
> 
>   page = (GtkNotebookPage*) g_list_nth (GTK_NOTEBOOK (notebook)->children,
> page_num)->data;
>   notebook_page = page->child;
>   gtk_widget_ref (notebook_page);
>   gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), page_num);
>   gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), notebook_page,
>                             widget, page_num);
>   gtk_widget_unref (notebook_page);
> }

Hmmm, I'm also puzzled by this, if you _do_ need to change an
existing noteobok tab label why not use:

void gtk_notebook_set_tab_label_text      (GtkNotebook *notebook,
					   GtkWidget   *child,
					   const gchar *tab_text);

or:

void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
					   GtkWidget   *child,
					   GtkWidget   *tab_label);

Regards,
                                        Owen



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