From 37b715e5711dbb0a5ee120121fd8eddd0a28cec0 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 28 Jul 2009 22:55:34 +0200 Subject: [PATCH] Add midori_browser_get_nth_tab to obtain a particular tab by index --- midori/midori-browser.c | 22 ++++++++++++++++++++++ midori/midori-browser.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index c69f219b..d6114e7f 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -6067,6 +6067,28 @@ midori_browser_get_current_page (MidoriBrowser* browser) return gtk_notebook_get_current_page (GTK_NOTEBOOK (browser->notebook)); } +/** + * midori_browser_get_nth_tab: + * @browser: a #MidoriBrowser + * @page: the index of a tab + * + * Retrieves the tab at the position @page. + * + * If there is no page present at all, %NULL is returned. + * + * Return value: the selected page, or -1 + * + * Since: 0.1.9 + **/ +GtkWidget* +midori_browser_get_nth_tab (MidoriBrowser* browser, + gint page) +{ + g_return_val_if_fail (MIDORI_IS_BROWSER (browser), NULL); + + return gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), page); +} + /** * midori_browser_set_current_tab: * @browser: a #MidoriBrowser diff --git a/midori/midori-browser.h b/midori/midori-browser.h index 49d475d6..08340280 100644 --- a/midori/midori-browser.h +++ b/midori/midori-browser.h @@ -122,6 +122,10 @@ midori_browser_set_current_page (MidoriBrowser* browser, gint midori_browser_get_current_page (MidoriBrowser* browser); +GtkWidget* +midori_browser_get_nth_tab (MidoriBrowser* browser, + gint n); + void midori_browser_set_current_tab (MidoriBrowser* browser, GtkWidget* widget);