Avoid -1 to append tabs and use tab page in tab-switched

This commit is contained in:
Christian Dywan 2012-07-23 21:38:03 +02:00
parent 2adb54ae8d
commit d49d314c0b

View file

@ -1801,7 +1801,7 @@ _midori_browser_add_tab (MidoriBrowser* browser,
katze_array_move_item (browser->proxy_array, item, n); katze_array_move_item (browser->proxy_array, item, n);
} }
else else
n = -1; n = midori_browser_get_n_pages (browser) - 1;
katze_item_set_meta_integer (item, "append", -1); katze_item_set_meta_integer (item, "append", -1);
#ifdef HAVE_GRANITE #ifdef HAVE_GRANITE
@ -5271,6 +5271,8 @@ midori_browser_switched_tab (MidoriBrowser* browser,
if (new_view == NULL) if (new_view == NULL)
return; return;
g_return_if_fail (MIDORI_IS_VIEW (new_view));
uri = g_object_get_data (G_OBJECT (new_view), "midori-browser-typed-text"); uri = g_object_get_data (G_OBJECT (new_view), "midori-browser-typed-text");
if (!uri) if (!uri)
uri = midori_view_get_display_uri (new_view); uri = midori_view_get_display_uri (new_view);
@ -5351,10 +5353,10 @@ midori_browser_notebook_tab_switched_cb (GraniteWidgetsDynamicNotebook* notebook
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
gint new_pos = granite_widgets_dynamic_notebook_get_tab_position (notebook, new_tab); gint new_pos = granite_widgets_dynamic_notebook_get_tab_position (notebook, new_tab);
gint old_pos = old_tab ? granite_widgets_dynamic_notebook_get_tab_position (notebook, old_tab) : -1;
midori_browser_switched_tab (browser, midori_browser_switched_tab (browser,
old_tab ? midori_browser_get_nth_tab (browser, old_pos) : NULL, old_tab ? granite_widgets_tab_get_page (old_tab) : NULL,
MIDORI_VIEW (midori_browser_get_nth_tab (browser, new_pos)), new_pos); MIDORI_VIEW (granite_widgets_tab_get_page (new_tab)), new_pos);
} }
static void static void