i Add gtk_notebook_get_n_pages (#73229, Havoc Pennington)

Mon Sep 23 18:01:52 2002  Owen Taylor  <otaylor@redhat.com>
i
        * gtk/gtknotebook.[ch]: Add gtk_notebook_get_n_pages
        (#73229, Havoc Pennington)

        * gtk/gtknotebook.c (gtk_notebook_get_nth_page): Handle
        -1 to mean the last page, as we do elsewhere. (#73229)
This commit is contained in:
Owen Taylor
2002-09-23 22:05:41 +00:00
committed by Owen Taylor
parent 4d7d94f633
commit 9879b5b45c
8 changed files with 113 additions and 4 deletions

View File

@ -1,3 +1,17 @@
Mon Sep 23 18:01:52 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.[ch]: Add gtk_notebook_get_n_pages
(#73229, Havoc Pennington)
* gtk/gtknotebook.c (gtk_notebook_get_nth_page): Handle
-1 to mean the last page, as we do elsewhere. (#73229)
Mon Sep 23 17:50:23 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkentry.c gtk/gtkmenubar.c
gtk/gtkmenuitem.c gtk/gtktextview.c: Make
gtk_menu_shell_select_first() public. (#70373)
Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c: * gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c:

View File

@ -1,3 +1,17 @@
Mon Sep 23 18:01:52 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.[ch]: Add gtk_notebook_get_n_pages
(#73229, Havoc Pennington)
* gtk/gtknotebook.c (gtk_notebook_get_nth_page): Handle
-1 to mean the last page, as we do elsewhere. (#73229)
Mon Sep 23 17:50:23 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkentry.c gtk/gtkmenubar.c
gtk/gtkmenuitem.c gtk/gtktextview.c: Make
gtk_menu_shell_select_first() public. (#70373)
Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c: * gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c:

View File

@ -1,3 +1,17 @@
Mon Sep 23 18:01:52 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.[ch]: Add gtk_notebook_get_n_pages
(#73229, Havoc Pennington)
* gtk/gtknotebook.c (gtk_notebook_get_nth_page): Handle
-1 to mean the last page, as we do elsewhere. (#73229)
Mon Sep 23 17:50:23 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkentry.c gtk/gtkmenubar.c
gtk/gtkmenuitem.c gtk/gtktextview.c: Make
gtk_menu_shell_select_first() public. (#70373)
Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c: * gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c:

View File

@ -1,3 +1,17 @@
Mon Sep 23 18:01:52 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.[ch]: Add gtk_notebook_get_n_pages
(#73229, Havoc Pennington)
* gtk/gtknotebook.c (gtk_notebook_get_nth_page): Handle
-1 to mean the last page, as we do elsewhere. (#73229)
Mon Sep 23 17:50:23 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkentry.c gtk/gtkmenubar.c
gtk/gtkmenuitem.c gtk/gtktextview.c: Make
gtk_menu_shell_select_first() public. (#70373)
Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c: * gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c:

View File

@ -1,3 +1,17 @@
Mon Sep 23 18:01:52 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.[ch]: Add gtk_notebook_get_n_pages
(#73229, Havoc Pennington)
* gtk/gtknotebook.c (gtk_notebook_get_nth_page): Handle
-1 to mean the last page, as we do elsewhere. (#73229)
Mon Sep 23 17:50:23 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkentry.c gtk/gtkmenubar.c
gtk/gtkmenuitem.c gtk/gtktextview.c: Make
gtk_menu_shell_select_first() public. (#70373)
Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c: * gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c:

View File

@ -1,3 +1,17 @@
Mon Sep 23 18:01:52 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.[ch]: Add gtk_notebook_get_n_pages
(#73229, Havoc Pennington)
* gtk/gtknotebook.c (gtk_notebook_get_nth_page): Handle
-1 to mean the last page, as we do elsewhere. (#73229)
Mon Sep 23 17:50:23 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkentry.c gtk/gtkmenubar.c
gtk/gtkmenuitem.c gtk/gtktextview.c: Make
gtk_menu_shell_select_first() public. (#70373)
Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 23 16:48:46 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c: * gdk/gdkkeys.[ch] gdk/x11/gdkkeys-x11.c gdk/x11/gdkevents-x11.c:

View File

@ -4109,7 +4109,8 @@ gtk_notebook_get_current_page (GtkNotebook *notebook)
/** /**
* gtk_notebook_get_nth_page: * gtk_notebook_get_nth_page:
* @notebook: a #GtkNotebook * @notebook: a #GtkNotebook
* @page_num: the index of a page in the noteobok * @page_num: the index of a page in the noteobok, or -1
* to get the last page.
* *
* Returns the child widget contained in page number @page_num. * Returns the child widget contained in page number @page_num.
* *
@ -4121,17 +4122,40 @@ gtk_notebook_get_nth_page (GtkNotebook *notebook,
gint page_num) gint page_num)
{ {
GtkNotebookPage *page; GtkNotebookPage *page;
GList *list;
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL); g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
page = g_list_nth_data (notebook->children, page_num); if (page_num >= 0)
list = g_list_nth (notebook->children, page_num);
else
list = g_list_last (notebook->children);
if (page) if (list)
{
page = list->data;
return page->child; return page->child;
}
return NULL; return NULL;
} }
/**
* gtk_notebook_get_nth_page:
* @notebook: a #GtkNotebook
*
* Gets the number of pages in a notebook.
*
* Return value: the number of pages in the notebook.
**/
gint
gtk_notebook_get_n_pages (GtkNotebook *notebook)
{
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), 0);
return g_list_length (notebook->children);
}
/** /**
* gtk_notebook_page_num: * gtk_notebook_page_num:
* @notebook: a #GtkNotebook * @notebook: a #GtkNotebook

View File

@ -150,6 +150,7 @@ void gtk_notebook_remove_page (GtkNotebook *notebook,
gint gtk_notebook_get_current_page (GtkNotebook *notebook); gint gtk_notebook_get_current_page (GtkNotebook *notebook);
GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook, GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
gint page_num); gint page_num);
gint gtk_notebook_get_n_pages (GtkNotebook *notebook);
gint gtk_notebook_page_num (GtkNotebook *notebook, gint gtk_notebook_page_num (GtkNotebook *notebook,
GtkWidget *child); GtkWidget *child);
void gtk_notebook_set_current_page (GtkNotebook *notebook, void gtk_notebook_set_current_page (GtkNotebook *notebook,