Fix tab closing for good

This commit is contained in:
Christian Dywan 2008-07-14 21:14:57 +02:00
parent 17b8738be1
commit aecac9b748

View file

@ -717,9 +717,6 @@ midori_browser_tab_destroy_cb (GtkWidget* widget,
katze_xbel_folder_remove_item (browser->proxy_xbel_folder, xbel_item); katze_xbel_folder_remove_item (browser->proxy_xbel_folder, xbel_item);
katze_xbel_item_unref (xbel_item); katze_xbel_item_unref (xbel_item);
} }
GtkWidget* scrolled = _midori_browser_scrolled_for_child (browser, widget);
guint n = gtk_notebook_page_num (GTK_NOTEBOOK (browser->notebook), scrolled);
gtk_notebook_remove_page (GTK_NOTEBOOK (browser->notebook), n);
_midori_browser_update_actions (browser); _midori_browser_update_actions (browser);
return FALSE; return FALSE;
@ -730,17 +727,13 @@ midori_browser_window_menu_item_activate_cb (GtkWidget* menuitem,
GtkWidget* widget) GtkWidget* widget)
{ {
MidoriBrowser* browser; MidoriBrowser* browser;
GtkWidget* scrolled;
guint n;
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
browser = MIDORI_BROWSER (gtk_widget_get_toplevel (widget)); browser = MIDORI_BROWSER (gtk_widget_get_toplevel (widget));
g_return_if_fail (MIDORI_IS_BROWSER (browser)); g_return_if_fail (browser);
scrolled = _midori_browser_scrolled_for_child (browser, widget); midori_browser_set_current_tab (browser, widget);
n = gtk_notebook_page_num (GTK_NOTEBOOK (browser->notebook), scrolled);
gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
} }
static void static void
@ -955,6 +948,8 @@ _midori_browser_add_tab (MidoriBrowser* browser,
/* We want the tab to be removed if the widget is destroyed */ /* We want the tab to be removed if the widget is destroyed */
g_signal_connect_swapped (widget, "destroy", g_signal_connect_swapped (widget, "destroy",
G_CALLBACK (gtk_widget_destroy), menuitem); G_CALLBACK (gtk_widget_destroy), menuitem);
g_signal_connect_swapped (widget, "destroy",
G_CALLBACK (gtk_widget_destroy), scrolled);
g_signal_connect (widget, "destroy", g_signal_connect (widget, "destroy",
G_CALLBACK (midori_browser_tab_destroy_cb), browser); G_CALLBACK (midori_browser_tab_destroy_cb), browser);
@ -2179,6 +2174,7 @@ midori_browser_bookmarks_item_render_icon_cb (GtkTreeViewColumn* column,
GtkWidget* treeview) GtkWidget* treeview)
{ {
KatzeXbelItem* item; KatzeXbelItem* item;
gtk_tree_model_get (model, iter, 0, &item, -1); gtk_tree_model_get (model, iter, 0, &item, -1);
if (G_UNLIKELY (!item)) if (G_UNLIKELY (!item))
@ -2211,6 +2207,7 @@ midori_browser_bookmarks_item_render_text_cb (GtkTreeViewColumn* column,
GtkWidget* treeview) GtkWidget* treeview)
{ {
KatzeXbelItem* item; KatzeXbelItem* item;
gtk_tree_model_get (model, iter, 0, &item, -1); gtk_tree_model_get (model, iter, 0, &item, -1);
if (G_UNLIKELY (!item)) if (G_UNLIKELY (!item))