midori_browser_add_item (browser, item);
}
current = katze_item_get_meta_integer (KATZE_ITEM (_session), "current");
- if (current < 0)
- current = 0;
- midori_browser_set_current_page (browser, current);
if (!(item = katze_array_get_nth_item (_session, current)))
+ {
+ current = 0;
item = katze_array_get_nth_item (_session, 0);
+ }
+ midori_browser_set_current_page (browser, current);
if (!g_strcmp0 (katze_item_get_uri (item), ""))
midori_browser_activate_action (browser, "Location");
midori_browser_set_current_page (MidoriBrowser* browser,
gint n)
{
+ gint n_pages;
GtkWidget* view;
+ g_return_if_fail (MIDORI_IS_BROWSER (browser));
+
+ n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
+ g_return_if_fail (n < n_pages);
+
gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n);
if (midori_view_is_blank (MIDORI_VIEW (view)))