Rebase browser_set_current_tab on _set_current_page

The behavior should really match.
This commit is contained in:
Christian Dywan 2011-12-09 21:11:01 +01:00
parent 9c11fb1219
commit a57850e533

View file

@ -7315,20 +7315,23 @@ void
midori_browser_set_current_page (MidoriBrowser* browser, midori_browser_set_current_page (MidoriBrowser* browser,
gint n) gint n)
{ {
gint n_pages;
GtkWidget* view; GtkWidget* view;
g_return_if_fail (MIDORI_IS_BROWSER (browser)); g_return_if_fail (MIDORI_IS_BROWSER (browser));
n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook)); view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n);
g_return_if_fail (n < n_pages); g_return_if_fail (view != NULL);
gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n); 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))) if (midori_view_is_blank (MIDORI_VIEW (view)))
gtk_action_activate (_action_by_name (browser, "Location")); gtk_action_activate (_action_by_name (browser, "Location"));
else else
gtk_widget_grab_focus (view); gtk_widget_grab_focus (view);
g_object_freeze_notify (G_OBJECT (browser));
g_object_notify (G_OBJECT (browser), "uri");
g_object_notify (G_OBJECT (browser), "tab");
g_object_thaw_notify (G_OBJECT (browser));
} }
/** /**
@ -7392,16 +7395,7 @@ midori_browser_set_current_tab (MidoriBrowser* browser,
g_return_if_fail (GTK_IS_WIDGET (view)); g_return_if_fail (GTK_IS_WIDGET (view));
n = gtk_notebook_page_num (GTK_NOTEBOOK (browser->notebook), view); n = gtk_notebook_page_num (GTK_NOTEBOOK (browser->notebook), view);
gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n); midori_browser_set_current_page (browser, n);
if (midori_view_is_blank (MIDORI_VIEW (view)))
gtk_action_activate (_action_by_name (browser, "Location"));
else
gtk_widget_grab_focus (view);
g_object_freeze_notify (G_OBJECT (browser));
g_object_notify (G_OBJECT (browser), "uri");
g_object_notify (G_OBJECT (browser), "tab");
g_object_thaw_notify (G_OBJECT (browser));
} }
/** /**